From: Marcos D. de A. <ma...@cs...> - 2008-12-31 05:59:41
|
Hi, technically speaking, it could be possible to run multiple simulation rounds in the same simulation process. SimJava's class Sim_system provides a feature that allows you to specify the termination condition, which I believe would allow you to specify the number of rounds: /** * Specify a termination condition based on the confidence interval accuracy obtained for a default measure. This * condition is considered only once the transient period has elapsed. The accuracy is the ratio of the confidence * interval's halfwidth over the measure's total mean. * @param type The termination condition type. This must be set to <code>INTERVAL_ACCURACY</code>. * @param output_analysis_type The output analysis method to be used as a variance reduction technique * @param level The confidence level for which the confidence interval will be calculated * @param accuracy The accuracy that is required to satisfy the termination condition * @param entity The name of the entity that contains the measure upon which the termination condition is based * @param measure The <code>int</code> constant that represents the default measure upon which the termination * condition is based */ public static void set_termination_condition(int type, int output_analysis_type, double level, double accuracy, String entity, int measure) However, I have never tried this method before and I believe it will not work because for it to work, Sim_system makes a copy of the entities at the start of the simulation and puts them in a backup list. At each simulation round the entities are copied from the backup list back to the list of entities. The entities have to implement the Cloneable interface and I think that not all entities in GridSim implement Cloneable. Alternatively, you can download the source code of SimJava2 and modify the Sim_system class to reset all static variables at the completion of the simulation. In this case, the code you have now would work. I believe that adding the following lines at the end of Sim_system.run() should suffice: incomplete = true; replications = null; total_time_elapsed = 0.0; total_transient_time = 0.0; min_batches = 10; max_batches = 20; run_data = null; trace_tags = null; default_trace = true; entity_trace = true; event_trace = true; entities = null; backup = null; future = null; deferred = null; clock = 0.0; running = false; onestopped = null; onecompleted = null; trcout = null; wait_predicates = null; Regards, Marcos On 26/12/2008, at 11:58 AM, coa...@ti... wrote: > Hello, > I am an Italian student of the Faculty of "Ingegneria > Informatica" of University of Catane, using Gridsim for my thesis. > I'd > like to know if there is a way to do many simulations with only one > java process. > > For example: I want to check how my scheduling algorithm > reacts to jobs of different length:short jobs and long jobs. > To do this > I want to make a simulation (SIMULATION_1) with a set of short > gridlets > and another simulation (SIMULATION_2) with a set of long gridlets. > I'd > like to start these two simulations with only one Java process. > > I've > tried a possible solution: I've set up two thread one for simulation_1 > and one for simulation_2. I've put GridSim.init(...) and GridSim. > startGridSimulation() lines in the run() method of each of the two > Threads. > Thread_1 works -> OK > Thread_2 doesn't work. > In fact, when > Thread_2 runs, all the Grid_sim entities doesn't execute their body() > method. > > I am sure that Thread_2 starts only after that Thread_1 has > Finished, because I've used the Thread.join() method and, in fact, on > the screen appears: > > " > ... > Simulation completed. > Initializing GridSim > package > ... > " > > where "Simulation completed" refers to the simulation_1 > and "Initializing GridSim package" refers to simulation_2. > > What > happens? > > What else can I do? > > Is there anybody who can help me, > please? > Thanks. > > > Con Tiscali Voce 8 Mega telefoni e navighi senza limiti a soli €15 > AL MESE PER 1 ANNO. In seguito paghi €29,90 al mese. Attiva entro > il giorno 08/01/09! http://abbonati.tiscali.it/promo/voce8mega/ > > ---------------------------------------------------------------------- > -------- > _______________________________________________ > Gridsim-users mailing list > Gri...@li... > https://lists.sourceforge.net/lists/listinfo/gridsim-users Marcos Dias de Assuncao Grid Computing and Distributed Systems (GRIDS) Laboratory Department of Computer Science and Software Engineering The University of Melbourne, Australia Email: ma...@cs... ------------- "It is well enough that people of the nation do not understand our banking and monetary system, for if they did, I believe there would be a revolution before tomorrow morning." Henry Ford |