jopt.js.spi.graph.node
Class ResourceNode

java.lang.Object
  extended byjopt.csp.spi.arcalgorithm.graph.node.AbstractNode
      extended byjopt.js.spi.graph.node.ResourceNode
All Implemented Interfaces:
jopt.csp.spi.solver.ChoicePointDataSource, jopt.csp.spi.arcalgorithm.graph.node.Node, jopt.csp.spi.arcalgorithm.graph.node.NodeChangeSource, jopt.csp.spi.util.Storable

public class ResourceNode
extends jopt.csp.spi.arcalgorithm.graph.node.AbstractNode

Node to represent resources

Author:
jboerkoel

Nested Class Summary
 
Nested classes inherited from class jopt.csp.spi.arcalgorithm.graph.node.AbstractNode
jopt.csp.spi.arcalgorithm.graph.node.AbstractNode.DomainListener
 
Field Summary
static int DISCRETE
           
static int UNARY
           
 
Constructor Summary
ResourceNode(java.lang.String name, ResourceDomain domain)
          Constructs a resource node from a name and domain
ResourceNode(java.lang.String name, ResourceDomain domain, int id)
          Constructs a resource node with given name, domain, and id
 
Method Summary
 boolean choicePointStackSet()
           
 void clearDelta()
           
 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
 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
 int getID()
          Returns the ID of this resource
 int getSize()
           
 java.lang.Object getState()
           
 int getTotalCapacityAvailable()
          This method will return the total amount of resource available.
 int getType()
          Returns the type of resource that this node represents
 boolean isBound()
          Returns true since this is always in a valid state by the nature of the domain
 boolean isInDomain(java.lang.Object val)
           
 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
 int maxAvailableResource(int start, int end)
          Gives the highest consistently available amount of this resource over the given range
 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
 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
 void registerAllocatedOperation(int operationID, int est, int let, int durMin)
          Lets the resource know that although a specific time has not necessary been decided, the specified operation will use this resource.
 void restoreState(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 setChoicePointStack(jopt.csp.spi.solver.ChoicePointStack cps)
           
 void setID(int id)
          Sets the id of this resource
 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.graph.node.AbstractNode
addDomainChangeListener, addedToGraph, addRangeChangeListener, addValueChangeListener, equals, getName, hashCode, inGraph, removedFromGraph, removeDomainChangeListener, removeRangeChangeListener, removeValueChangeListener, setName
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

UNARY

public static final int UNARY
See Also:
Constant Field Values

DISCRETE

public static final int DISCRETE
See Also:
Constant Field Values
Constructor Detail

ResourceNode

public ResourceNode(java.lang.String name,
                    ResourceDomain domain)
Constructs a resource node from a name and domain

Parameters:
name - name of this resource
domain - domain for this node

ResourceNode

public ResourceNode(java.lang.String name,
                    ResourceDomain domain,
                    int id)
Constructs a resource node with given name, domain, and id

Parameters:
name - name of this resource
domain - domain of this resource
id - id for this resource
Method Detail

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

getTotalCapacityAvailable

public 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

getType

public int getType()
Returns the type of resource that this node represents

Returns:
int type of resource that this node represents

getID

public int getID()
Returns the ID of this resource

Returns:
id of this resource

setID

public void setID(int id)
Sets the id of this resource

Parameters:
id - new id

registerAllocatedOperation

public void registerAllocatedOperation(int operationID,
                                       int est,
                                       int let,
                                       int durMin)
                                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:
operationID - operation id of operation using resource
est - earliest start time
let - latest end time
durMin - minimum duration
Throws:
jopt.csp.variable.PropagationFailureException

findAvailIntervals

public 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 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 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 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 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 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

isBound

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


isInDomain

public boolean isInDomain(java.lang.Object val)

getSize

public int getSize()

getState

public java.lang.Object getState()

restoreState

public void restoreState(java.lang.Object state)

clearDelta

public void clearDelta()

setChoicePointStack

public void setChoicePointStack(jopt.csp.spi.solver.ChoicePointStack cps)

choicePointStackSet

public boolean choicePointStackSet()

toString

public java.lang.String toString()