My main question is how do you stop a schedule.scheduleRepeating()?? or
is there something better to use for what i want to do??
I am new to MASON and agent based programming in general, so I am sorry
if this is a basic problem but I have spent about 12 hours almost
straight on this now and have not got anywhere :-(
What I want to do is run a simulation until a flag = true store that
result and then run the same simulation again (x number of times).
Preferably with the results at the end of each simulation being
displayed in a chart. (simulations could run one after another or all
together should not matter that much, would maybe like to have an option
for either though if one is not a lot more complex than the other.
The problem I am getting at the moment is stopping the
schedule.scheduleRepeating() I just cant do it! think i have tried
everything but it does not seem to stop.
I have included part of my code so you can see what I am trying to do
/*** MODEL CLASS ***/
public void start()
grid = new IntGrid2D(N, N);
grid = new IntGrid2D(gridWidth, gridHeight);
NKSpace_Gen nkGen = new NKSpace_Gen(System.currentTimeMillis());
*// ** I basically want to get this **bit below **to repeat x number of
time and then get it to stop when the agent flags a variable in the
agents step method to be true ***
Agent agent1 = new Agent(System.currentTimeMillis());
/*** AGENT CLASS ***/
public void step(SimState state)
if (mutantNeighbours.numObjs > 0 && higherFitness == false)
if (higherFitness == true)
higherFitness = false;
System.out.println(" Higher Fitness Values Found ");
System.out.println("Fitness Value: "+ localPeak);
peakFound = true; *//** this is where I set
peakFound to true and where I want to store the localPeak value and stop
that agent at present it just keeps printing the two system.out.println
to the console forever. (note they are only there for debug I actually
will have a graphics showing the values. *
if (peakFound == false)
System.out.println("*** Current Fitness Searched ***");
System.out.println("Fitness Value: "+ currentFitness);
ANY HELP or comments would be MUCH APPRECIATED!!