Package jmt.engine.random.engine

Examples of jmt.engine.random.engine.RandomEngine


        //generator of random numbers (uses the same engine of
        //distributions and strategies) used to mix the order of
        //leaving jobs, otherwise they leave in order of class
        //(i.e. c1, c1, c1, ...c2, c2, c2, ... c3....)
        RandomEngine randomEng = RandomEngine.makeDefault();

        //delay used to mix leaving order
        double mixRandomDelay = 0.0;

        while (jobClasses.hasNext()) {
          jobClass = jobClasses.next();

          //NEW
          //@author Stefano Omini
          if (jobClass.getType() == JobClass.OPEN_CLASS) {
            //open class: no jobs to be generated
            continue;
          }
          //end NEW

          c = jobClass.getId();

          if (jobsPerClass != null) {

            //terminal of a closed system
            //generates all the jobs
            for (int i = 0; i < jobsPerClass[c]; i++) {
              //note that if jobsPerClass[c] = -1 (open class) the instructions
              //of this for are not performed

              //each job is created and sent to the terminal itself
              job = new Job(jobClass);

              //OLD
              // the delay of departure is set to 0
              //sendMe(job, 0);

              //NEW
              //@author Stefano Omini
              //sets a random (very small) delay to mix the jobs
              //of different classes

              //mixRandomDelay = (randomEng.nextDouble()) * 0.00001;
              mixRandomDelay = (randomEng.raw()) * 0.00001;

              sendMe(job, mixRandomDelay);
              //end NEW

              //log.write(NetLog.LEVEL_DEBUG, job, this, NetLog.JOB_CREATED);
View Full Code Here


    for (int c = 0; c < classNumber; c++) {
      totJobs += preload_jobPerClass[c];
      residualClassJobs[c] = preload_jobPerClass[c];
    }

    RandomEngine randomEng = RandomEngine.makeDefault();
    int randomClassIndex;

    JobClassList jobClasses = getJobClasses();

    while (totJobs > 0) {
      //jobs of different classes must be mixed.. use random numbers

      randomClassIndex = (int) Math.floor((randomEng.raw()) * classNumber);

      if (residualClassJobs[randomClassIndex] > 0) {
        //other jobs to be added
        Job newJob = new Job(jobClasses.get(randomClassIndex));
        JobInfo newJobInfo = new JobInfo(newJob);
View Full Code Here

TOP

Related Classes of jmt.engine.random.engine.RandomEngine

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.