choco.cp.solver.search.integer.varselector.ratioselector
Class AbstractIntVarRatioSelector

java.lang.Object
  extended by choco.kernel.solver.search.AbstractSearchHeuristic
      extended by choco.cp.solver.search.integer.varselector.ratioselector.AbstractIntVarRatioSelector
All Implemented Interfaces:
IntVarRatioSelector, VarSelector<IntDomainVar>, TiedIntVarSelector
Direct Known Subclasses:
MaxRatioSelector, MinRatioSelector, RandMaxRatioSelector, RandMinRatioSelector

public abstract class AbstractIntVarRatioSelector
extends AbstractSearchHeuristic
implements IntVarRatioSelector

A class that select the min/max ratio (a/b) among an arrays. the for-loop of search stores the index of the first not instantiated variable. Two ratios are compared by the formula a1 * b2 <=/>= a2 * b1 (note cast to long avoids integer overflow )

Since:
26 mars 2010 version 2.1.1
Version:
2.1.1
Author:
Arnaud Malapert

Field Summary
protected  IntRatio[] ratios
           
 
Fields inherited from class choco.kernel.solver.search.AbstractSearchHeuristic
branching, solver
 
Fields inherited from interface choco.cp.solver.search.integer.varselector.ratioselector.IntVarRatioSelector
NULL
 
Constructor Summary
AbstractIntVarRatioSelector(Solver solver, IntRatio[] ratios)
           
 
Method Summary
 IntRatio[] getRatios()
           
protected abstract  boolean isUp(long leftM, long rightM)
           
 IntRatio selectIntRatio()
           
 int selectIntRatioIndex()
           
protected  int selectRandIntRatioIndex(Random randomBreakTies, gnu.trove.TIntArrayList canWriteList)
           
 List<IntDomainVar> selectTiedIntVars()
           
 IntDomainVar selectVar()
          the VarSelector can be asked to return a variable
 
Methods inherited from class choco.kernel.solver.search.AbstractSearchHeuristic
getBranching, getSolver, setBranching
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ratios

protected final IntRatio[] ratios
Constructor Detail

AbstractIntVarRatioSelector

public AbstractIntVarRatioSelector(Solver solver,
                                   IntRatio[] ratios)
Method Detail

getRatios

public final IntRatio[] getRatios()
Specified by:
getRatios in interface IntVarRatioSelector

isUp

protected abstract boolean isUp(long leftM,
                                long rightM)

selectRandIntRatioIndex

protected final int selectRandIntRatioIndex(Random randomBreakTies,
                                            gnu.trove.TIntArrayList canWriteList)

selectIntRatioIndex

public int selectIntRatioIndex()
Specified by:
selectIntRatioIndex in interface IntVarRatioSelector

selectIntRatio

public final IntRatio selectIntRatio()
Specified by:
selectIntRatio in interface IntVarRatioSelector

selectVar

public final IntDomainVar selectVar()
Description copied from interface: VarSelector
the VarSelector can be asked to return a variable

Specified by:
selectVar in interface VarSelector<IntDomainVar>
Returns:
a variable on whose domain an alternative can be set (such as a non instantiated search variable)

selectTiedIntVars

public final List<IntDomainVar> selectTiedIntVars()
Specified by:
selectTiedIntVars in interface TiedIntVarSelector


Copyright © 2012. All Rights Reserved.