karrlab / de_sim Goto Github PK
View Code? Open in Web Editor NEWPython-based object-oriented discrete-event simulation tool for complex, data-driven modeling
License: MIT License
Python-based object-oriented discrete-event simulation tool for complex, data-driven modeling
License: MIT License
Create a terminate() method for SimulationEngine.simulate(). A simulation can terminate in multiple ways, such as run out of events, exceed end time, trigger stop condition, or raise an exception. In some cases, it would be useful for a simulation run to perform certain actions before terminating. Example actions include:
I imagine that terminate() could
As per JK's email of 8/19
Ensure that any sequence of times that does not have precision exceeding the width of the precision in the filename can be represented.
Use scientific notation for string representations of checkpoint times in checkpoint file names.
And raise exceptions for sequences of times that have excess precision.
This should include at least one example.
Ideally, this would also include a tutorial and/or example as a Jupyter notebook which can be hosted at https://sandbox.karrlab.org
Perhaps a JIT Python run-time can speed up DE-Sim.
Move the iterable string mapping functions iterable_not_str()
and nested_elements_to_str()
from event.py
to wc_utils
Fix the commented-out tests in TestEvent.test_event_w_message()
Some PDES applications, like parallel SSA, need to receive all simultaneous messages at once. Make it possible to override _SimulationEngine__handle_event_list()
and support arbitrary superposition.
Checkpoint.get_checkpoint()
is slow because it uses Checkpoint.list_checkpoints(dirname)
. Speed it up by creating an AccessCheckpoint
class that caches the value returned by Checkpoint.list_checkpoints()
.
Use the faster class in wc_sim
.
Could be implemented with progress
package
https://pypi.org/project/progress/
Fix problem with tests in test_mock_simulator
Have simulation_engine.simulate()
allow certain files in self.de_sim_config.output_dir
. Could just prohibit checkpoint files of the form created by AccessCheckpoints.get_filename()
, which would avoid polluting output_dir
with checkpoints from multiple runs.
When done, update Simulation.run()
in wc sim.
If a configuration option is set, profile the performance of a simulation.
move default_center_of_mass to multialgorithm/config/core.default.cfg
Use SimulationMetadata to document each simulation run
saving the stop_condition function is useless, and pickle fails on locals. the right way to do it is 1) identify attributes in the config that shouldn't be saved in metadata and make stop_condition one of them.
the stop_condition can always be recovered from the WC model
Provide file, function & line number in logging calls. Unfortunately, logging2 doesn't support stacklevel
(which logging added in 3.8), which would make this easy.
Submitted issue asking for stacklevel
to logging2
.
When working, put {source}:{function:s}:{line:d}
in logger templates in debug log config files.
Also fix in wc_sim
.
save it in a debug log, or some other useful format.
As David wrote:
But often simulation time is considered to be just the high-order component of virtual time, and additional low-order components are assumed as well. In the latter case a virtual time can be considered an ordered pair v = (s,z), where s is simulation time, and z is a totally ordered “subtime” value used for synchronization within any instant of simulation time.
Provide programmer control over subtime.
Make real reset()
method, that sets up a simulation engine for another simulation after initialize()
:
Related to #12.
Try adding this line back to the MANIFEST
include de_sim/VERSION
Ensure that event_time_tiebreaker
is unique across all instances of an ApplicationSimulationObject
class
test get_simulation_state
, shared_state is not None
Support shutoff of profiling output to stdout
when profiling
Perhaps return num_events
when profiling
AuthorMetadata needs more data than just the username; how should it be provided?
A config file would be best.
Add a warning or error if the stop condition is true when a simulation starts
A general purpose mechanism to checkpoint and restore a simulation, including all of its simulation objects and the state of the simulation will be hard to build.
The easy part will be a mechanism to checkpoint and restore simulation objects whose attributes are all elementary datatypes or collections of elementary datatypes. Then a get_state
method could package up the state of a running instance of the class and a restore_state(checkpointed_state)
method could restore the state.
But many potential parts of a simulation might not be collections of elementary datatypes. These include:
These are all hard to checkpoint and restore because it is difficult to obtain the entirety of their states, and it is difficult to restore their states.
We defer this functionality until it is needed.
Add count_events attribute to ApplicationSimulationObjectMetadata
and have simulate()
only report sum of events in objects for which count_events is true.
Use this to not count checkpoints in reported events.
For each todo, either resolve it, delete it, or create an issue for it
use copy_event_bodies
as the default value for copy
in SimulationObject.send_event_absolute()
evaluate additional simulation applications
make and record replicated runs with each number of sim objs
separate from unittests
Automatically:
retain results with commit tag
graph results with distributions across replicated runs
Details to be determined
# todo: fix: this doesn't get used:
os.path.expanduser('~/.wc/de_sim.debug.cfg'),
Especially:
The simulation while loop, while self.time <= end_time
Rename end_time
to max_time
, which is more accurate.
Move stop condition evaluation to immediately after selection of the next event
Return execution time as well
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.