Module scop2 :: Class Alldiff
[hide private]
[frames] | no frames]

Class Alldiff

source code

object --+    
         |    
Constraint --+
             |
            Alldiff

Instance Methods [hide private]
 
__init__(self, name=None, varlist=None, weight=1)
Alldiff type constraint constructor.
source code
 
__str__(self)
Return the information of the alldiff constraint.
source code
 
addVariable(self, var)
Adds new variable into all-different type constraint.
source code
 
addVariables(self, varlist)
Adds variables into all-different type constraint.
source code
 
feasible(self, allvars)
Returns True if the constraint is defined correctly.
source code

Inherited from Constraint: setWeight

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __subclasshook__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, name=None, varlist=None, weight=1)
(Constructor)

source code 

Alldiff type constraint constructor.

  • Arguments:
    • name: Name of all-different type constraint.
    • varlist (optional): List of variables that must have differennt value indices.
    • weight (optional): Positive integer representing importance of constraint.
  • Attributes:
    • name: Name of all-different type constraint.
    • varlist (optional): List of variables that must have differennt value indices.
    • weight (optional): Positive integer representing importance of constraint.
Overrides: object.__init__

__str__(self)
(Informal representation operator)

source code 

Return the information of the alldiff constraint.

Overrides: object.__str__

addVariable(self, var)

source code 

Adds new variable into all-different type constraint.

  • Arguments:
    • var : Variable object added to all-different type constraint.
  • Example usage:
    >>> AD.addVaeiable( x )

addVariables(self, varlist)

source code 

Adds variables into all-different type constraint.

  • Arguments:
    • varlist: List or tuple of variable objects added to all-different type constraint.
  • Example usage:
    >>> AD.addVariables( x, y, z )
    >>> AD.addVariables( [x1,x2,x2] )