I am recently developing software with AnyLogic and I have a question about how to run with the fastest speed from outside.
My current code for running a simulation is like this.
package defaultpackage;
import com.anylogic.engine.Experiment;
import agvver1.*;
public class MyClass{
public static void main(String[] args) {
Simulation thisSim = new Simulation();
thisSim.run();
Experiment.State ThisState = thisSim.getState();
while(!ThisState.equals(Experiment.State.FINISHED)) {
try
{
Thread.sleep(1000);
}
catch(InterruptedException ex)
{
Thread.currentThread().interrupt();
}
ThisState = thisSim.getState();
}
System.out.println(Main.totalTardy);
}
}
It is not so efficient but it can produce outputs very slowly.
How can I run it with the fastest speed as I did it in AnyLogic at virtual speed? I found ExperiemntRunFast class but I have no idea how to use it.
Thanks in advance and have a wonderful day!
[Update] I tried runFast but it still doesn't work. Please see attached.
Instead of
try
Should do the trick :-)