haifa.shopsim.algorithms
Class RandomJobAlgorithm

java.lang.Object
  |
  +--haifa.shopsim.algorithms.AbstractAlgorithm
        |
        +--haifa.shopsim.algorithms.RandomJobAlgorithm
All Implemented Interfaces:
ShopAlgorithm

public class RandomJobAlgorithm
extends AbstractAlgorithm

This algorithms decides what do by drawing from a discrete uniform distribution on all of the job classes that are schedulable at a given time.


Field Summary
(package private)  double[] cumProb
           
(package private) static java.lang.String EXPLANATION
           
private  int[] initialNr
           
private  long lastSeed
          Stores the value of the last seed that was used during a reset () method.
private  java.util.Random random
           
 
Fields inherited from class haifa.shopsim.algorithms.AbstractAlgorithm
log, shopData, shopSimulation, shopState
 
Constructor Summary
RandomJobAlgorithm()
           
RandomJobAlgorithm(ShopData shopData_)
           
RandomJobAlgorithm(ShopData shopData_, ShopState shopState_)
           
RandomJobAlgorithm(ShopData shopData_, ShopState shopState_, java.io.PrintWriter log_)
           
 
Method Summary
 java.lang.String explanationString()
          Returns a string telling a little bit about what the algorithm does.
 java.lang.String getAlgorithmName()
          Returns a name of the algorithm.
 boolean isDeterministic()
          Returns true if the algorithm is determinsitic.
 void reset()
          Resets the algorithm.
 void setShopStateObject(ShopState shopState_)
          Set the algorithm's ShopState object.
static java.lang.String StaticGetAlgorithmName()
           
 ShopCommand whatNow(int machineNumber)
          Very simply reads a command from console and returns a ShopCommmand object.
 
Methods inherited from class haifa.shopsim.algorithms.AbstractAlgorithm
quitCalled, setEnabled, setLog, setShopData, setShopSimulationObject, toString
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, wait, wait, wait
 

Field Detail

EXPLANATION

static final java.lang.String EXPLANATION

initialNr

private int[] initialNr

cumProb

double[] cumProb

random

private java.util.Random random

lastSeed

private long lastSeed
Stores the value of the last seed that was used during a reset () method.
Constructor Detail

RandomJobAlgorithm

public RandomJobAlgorithm()

RandomJobAlgorithm

public RandomJobAlgorithm(ShopData shopData_,
                          ShopState shopState_,
                          java.io.PrintWriter log_)

RandomJobAlgorithm

public RandomJobAlgorithm(ShopData shopData_,
                          ShopState shopState_)

RandomJobAlgorithm

public RandomJobAlgorithm(ShopData shopData_)
Method Detail

setShopStateObject

public void setShopStateObject(ShopState shopState_)
Description copied from interface: ShopAlgorithm
Set the algorithm's ShopState object. The algorithm looks at this Object and makes decisions based on it whenever the whatNow message is called.
Overrides:
setShopStateObject in class AbstractAlgorithm

reset

public void reset()
Resets the algorithm.
Overrides:
reset in class AbstractAlgorithm

whatNow

public ShopCommand whatNow(int machineNumber)
Very simply reads a command from console and returns a ShopCommmand object.

explanationString

public java.lang.String explanationString()
Description copied from interface: ShopAlgorithm
Returns a string telling a little bit about what the algorithm does.
Overrides:
explanationString in class AbstractAlgorithm

isDeterministic

public boolean isDeterministic()
Description copied from interface: ShopAlgorithm
Returns true if the algorithm is determinsitic.

StaticGetAlgorithmName

public static java.lang.String StaticGetAlgorithmName()

getAlgorithmName

public java.lang.String getAlgorithmName()
Description copied from interface: ShopAlgorithm
Returns a name of the algorithm.