jopt.js.spi.domain.resource
Class ResourceDomain

java.lang.Object
  extended byjopt.csp.spi.arcalgorithm.domain.AbstractDomain
      extended byjopt.js.spi.domain.resource.ResourceDomain
All Implemented Interfaces:
jopt.csp.spi.solver.ChoicePointDataSource, jopt.csp.spi.solver.ChoicePointEntryListener, jopt.csp.spi.arcalgorithm.domain.Domain, jopt.csp.spi.arcalgorithm.domain.DomainChangeSource
Direct Known Subclasses:
DiscreteResourceDomain, GranularResourceDomain, UnaryResourceDomain

public abstract class ResourceDomain
extends jopt.csp.spi.arcalgorithm.domain.AbstractDomain
implements jopt.csp.spi.solver.ChoicePointDataSource, jopt.csp.spi.solver.ChoicePointEntryListener

Base resource domain class. This is used as the basis of all other resource domains.


Method Summary
 void clearDelta()
           
abstract  jopt.csp.util.IntIntervalSet findAvailIntervals(int start, int end, int quantity)
          Returns a set indicating the intervals that this resource is available in the given quantity within the specified range
abstract  jopt.csp.util.IntIntervalSet findAvailIntervals(int operationID, int start, int end, int quantity)
          Returns a set indicating the intervals that this resource is available to the given operation in the given quantity within the specified range
 jopt.csp.spi.arcalgorithm.domain.IntDomain getBeginTime()
          Returns an IntDomain representing the first time that this resource will actually be used
 jopt.csp.spi.arcalgorithm.domain.IntDomain getCompleteTime()
          Returns an IntDomain representing the last time that this resource will actually be used
 java.lang.Object getDomainState()
           
 jopt.csp.spi.arcalgorithm.domain.IntDomain getMakeSpan()
          Returns an IntDomain representing the length of time that this resource is in use
 int getNumberOfOperationsAssigned()
          Returns the number of operations currently assigned to the resource
 jopt.csp.spi.arcalgorithm.domain.IntDomain getNumOps()
          Returns an IntDomain representing the number of operations that use this resource
 int getResourceEnd()
          This obtains the last point for which this resource is, or ever was, available
 int getResourceStart()
          Obtains the first point for which this resource is, or ever was, available
abstract  int getTotalCapacityAvailable()
          This method will return the total amount of resource available.
abstract  int getType()
          Returns an int representing the type of resource this is domain represents
 boolean isBound()
          Returns true since this is always in a valid state by the nature of the domain
 boolean isBuilt()
          Determines if this domain is in "built" status
abstract  boolean isResourceAvailable(int operationID, int start, int end, int quantity)
          Determines whether the resource is available in the specified quantity between specified start and end times for the given operation
 boolean isUsed()
          Checks to see if any operation requires the use of this resource at any time.
abstract  int maxAvailableResource(int start, int end)
          Gives the highest consistently available amount of this resource over the given range
abstract  int maxAvailableResource(int operationID, int start, int end)
          Gives the highest consistently available amount of this resource over the given range for the given operation
abstract  int maxAvailableResource(int operationID, int start, int end, int minDur)
          Gives the highest consistently available amount of this resource over the given range for the given operation and assuming that the reource will be used for at least the specified duration
 boolean needsPropagation()
          Returns whether or not this class has been altered, thus rendering its arcs in need of propagation
abstract  void registerAllocatedOperation(int opID, int est, int let, int minDur)
          Lets the resource know that although a specific time has not necessary been decided, the specified operation will use this resource.
 void restoreDomainState(java.lang.Object state)
           
 void setActualOperationTimeline(int operationID, jopt.csp.util.IntIntervalSet timeline)
          Registers the amount of time the specified operation will be using this resource
 void setBuilt(boolean built)
          Sets the built status of this domain
 void setChoicePointStack(jopt.csp.spi.solver.ChoicePointStack cps)
           
 void setNeedsPropagation(boolean needsPropagation)
          Sets the nnedsPropagation flag to the given boolean
 void setPotentialOperationTimeline(int operationID, jopt.csp.util.IntIntervalSet timeline)
          Indicates the time during which the specified operation may be using this resource
 java.lang.String toString()
           
 
Methods inherited from class jopt.csp.spi.arcalgorithm.domain.AbstractDomain
addDomainChangeListener, addRangeChangeListener, addValueChangeListener, changed, clone, removeDomainChangeListener, removeRangeChangeListener, removeValueChangeListener
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface jopt.csp.spi.solver.ChoicePointDataSource
choicePointStackSet
 
Methods inherited from interface jopt.csp.spi.solver.ChoicePointEntryListener
afterChoicePointPopEvent, afterChoicePointPushEvent, beforeChoicePointPopEvent, beforeChoicePointPushEvent
 

Method Detail

isBuilt

public boolean isBuilt()
Determines if this domain is in "built" status

Returns:
true if domain is in built status

setBuilt

public void setBuilt(boolean built)
Sets the built status of this domain

Parameters:
built - boolean indication whether or not the problem has been built

getNumOps

public jopt.csp.spi.arcalgorithm.domain.IntDomain getNumOps()
Returns an IntDomain representing the number of operations that use this resource

Returns:
IntDomain representing the number of operations that use this resource

getMakeSpan

public jopt.csp.spi.arcalgorithm.domain.IntDomain getMakeSpan()
Returns an IntDomain representing the length of time that this resource is in use

Returns:
IntDomain representing the length of time that this resource is in use

getBeginTime

public jopt.csp.spi.arcalgorithm.domain.IntDomain getBeginTime()
Returns an IntDomain representing the first time that this resource will actually be used

Returns:
IntDomain representing the first time that this resource will actually be used

getCompleteTime

public jopt.csp.spi.arcalgorithm.domain.IntDomain getCompleteTime()
Returns an IntDomain representing the last time that this resource will actually be used

Returns:
IntDomain representing the last time that this resource will actually be used

findAvailIntervals

public abstract jopt.csp.util.IntIntervalSet findAvailIntervals(int start,
                                                                int end,
                                                                int quantity)
Returns a set indicating the intervals that this resource is available in the given quantity within the specified range

Parameters:
start - start of interval inquired about
end - end of interval inquired about
quantity - amound of resource required
Returns:
An IntInterval set that represents the intervals that this resource is available in the given quantity for the specified interval

findAvailIntervals

public abstract jopt.csp.util.IntIntervalSet findAvailIntervals(int operationID,
                                                                int start,
                                                                int end,
                                                                int quantity)
Returns a set indicating the intervals that this resource is available to the given operation in the given quantity within the specified range

Parameters:
operationID - operation for whome we are checking the availability
start - start of interval inquired about
end - end of interval inquired about
quantity - amound of resource required
Returns:
An IntInterval set that represents the intervals that this resource is available in the given quantity for the specified interval

isResourceAvailable

public abstract boolean isResourceAvailable(int operationID,
                                            int start,
                                            int end,
                                            int quantity)
Determines whether the resource is available in the specified quantity between specified start and end times for the given operation

Parameters:
operationID - the operationID of the operation in question
start - start of interval being inquired about
end - end of interval being inquired about
quantity - quantity of resource needed
Returns:
true if resource is available in quantity specified between start and end

maxAvailableResource

public abstract int maxAvailableResource(int start,
                                         int end)
Gives the highest consistently available amount of this resource over the given range

Parameters:
start - start of range being inquired about
end - end of range being inquired about
Returns:
returns the highest consistently available amount of this resource over the given range, that is, over the range, there is at least X left at all times

maxAvailableResource

public abstract int maxAvailableResource(int operationID,
                                         int start,
                                         int end)
Gives the highest consistently available amount of this resource over the given range for the given operation

Parameters:
operationID - the operationID of the operation in question
start - start of range being inquired about
end - end of range being inquired about
Returns:
the highest consistently available amount of this resource

maxAvailableResource

public abstract int maxAvailableResource(int operationID,
                                         int start,
                                         int end,
                                         int minDur)
Gives the highest consistently available amount of this resource over the given range for the given operation and assuming that the reource will be used for at least the specified duration

Parameters:
operationID - the operationID of the operation in question
start - start of range being inquired about
end - end of range being inquired about
minDur - the minimum duration
Returns:
the highest consistently available amount of this resource

setChoicePointStack

public void setChoicePointStack(jopt.csp.spi.solver.ChoicePointStack cps)
Specified by:
setChoicePointStack in interface jopt.csp.spi.solver.ChoicePointDataSource

getNumberOfOperationsAssigned

public int getNumberOfOperationsAssigned()
Returns the number of operations currently assigned to the resource

Returns:
number of operations currently assigned to the resource

setPotentialOperationTimeline

public void setPotentialOperationTimeline(int operationID,
                                          jopt.csp.util.IntIntervalSet timeline)
                                   throws jopt.csp.variable.PropagationFailureException
Indicates the time during which the specified operation may be using this resource

Parameters:
operationID - id of operation
timeline - times potentially being used
Throws:
jopt.csp.variable.PropagationFailureException

setActualOperationTimeline

public void setActualOperationTimeline(int operationID,
                                       jopt.csp.util.IntIntervalSet timeline)
                                throws jopt.csp.variable.PropagationFailureException
Registers the amount of time the specified operation will be using this resource

Parameters:
operationID - id of operation
timeline - times being used
Throws:
jopt.csp.variable.PropagationFailureException

getType

public abstract int getType()
Returns an int representing the type of resource this is domain represents

Returns:
Resource.UNARY, Resource.DISCRETE, etc.

getResourceStart

public int getResourceStart()
Obtains the first point for which this resource is, or ever was, available

Returns:
int representing the first point this resource is, or ever was, available

getResourceEnd

public int getResourceEnd()
This obtains the last point for which this resource is, or ever was, available

Returns:
int representing the last point this resource is, or ever was, available

getTotalCapacityAvailable

public abstract int getTotalCapacityAvailable()
This method will return the total amount of resource available. That is, the sum of the capacity over time.

Returns:
sum of available capacity over time

isUsed

public boolean isUsed()
Checks to see if any operation requires the use of this resource at any time.

Returns:
true if any operation requires the use of this resource at any point in time.

registerAllocatedOperation

public abstract void registerAllocatedOperation(int opID,
                                                int est,
                                                int let,
                                                int minDur)
                                         throws jopt.csp.variable.PropagationFailureException
Lets the resource know that although a specific time has not necessary been decided, the specified operation will use this resource. This allows the resource to account for operations that have been assigned to the resource but not completely bound

Parameters:
opID - operation id of operation using resource
est - earliest start time
let - latest end time
minDur - minimum duration
Throws:
jopt.csp.variable.PropagationFailureException

isBound

public boolean isBound()
Returns true since this is always in a valid state by the nature of the domain

Specified by:
isBound in interface jopt.csp.spi.arcalgorithm.domain.Domain

toString

public java.lang.String toString()

needsPropagation

public boolean needsPropagation()
Returns whether or not this class has been altered, thus rendering its arcs in need of propagation

Returns:
true if this class has been altered, thus rendering its arcs in need of propagation

setNeedsPropagation

public void setNeedsPropagation(boolean needsPropagation)
Sets the nnedsPropagation flag to the given boolean

Parameters:
needsPropagation - boolean to set the needs Propagation flag

clearDelta

public void clearDelta()
Specified by:
clearDelta in interface jopt.csp.spi.arcalgorithm.domain.Domain

getDomainState

public java.lang.Object getDomainState()
Specified by:
getDomainState in interface jopt.csp.spi.arcalgorithm.domain.Domain

restoreDomainState

public void restoreDomainState(java.lang.Object state)
Specified by:
restoreDomainState in interface jopt.csp.spi.arcalgorithm.domain.Domain