Module optseq2 :: Class Resource
[hide private]
[frames] | no frames]

Class Resource

source code

Instance Methods [hide private]
 
__init__(self, name='', capacity=0, rhs=0, direction='<=')
OptSeq resource class.
source code
 
__str__(self) source code
 
addCapacity(self, start=0, finish=0, amount=1)
Adds a capacity to the resource.
source code
 
addTerms(self, coeffs=[], vars=[], values=[])
Add new terms into left-hand-side of nonrenewable resource constraint.
source code
 
printConstraint(self)
Returns the information of the linear constraint.
source code
 
setRhs(self, rhs=0)
Sets the right-hand-side of linear constraint.
source code
Method Details [hide private]

__init__(self, name='', capacity=0, rhs=0, direction='<=')
(Constructor)

source code 

OptSeq resource class.

  • Arguments:
    • name: Name of resource. Remark that strings in OptSeq are restricted to a-z, A-Z, 0-9,[],_ and @.
    • capacity (optional): Capacity dictionary of the renewable (standard) resource. Capacity dictionary maps intervals (pairs of start time and finish time) to amounts of capacity.
    • rhs (optional): Right-hand-side constant of nonrenewable resource constraint.
    • direction (optional): Rirection (or sense) of nonrenewable resource constraint; "<=" (default) or ">=" or "=".
  • Attbibutes:
    • capacity: Capacity dictionary of the renewable (standard) resource.
    • rhs: Right-hand-side constant of nonrenewable resource constraint.
    • direction: Rirection (or sense) of nonrenewable resource constraint; "<=" (default) or ">=" or "=".
    • terms: List of terms in left-hand-side of nonrenewable resource. Each term is a tuple of coeffcient,activity and mode.

addCapacity(self, start=0, finish=0, amount=1)

source code 

Adds a capacity to the resource.

  • Arguments:
    • start(optional): Start time. Non-negative integer. Default=0.
    • finish(optional): Finish time. Non-negative integer. Default=0. Interval (start,finish) defines the interval during which the capacity is added.
    • amount(optional): The amount to be added to the capacity. Positive integer. Default=1.
  • Example usage:
    >>> manpower.addCapacity(0,5,2)

addTerms(self, coeffs=[], vars=[], values=[])

source code 

Add new terms into left-hand-side of nonrenewable resource constraint.

  • Arguments:
    • coeffs: Coefficients for new terms; either a list of coefficients or a single coefficient. The three arguments must have the same size.
    • vars: Activity objects for new terms; either a list of activity objects or a single activity object. The three arguments must have the same size.
    • values: Mode objects for new terms; either a list of mode objects or a single mode object. The three arguments must have the same size.
  • Example usage:
    >>> budget.addTerms(1,act,express)

    adds one unit of nonrenewable resource (budget) if activity "act" is executed in mode "express."

printConstraint(self)

source code 

Returns the information of the linear constraint.

The constraint is expanded and is shown in a readable format.

setRhs(self, rhs=0)

source code 

Sets the right-hand-side of linear constraint.

  • Argument:
    • rhs: Right-hand-side of linear constraint.
  • Example usage:
    >>> L.setRhs(10)