samples.tutorials.to_sort.socialgolfer
Class ScalarAtMost

java.lang.Object
  extended by choco.kernel.solver.propagation.Propagator
      extended by choco.kernel.solver.constraints.AbstractSConstraint<IntDomainVar>
          extended by choco.kernel.solver.constraints.integer.AbstractIntSConstraint
              extended by choco.kernel.solver.constraints.integer.AbstractLargeIntSConstraint
                  extended by samples.tutorials.to_sort.socialgolfer.ScalarAtMost
All Implemented Interfaces:
IExtensionnable, IPretty, SConstraint<IntDomainVar>, IntPropagator, Cloneable, EventListener

public class ScalarAtMost
extends AbstractLargeIntSConstraint


Nested Class Summary
static class ScalarAtMost.ScalarAtMostManager
           
 
Field Summary
 IStateBitSet instPairs
           
 int k
           
 int n
           
 IStateInt nbEqs
           
 
Fields inherited from class choco.kernel.solver.constraints.AbstractSConstraint
cIndices, constraintType, extensions, vars
 
Fields inherited from class choco.kernel.solver.propagation.Propagator
active, constAwakeEvent, priority, propagationEngine
 
Fields inherited from interface choco.kernel.solver.constraints.SConstraint
LOGGER
 
Constructor Summary
ScalarAtMost(IEnvironment environment, IntDomainVar[] vars, int n, int k)
           
 
Method Summary
 void awake()
          Propagation: Propagating the constraint for the very first time until local consistency is reached.
 void awakeOnInst(int idx)
          Default propagation on instantiation: full constraint re-propagation.
static int Cnk(int n, int k)
           
 void filter()
           
 boolean isSatisfied()
          Default implementation of the isSatisfied by delegating to the isSatisfied(int[] tuple)
static void main(String[] args)
           
 boolean productNull(IntDomainVar v1, IntDomainVar v2)
           
 boolean productOne(IntDomainVar v1, IntDomainVar v2)
           
 void propagate()
          Propagation: Propagating the constraint until local consistency is reached.
 void propagateDiff(int i)
           
 void propagateEq(int i)
           
 String toString()
           
 void updateDataStructure(int idx)
           
 
Methods inherited from class choco.kernel.solver.constraints.integer.AbstractIntSConstraint
awakeOnBounds, awakeOnInf, awakeOnRem, awakeOnRemovals, awakeOnSup, getConstraintType, isConsistent, isSatisfied
 
Methods inherited from class choco.kernel.solver.constraints.AbstractSConstraint
addExtension, addListener, clone, getAbstractSConstraintExtensionNumber, getConstraintIdx, getExtension, getFineDegree, getNbVarNotInst, getNbVars, getVar, getVarQuick, isCompletelyInstantiated, isEntailed, opposite, pretty, setConstraintIndex, setExtension, setVar
 
Methods inherited from class choco.kernel.solver.propagation.Propagator
activate, constAwake, fail, getEvent, getFilteredEventMask, getPriority, isActive, setActive, setActiveSilently, setEntailed, setPassive, setPropagationEngine
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

instPairs

public IStateBitSet instPairs

nbEqs

public IStateInt nbEqs

n

public int n

k

public int k
Constructor Detail

ScalarAtMost

public ScalarAtMost(IEnvironment environment,
                    IntDomainVar[] vars,
                    int n,
                    int k)
Method Detail

productNull

public boolean productNull(IntDomainVar v1,
                           IntDomainVar v2)

productOne

public boolean productOne(IntDomainVar v1,
                          IntDomainVar v2)

updateDataStructure

public void updateDataStructure(int idx)

awake

public void awake()
           throws ContradictionException
Description copied from class: Propagator
Propagation: Propagating the constraint for the very first time until local consistency is reached.

Overrides:
awake in class Propagator
Throws:
ContradictionException - contradiction exception

propagateDiff

public void propagateDiff(int i)
                   throws ContradictionException
Throws:
ContradictionException

filter

public void filter()
            throws ContradictionException
Throws:
ContradictionException

propagate

public void propagate()
               throws ContradictionException
Description copied from class: Propagator
Propagation: Propagating the constraint until local consistency is reached.

Specified by:
propagate in class Propagator
Throws:
ContradictionException - contradiction exception

awakeOnInst

public void awakeOnInst(int idx)
                 throws ContradictionException
Description copied from class: AbstractIntSConstraint
Default propagation on instantiation: full constraint re-propagation.

Specified by:
awakeOnInst in interface IntPropagator
Overrides:
awakeOnInst in class AbstractIntSConstraint
Throws:
ContradictionException

toString

public String toString()
Overrides:
toString in class AbstractSConstraint<IntDomainVar>

main

public static void main(String[] args)

Cnk

public static int Cnk(int n,
                      int k)

isSatisfied

public boolean isSatisfied()
Description copied from class: AbstractIntSConstraint
Default implementation of the isSatisfied by delegating to the isSatisfied(int[] tuple)

Specified by:
isSatisfied in interface SConstraint<IntDomainVar>
Overrides:
isSatisfied in class AbstractIntSConstraint
Returns:
true if the constraint is satisfied

propagateEq

public void propagateEq(int i)
                 throws ContradictionException
Throws:
ContradictionException


Copyright © 2012. All Rights Reserved.