Skip to content

Commit

Permalink
Merge pull request #205 from cadCAD-org/hot_fix
Browse files Browse the repository at this point in the history
Added Upgrade Guide to documentation and updated CHANGELOG
  • Loading branch information
JEJodesty authored Sep 22, 2020
2 parents e0c19a2 + 566bae1 commit 922dad1
Show file tree
Hide file tree
Showing 2 changed files with 141 additions and 4 deletions.
8 changes: 4 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
### September 22, 2020
##### [Multi - System Model Execution](https://github.com/cadCAD-org/cadCAD/blob/master/documentation/Simulation_Execution.md#multiple-simulation-execution)
* **ver. ≥ `0.4.23`:**
* Hot-Fix: [#203](https://github.com/cadCAD-org/cadCAD/pull/203) (**No Breaking Changes**)
* Simulation results will no longer return truncated results / exclude the results of the last
`cadCAD.configuration.Configuration` appended to `cadCAD.configs`.
* Issue: [#195](https://github.com/cadCAD-org/cadCAD/issues/195)
* **Hot-Fix:** [#203](https://github.com/cadCAD-org/cadCAD/pull/203) (**No Breaking Changes**)
* Multi - System Model simulation results will no longer return truncated results (exclude the results of the last
`cadCAD.configuration.Configuration` appended to `cadCAD.configs`).
* Issue: [#195](https://github.com/cadCAD-org/cadCAD/issues/195)


### August 5, 2020
Expand Down
137 changes: 137 additions & 0 deletions documentation/cadCAD-v0.4.23-Model-Upgrade-Guide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
<table>
<tr>
<th>
Feature
</th>
<th>
ver. 0.4.23
</th>
<th>
ver. 0.3.1 (Deprecated)
</th>
</tr>
<tr>
<td>
<h5>
Experiments
</h5>
</td>
<td>
<pre lang="python">
from cadCAD.configuration import Experiment
exp = Experiment()
exp.append_configs(...)
</pre>
</td>
<td>
<pre lang="python">
from cadCAD.configuration import append_configs
append_configs(…)
</pre>
</td>
</tr>
<tr>
<td>
<h5>
Local Execution Mode
</h5>
</td>
<td>
<pre lang="python">
from cadCAD.engine import ExecutionMode, ExecutionContext
exec_mode = ExecutionMode()
local_ctx = ExecutionContext(context=exec_mode.local_mode)
</pre>
</td>
<td>
<p>Multi-Threaded</p>
<pre lang="python">
from cadCAD.engine import ExecutionMode, ExecutionContext
exec_mode = ExecutionMode()
single_ctx = ExecutionContext(context=exec_mode.multi_proc)
</pre>
<p>Single-Threaded</p>
<pre lang="python">
from cadCAD.engine import ExecutionMode, ExecutionContext
exec_mode = ExecutionMode()
multi_ctx = ExecutionContext(context=exec_mode.single_proc)
</pre>
</td>
</tr>
<tr>
<td>
<h5>
cadCAD Post-Processing Enhancements / Modifications
</h5>
</td>
<td>
<pre lang="python">
import pandas as pd
from tabulate import tabulate
from cadCAD.engine import ExecutionMode, ExecutionContext, Executor
import system_model_A, system_model_B

from cadCAD import configs
exec_mode = ExecutionMode()

local_ctx = ExecutionContext(context=exec_mode.local_mode)
simulation = Executor(exec_context=local_ctx, configs=configs)
raw_result, sys_model, _ = simulation.execute()
result = pd.DataFrame(raw_result)
print(tabulate(result, headers='keys', tablefmt='psql'))
</pre>
</td>
<td>
<pre lang="python">
import pandas as pd
from tabulate import tabulate
from cadCAD.engine import ExecutionMode, ExecutionContext, Executor
import system_model_A, system_model_B
from cadCAD import configs

exec_mode = ExecutionMode()
multi_ctx = ExecutionContext(context=exec_mode.multi_proc)
simulation = Executor(exec_context=multi_ctx, configs=configs)
i = 0
config_names = ['sys_model_A', 'sys_model_B']
for raw_result, _ in simulation.execute():
result = pd.DataFrame(raw_result)
print()
print(f"{config_names[i]} Result: System Events DataFrame:")
print(tabulate(result, headers='keys', tablefmt='psql'))
print()
i += 1

</pre>
</td>
</tr>

<tr>
<td>
<h5>
Expandable state and policy update parameter
</h5>
</td>
<td>
<pre lang="python">
def state_update(_params, substep, sH, s, _input, **kwargs):
return 'state_variable_name', new_value
def policy(_params, substep, sH, s, **kwargs):
return {'signal_1': value_1, …, 'signal_N': value_N}
</pre>
</td>
<td>
<pre lang="python">
def state_update(_params, substep, sH, s, _input):
return 'state_variable_name', new_value
def policy(_params, substep, sH, s):
return {'signal_1': value_1, …, 'signal_N': value_N}
</pre>
</td>
</tr>
</table>

0 comments on commit 922dad1

Please sign in to comment.