haifa.shopsim.algorithms
Class DWFluidAlgorithm

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

public class DWFluidAlgorithm
extends AbstractAlgorithm

This class is not still ready. It runs the simulation, but does not terminate.


Field Summary
(package private)  int bottleMachine
          The index of the bottleneck machine.
(package private)  int[] bottleNeckOperations
          An array of buffer numbers (according to kitted) that states the operations of the botleneck machine.
(package private)  int currentPart
          The part during which the algorithm is found.
(package private)  int cycleIndex
           
static java.lang.String EXPLANATION
           
(package private)  boolean firstTimePartTwo
           
(package private)  java.util.HashMap kittedRoutesMap
          Keys are Operation objects and values are Integers 1,...,NumOps
(package private)  int[] machineIndexes
          An array that has an index for each machine (the index for the bottlenck don't mean nothin. and the index says on which step from the nonBottleneckOperations the machine is working.
(package private)  java.util.HashMap maxUpstreamMap
          Keys are operaton objects and values are Integers.
(package private)  int[][] nonBottleNeckOperations
          An array of arrays, having I (num of machines) arrays.
(package private)  boolean[] nonBottleNotFinishedCycle
          An array of booleans where the spot corresponding to machine i is true if the machine still hasn't completed all of it's steps with the bottlecycle.
(package private)  int numCycles
           
(package private)  int numK
          The number of buffers in the route.
protected static int PART_ALARM
          This part should only occur at a few (low prob) instances of the problem.
protected static int PART_ONE
          This part is the creation of the safety stocks.
protected static int PART_THREE
          This part is the empting of the system after the bottleneck machine has finsihed.
protected static int PART_TWO
          This part is the "body" of the algorithm, work in cycles.
protected static int PART_ZERO
          This means that the algorithm still hasn't started.
private  java.util.Random random
           
(package private)  boolean[] restingMachines
          An array of booleans having true for each machine that is resting.
(package private)  java.util.HashMap reverseKittedRoutesMap
          Keys are Integers and values are Operation objects.
(package private)  double SAFETY_CONSTANT
          Safety stocks are calucated as SAFETY_CONSTANT * log(Number in route).
(package private)  int[] safetyStocks
          The number of safety stocks to be put in every buffer.
 
Fields inherited from class haifa.shopsim.algorithms.AbstractAlgorithm
log, shopData, shopSimulation, shopState
 
Constructor Summary
DWFluidAlgorithm()
           
DWFluidAlgorithm(ShopData shopData_)
           
 
Method Summary
protected  void calcNeededSafetyStocks()
          Must be called after numK is already set.
protected  void doPartZero()
           
private  int downStreamOfOperation(Operation op)
          Returns the number of jobs on the route of operation that are past it (have completed it).
 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.
protected  void locateBottleNeck()
          Find the bottleneck machine.
 void reset()
          Does nothing, (may be overridden).
protected  void setBottleNeckOperations()
           
protected  void setNonBottleNeckOperations()
           
protected  void setUpKittedMaps()
          Sets up the kitted hash map (concatantation of the routes).
static java.lang.String StaticGetAlgorithmName()
           
private  boolean timeToMoveToPartThree()
           
 ShopCommand whatNow(int machineNumber)
          Works by separtaing the timeline of the system to four parts and a special part that.
(package private)  ShopCommand whatNowPartAlarm(int machineNumber)
           
protected  ShopCommand whatNowPartOne(int machineNumber)
           
(package private)  ShopCommand whatNowPartThree(int machineNumber)
           
(package private)  ShopCommand whatNowPartTwo(int machineNumber)
           
 
Methods inherited from class haifa.shopsim.algorithms.AbstractAlgorithm
quitCalled, setEnabled, setLog, setShopData, setShopSimulationObject, setShopStateObject, toString
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, wait, wait, wait
 

Field Detail

EXPLANATION

public static final java.lang.String EXPLANATION

PART_ZERO

protected static final int PART_ZERO
This means that the algorithm still hasn't started.

PART_ONE

protected static final int PART_ONE
This part is the creation of the safety stocks.

PART_TWO

protected static final int PART_TWO
This part is the "body" of the algorithm, work in cycles.

PART_THREE

protected static final int PART_THREE
This part is the empting of the system after the bottleneck machine has finsihed.

PART_ALARM

protected static final int PART_ALARM
This part should only occur at a few (low prob) instances of the problem. It means that the heuristic has become infeasble.

SAFETY_CONSTANT

double SAFETY_CONSTANT
Safety stocks are calucated as SAFETY_CONSTANT * log(Number in route).

kittedRoutesMap

java.util.HashMap kittedRoutesMap
Keys are Operation objects and values are Integers 1,...,NumOps

reverseKittedRoutesMap

java.util.HashMap reverseKittedRoutesMap
Keys are Integers and values are Operation objects.

numK

int numK
The number of buffers in the route.

bottleMachine

int bottleMachine
The index of the bottleneck machine.

bottleNeckOperations

int[] bottleNeckOperations
An array of buffer numbers (according to kitted) that states the operations of the botleneck machine.

nonBottleNeckOperations

int[][] nonBottleNeckOperations
An array of arrays, having I (num of machines) arrays. The i'th array refers to the opertations perforemd by machine i-1. The contents in the spot of the bottleneck machine is undefined .

safetyStocks

int[] safetyStocks
The number of safety stocks to be put in every buffer. Indexed by the buffers as they are mapped in the kittedRoutesMap.

currentPart

int currentPart
The part during which the algorithm is found.

maxUpstreamMap

java.util.HashMap maxUpstreamMap
Keys are operaton objects and values are Integers.

restingMachines

boolean[] restingMachines
An array of booleans having true for each machine that is resting. When all is true, the algorithm knows that Part one is done with.

cycleIndex

int cycleIndex

machineIndexes

int[] machineIndexes
An array that has an index for each machine (the index for the bottlenck don't mean nothin. and the index says on which step from the nonBottleneckOperations the machine is working. The values are of the indexes start at 0

nonBottleNotFinishedCycle

boolean[] nonBottleNotFinishedCycle
An array of booleans where the spot corresponding to machine i is true if the machine still hasn't completed all of it's steps with the bottlecycle. When a machine completes it's last step, it sets the value to false, later, when the bottleneck machine starts another cycle, it brings the values to true again.

numCycles

int numCycles

firstTimePartTwo

boolean firstTimePartTwo

random

private java.util.Random random
Constructor Detail

DWFluidAlgorithm

public DWFluidAlgorithm()

DWFluidAlgorithm

public DWFluidAlgorithm(ShopData shopData_)
Method Detail

reset

public void reset()
Description copied from class: AbstractAlgorithm
Does nothing, (may be overridden).
Overrides:
reset in class AbstractAlgorithm

setUpKittedMaps

protected void setUpKittedMaps()
Sets up the kitted hash map (concatantation of the routes). Requires the shop Data to be set.

locateBottleNeck

protected void locateBottleNeck()
Find the bottleneck machine. Requires the shopData to be set.

setBottleNeckOperations

protected void setBottleNeckOperations()

setNonBottleNeckOperations

protected void setNonBottleNeckOperations()

calcNeededSafetyStocks

protected void calcNeededSafetyStocks()
Must be called after numK is already set. Requires the shop state to be set.

whatNow

public ShopCommand whatNow(int machineNumber)
Works by separtaing the timeline of the system to four parts and a special part that.

doPartZero

protected void doPartZero()

whatNowPartOne

protected ShopCommand whatNowPartOne(int machineNumber)

downStreamOfOperation

private int downStreamOfOperation(Operation op)
Returns the number of jobs on the route of operation that are past it (have completed it).

whatNowPartTwo

ShopCommand whatNowPartTwo(int machineNumber)

timeToMoveToPartThree

private boolean timeToMoveToPartThree()

whatNowPartThree

ShopCommand whatNowPartThree(int machineNumber)

whatNowPartAlarm

ShopCommand whatNowPartAlarm(int machineNumber)

isDeterministic

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

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

StaticGetAlgorithmName

public static java.lang.String StaticGetAlgorithmName()

getAlgorithmName

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