Giter Site home page Giter Site logo

Comments (9)

chwyean avatar chwyean commented on July 18, 2024

Good catch @matthewsowders !

@pierrelecuyer: Do you know why it is coded this way? We can call init() earlier, so the evlist won't be emptied. However, the old eventList will be emptied.

  public void init (EventList evlist) {
      if (evlist == null)
         throw new NullPointerException();
      init();
      eventList = evlist;

Otherwise, we'll have to remove that sentence from the javadoc.

from ssj.

chwyean avatar chwyean commented on July 18, 2024

@matthewsowders : Could you describe/explain the reason you would need to initialize the simulator with a non-empty event list (instead of adding the events after initialization)?
We are trying to assess the need to allow init to keep a non-empty event list, because the events can be added after the initialization. We could create a new method that would allow the user to replace the event list.

from ssj.

matthewsowders avatar matthewsowders commented on July 18, 2024

I would like to run simulations that will run for 12 hours or more. I would like to make the system fault tolerant so I'd like to be able to serialize the state of the simulator (time, event data and schedule) at certain events. I would store the intermediate state in some service like S3 and use SimpleWorkflowService to manage the long running process that way if the simulation fails 11 hours into a 12 hour simulation, I can take the most recent state and continue the simulation from that point. I've attached some sample code. Let me know if I'm trying to do this a dumb way.

sample-code.zip

from ssj.

pierrelecuyer avatar pierrelecuyer commented on July 18, 2024

from ssj.

pierrelecuyer avatar pierrelecuyer commented on July 18, 2024

from ssj.

matthewsowders avatar matthewsowders commented on July 18, 2024

pierrelecuyer@

It could be made as an extension point such that the client is responsible for passing in a serializer/deserializer (I used jackson, but other users might want java serialization or something else). Then again, it was easy to write so maybe it is best left out of the simulation package. Maybe it would be better as an extension package outside SSJ, something like SSJ-serialization. Do you think it will be useful to others?

from ssj.

pierrelecuyer avatar pierrelecuyer commented on July 18, 2024

from ssj.

chwyean avatar chwyean commented on July 18, 2024

I have corrected the javadoc: 2d82af5
It now states that the event list evlist will be cleared. If the user wants to initialize with a non-empty list, then he can extend the class Simulator and implement his initialization method.

There are many ways to manage serialization, and it is likely implementation dependent. It is best left for advanced user to extend the Simulator, which is not too difficult as shown by @matthewsowders.

from ssj.

matthewsowders avatar matthewsowders commented on July 18, 2024

Thanks to both of you for looking into this!

from ssj.

Related Issues (9)

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.