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.


Field Summary
private  int I
          Number of machines
private  int[] jobRoutes
          The length of this array is numJobTypes.
private  int[] numJobs
          The length of this array is numJobTypes, each element determines how many jobs are from each type.
private  int numJobTypes
          The different number of jobs types in the job shop
private  int[][] routes
          Array of routes, each route being an array of operations
private  double[][] stepDurations
          This is a ragged array of job durations per each step.
 
Constructor Summary
GeneralShopDataArray(java.io.Reader reader)
          Read according to file format as specified in example shop.dat
 
Method Summary
 java.util.List getCi(int i)
          Returns a List of all operation in machine i.
 int getI()
          Returns number of machines.
 java.lang.String[] getJobsOfRoute(int r)
          Returns all of of route r.
 java.lang.String[] getJobsOfType(int t)
          Returns all of the jobs of type t.
 int getK()
          Returns the total number of steps/classes/buffers (sum of Kr)
 int getKr(int r)
          Returns number of steps in route r
 int getMachine(Operation op)
          Returns the machine that performs the following operation.
 int getN()
          Returns total number of jobs
 int getNr(int r)
          Returns number of jobs in route r
 int getNt(int t)
          Returns the number of jobs of type t
 int getR()
          Returns number of routes.
 java.util.List getRoute(int r)
          Returns a List of all ShopData.Operation instances in route r
 int getRouteOfType(int t)
          Returns the route of type t.
 int getSizeCi(int i)
          Returns the number of operations in machine i.
 int getT()
          Returns number of job types.
 int getTr(int r)
          Returns the number of types of jobs that are on route r.
 int[] getTypesOfRoute(int r)
          Returns an array of type numbers of jobs that are on route r.
 double getXto(int t, int o)
          Returns the processing time of job of type t, on step o of it's route.
 boolean isIdenticalJobs()
          Ask if the shop has identical jobs.
 boolean isMostGeneralJobShop()
          Ask if the shop is most general, not necessarily proportional nor similar. reply is true.
 boolean isProportinalJobs()
          Ask if the shop has proportional jobs.
 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

private int I
Number of machines

routes

private int[][] routes
Array of routes, each route being an array of operations

numJobTypes

private int numJobTypes
The different number of jobs types in the job shop

numJobs

private int[] numJobs
The length of this array is numJobTypes, each element determines how many jobs are from each type.

jobRoutes

private int[] jobRoutes
The length of this array is numJobTypes. It associates a route number to each job type

stepDurations

private double[][] stepDurations
This is a ragged array of job durations per each step. The length of the first dimension of the array is numJobTypes. The length of the second dimension is the jobRoutes[job number] and it's values are the processing times in each step of the route.
Constructor Detail

GeneralShopDataArray

public GeneralShopDataArray(java.io.Reader reader)
                     throws JobShopFileFormatException,
                            java.io.IOException
Read according to file format as specified in example shop.dat
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

getN

public int getN()
Returns total number of jobs
Specified by:
getN in interface ShopData

getT

public int getT()
Returns number of job types.
Specified by:
getT in interface ShopData

getK

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

getNt

public int getNt(int t)
Returns the number of jobs of type t
Specified by:
getNt in interface ShopData

getTr

public int getTr(int r)
Returns the number of types of jobs that are on route r.
Specified by:
getTr in interface ShopData

getTypesOfRoute

public int[] getTypesOfRoute(int r)
Returns an array of type numbers of jobs that are on route r.
Specified by:
getTypesOfRoute in interface ShopData

getJobsOfType

public java.lang.String[] getJobsOfType(int t)
Returns all of the jobs of type t. The length of this array is getNt(t).
Specified by:
getJobsOfType in interface ShopData

getJobsOfRoute

public java.lang.String[] getJobsOfRoute(int r)
Description copied from interface: ShopData
Returns all of of route r. This includes all of the jobs of all types that are associated with route r
Specified by:
getJobsOfRoute 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

getRouteOfType

public int getRouteOfType(int t)
Returns the route of type t.
Specified by:
getRouteOfType in interface ShopData

getKr

public int getKr(int r)
Description copied from interface: ShopData
Returns number of steps in route r
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

getNr

public int getNr(int r)
Description copied from interface: ShopData
Returns number of jobs in route r
Specified by:
getNr 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

isIdenticalJobs

public boolean isIdenticalJobs()
Ask if the shop has identical jobs. Reply is false
Specified by:
isIdenticalJobs in interface ShopData

isProportinalJobs

public boolean isProportinalJobs()
Ask if the shop has proportional jobs. Reply is false
Specified by:
isProportinalJobs in interface ShopData

isMostGeneralJobShop

public boolean isMostGeneralJobShop()
Ask if the shop is most general, not necessarily proportional nor similar. reply is true.
Specified by:
isMostGeneralJobShop 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