1

Is it possible to perform look ahead simulation in AnyLogic? Specifically:

  1. Simulate till time T.
  2. Using 2 values of a variable, simulate for both values till T+t in parallel.
  3. Evaluate the system state at T+t, choose the value of variable which leads to better performance.
  4. Continue simulating from T using the selected value for the variable.

This is the basic functionality I am trying to implement. The variable values can be taken from decision tree, which should not affect the implementation.

Please let me know if someone has done something like this.

User42
  • 970
  • 1
  • 16
  • 27

1 Answers1

2

Yes, it is possible with some Java code. You may:

  1. Pause parent experiment, save snapshot at time T;
  2. Create two new experiments from parent experiment;
  3. Load snapshots in two new experiments;
  4. Continue execution of both experiments till time T + t;
  5. Send notification to parent experiment, compare the results, assign the best value and continue simulation.

Some points can be done manually with UI controls or by code, some — by code only.

Gregory Monahov
  • 711
  • 3
  • 7
  • I could find the method to be called for pause, save, and load snapshots. Can you please guide me regarding runTillTime() method and communication between two experiments? – Swapnil Renushe Dec 07 '16 at 14:13
  • The "Using 2 values of a variable, simulate for both values till T+t in parallel" also means you need to worry about designing your model so that changes to this mid-run are 'clean' (possibly using on-change functionality of AnyLogic parameters to 'chain down' any effects of changing that variable). It may be fine depending on your model functionality. – Stuart Rossiter Dec 08 '16 at 09:45
  • @SwapRenushe, run till time T+t: `getEngine().runFast(time() + constant);`. Experiment communication: since you create experiment instance by from another experiment, just save reference to new experiment in parent experiment. You can get its top-level agent and all its members with something like: `((Main)getEngine().getRoot())` – Gregory Monahov Dec 08 '16 at 12:16