Git Product home page Git Product logo

de_sim's People

Contributors

artgoldberg avatar jonrkarr avatar karr-lab-daemon avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

de_sim's Issues

Terminate method

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:

  1. Before terminating take a checkpoint that could be used for debugging
  2. Open an interactive session that could be used to inspect the simulator

I imagine that terminate() could

  • execute some events scheduled for the end of the simulation
  • perform some tasks that are not simulation events
  • and exit

Improve conversion of checkpoint times to & from filenames

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.

Clean up event.py

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()

Speed up Checkpoint.get_checkpoint()

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.

Have simulation_engine.simulate() allow some files in the output_dir

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.

profile performance

If a configuration option is set, profile the performance of a simulation.

Decide how to handle stop conditions in metadata

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

Include location info in logging calls

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.

Better subtime than object name

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.

real reset()

Make real reset() method, that sets up a simulation engine for another simulation after initialize():

  • Empty event queues
  • Restore all objects to their initial states

Related to #12.

Enhance SimulationObject

Ensure that event_time_tiebreaker is unique across all instances of an ApplicationSimulationObject class

AuthorMetadata needs data

AuthorMetadata needs more data than just the username; how should it be provided?
A config file would be best.

Restart from a Checkpoint

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:

  • References to methods and functions
  • Open file handles, network sockets, etc.
  • Running subprocesses

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.

Refine reporting of number of events in a simulation

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.

Handle todos

For each todo, either resolve it, delete it, or create an issue for it

use copy_event_bodies

use copy_event_bodies as the default value for copy in SimulationObject.send_event_absolute()

Improve performance tests of core

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

Fix logging

    # todo: fix: this doesn't get used:
    os.path.expanduser('~/.wc/de_sim.debug.cfg'),

Review the simulation engine

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.