choco.kernel.common.opres.nosum
Class NoSumList

java.lang.Object
  extended by choco.kernel.common.opres.nosum.NoSumList

public class NoSumList
extends Object

A class mainly used in Pack Constraint. The algorithm checks if there is a sum of the candidate values between the given bounds.

Author:
Arnaud Malapert

Constructor Summary
NoSumList(INoSumCell[] candidates)
          The Constructor.We assume that the items are sorted in non increasing order.
NoSumList(int[] candidates)
           
NoSumList(IntDomainVar[] candidates)
           
 
Method Summary
 void clear()
           
 void fillCandidates()
           
 int getCandidatesLoad()
          Gets the candidates load.
 int getMaximumLoad()
          Gets the candidates load.
 int getNbCandidates()
           
 int getRequiredLoad()
          Gets the required load.
 ListIterator<INoSumCell> listIterator()
           
 boolean noSum(int alpha, int beta)
          No sum indicates the existence of a subset of candidate items which has a load between the parameters.
 void pack(int item)
           
 void pack(ListIterator<INoSumCell> iter, int item)
           
 void packRemoved(int item)
           
 void remove(int item)
           
 void remove(ListIterator<INoSumCell> iter, int item)
           
 void setCandidatesFromVar(SetVar svar)
           
 void undoRemove(ListIterator<INoSumCell> iter, int item)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NoSumList

public NoSumList(INoSumCell[] candidates)
The Constructor.We assume that the items are sorted in non increasing order.

Parameters:
sizes -

NoSumList

public NoSumList(IntDomainVar[] candidates)

NoSumList

public NoSumList(int[] candidates)
Method Detail

clear

public final void clear()

getNbCandidates

public final int getNbCandidates()

fillCandidates

public final void fillCandidates()

setCandidatesFromVar

public final void setCandidatesFromVar(SetVar svar)

getCandidatesLoad

public final int getCandidatesLoad()
Gets the candidates load.

Returns:
the candidates load

getRequiredLoad

public final int getRequiredLoad()
Gets the required load.


getMaximumLoad

public final int getMaximumLoad()
Gets the candidates load.

Returns:
the candidates load

remove

public final void remove(int item)

pack

public final void pack(int item)

listIterator

public final ListIterator<INoSumCell> listIterator()

remove

public final void remove(ListIterator<INoSumCell> iter,
                         int item)

pack

public final void pack(ListIterator<INoSumCell> iter,
                       int item)

undoRemove

public final void undoRemove(ListIterator<INoSumCell> iter,
                             int item)

packRemoved

public final void packRemoved(int item)

noSum

public boolean noSum(int alpha,
                     int beta)
No sum indicates the existence of a subset of candidate items which has a load between the parameters.
This function can return false negative.

Parameters:
alpha - the minimum load expected
beta - the maximum load expected
Returns:
true if it do not exist a subset of candidate items which has a load between alpha and beta.


Copyright © 2012. All Rights Reserved.