haifa.shopsim
Class GeneralShopDataArray

java.lang.Object
  |
  +--haifa.shopsim.GeneralShopDataArray
All Implemented Interfaces:
ShopData

public class GeneralShopDataArray
extends java.lang.Object
implements ShopData

An implementation of a general shopData using arrays. With specified file format (.jbs).

Version:
1.1

Field Summary
protected  int I
          Number of machines
protected  int R
          Number of routes.
protected  int[][] routes
          Array of routes, each route being an array of operations (an operation is specified by a machine index).
protected  double[][] stepDurations
          This is a ragged array of job durations per each step.
 
Constructor Summary
protected GeneralShopDataArray()
          Does nothing.
  GeneralShopDataArray(java.io.Reader reader)
          Read according to file format.
 
Method Summary
 java.util.List getCi(int i)
          Returns a List of all operation in machine i.
 int getI()
          Returns number of machines.
 int getK()
          Returns the total number of steps/classes/buffers (sum of Kr)
 int getKr(int r)
          Returns number of steps in route r, r=1,....,getR().
 int getMachine(Operation op)
          Returns the machine that performs the following operation.
 double getMaxMachineMean()
          Returns the "machine lower bound".
 double getMaxRouteMean()
          Returns the "job lower bound".
 double getMeanOfMachine(int machineNumber)
          Returns the sum of the means of all the processing times of all operations on a machine.
 double getMeanOfRoute(int routeNumber)
          Returns the sum of all of the processing times that compose a route.
 double getMeanOfRouteOnMacine(int machine, int route)
          Returns the time that the machine needs to spend working on jobs from the route.
 double[] getMeanOfRoutesOnMachine(int machine_)
          Returns an array of length getR(), such that each element has getMeanOfRouteOnMachine(machine_,r) for r=0,...,getR()-1.
 double[][] getMeansOfRoutesOnMachines()
          Returns a matrix whose first dimenstion is the number of machines and second dimension is the number of routes.
 int getR()
          Returns number of routes.
 java.util.List getRoute(int r)
          Returns a List of all ShopData.Operation instances in route r
 int getSizeCi(int i)
          Returns the number of operations in machine i.
 double getXto(int t, int o)
          Returns the processing time of job of type t, on step o of it's route.
 double getXto(Operation op)
          Returns the processing time of the proper operation.
 boolean isSingleRoute()
          Ask is shop is a jobshop with a single route same as getR()==1
static void main(java.lang.String[] args)
          For testing
 java.lang.String toString()
          Returns all info regarding jobshop in a displayable string
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, wait, wait, wait
 

Field Detail

I

protected int I
Number of machines

R

protected int R
Number of routes.

routes

protected int[][] routes
Array of routes, each route being an array of operations (an operation is specified by a machine index).

stepDurations

protected double[][] stepDurations
This is a ragged array of job durations per each step. The dimensions of this array are the same as the routes [][] array. It's values are the processing times in each step of the route. (maybe considered as means.)
Constructor Detail

GeneralShopDataArray

protected GeneralShopDataArray()
Does nothing.

GeneralShopDataArray

public GeneralShopDataArray(java.io.Reader reader)
                     throws JobShopFileFormatException,
                            java.io.IOException
Read according to file format.
Method Detail

getI

public int getI()
Returns number of machines.
Specified by:
getI in interface ShopData

getR

public int getR()
Returns number of routes.
Specified by:
getR in interface ShopData

getK

public int getK()
Returns the total number of steps/classes/buffers (sum of Kr)
Specified by:
getK in interface ShopData

getXto

public double getXto(int t,
                     int o)
Returns the processing time of job of type t, on step o of it's route.
Specified by:
getXto in interface ShopData

getXto

public double getXto(Operation op)
Description copied from interface: ShopData
Returns the processing time of the proper operation.
Specified by:
getXto in interface ShopData

getKr

public int getKr(int r)
Description copied from interface: ShopData
Returns number of steps in route r, r=1,....,getR().
Specified by:
getKr in interface ShopData

getMachine

public int getMachine(Operation op)
Description copied from interface: ShopData
Returns the machine that performs the following operation.
Specified by:
getMachine in interface ShopData

getCi

public java.util.List getCi(int i)
Returns a List of all operation in machine i. The elements of the list are arrays of ShopData.Operation instances
Specified by:
getCi in interface ShopData

getSizeCi

public int getSizeCi(int i)
Returns the number of operations in machine i.
Specified by:
getSizeCi in interface ShopData

getRoute

public java.util.List getRoute(int r)
Returns a List of all ShopData.Operation instances in route r
Specified by:
getRoute in interface ShopData

isSingleRoute

public boolean isSingleRoute()
Ask is shop is a jobshop with a single route same as getR()==1
Specified by:
isSingleRoute in interface ShopData

getMeanOfMachine

public double getMeanOfMachine(int machineNumber)
Description copied from interface: ShopData
Returns the sum of the means of all the processing times of all operations on a machine.
Specified by:
getMeanOfMachine in interface ShopData

getMeanOfRoute

public double getMeanOfRoute(int routeNumber)
Description copied from interface: ShopData
Returns the sum of all of the processing times that compose a route.
Specified by:
getMeanOfRoute in interface ShopData

getMaxRouteMean

public double getMaxRouteMean()
Description copied from interface: ShopData
Returns the "job lower bound".
Specified by:
getMaxRouteMean in interface ShopData

getMaxMachineMean

public double getMaxMachineMean()
Description copied from interface: ShopData
Returns the "machine lower bound".
Specified by:
getMaxMachineMean in interface ShopData

getMeanOfRouteOnMacine

public double getMeanOfRouteOnMacine(int machine,
                                     int route)
Returns the time that the machine needs to spend working on jobs from the route.
Specified by:
getMeanOfRouteOnMacine in interface ShopData

getMeanOfRoutesOnMachine

public double[] getMeanOfRoutesOnMachine(int machine_)
Returns an array of length getR(), such that each element has getMeanOfRouteOnMachine(machine_,r) for r=0,...,getR()-1.
Specified by:
getMeanOfRoutesOnMachine in interface ShopData

getMeansOfRoutesOnMachines

public double[][] getMeansOfRoutesOnMachines()
Returns a matrix whose first dimenstion is the number of machines and second dimension is the number of routes. The rows of the matrix are getMeanOfRoutesOnMachine(i).
Specified by:
getMeansOfRoutesOnMachines in interface ShopData

toString

public java.lang.String toString()
Returns all info regarding jobshop in a displayable string
Overrides:
toString in class java.lang.Object

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
For testing