Class RandomVar<T extends Variable>
- java.lang.Object
-
- org.chocosolver.solver.search.strategy.selectors.variables.RandomVar<T>
-
- All Implemented Interfaces:
VariableEvaluator<T>
,VariableSelector<T>
public class RandomVar<T extends Variable> extends Object implements VariableSelector<T>, VariableEvaluator<T>
Random variable selector & evaluator to be used with fast restart strategy- Since:
- 06/04/2019.
- Author:
- Jean-Guillaume FAGES (cosling)
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description double
evaluate(T variable)
Evaluates the heuristic that is minimized in order to find the best variableT
getVariable(T[] variables)
Provides access to the current selected variable amongvariables
.
-
-
-
Constructor Detail
-
RandomVar
public RandomVar(long seed, IntVar[] scope)
Random variable selector & evaluator more efficient with fast restart- Parameters:
seed
- seed for random number generator.scope
- variables to branch on, must not be empty
-
-
Method Detail
-
getVariable
public T getVariable(T[] variables)
Description copied from interface:VariableSelector
Provides access to the current selected variable amongvariables
. If there is no variable left, returnnull
.- Specified by:
getVariable
in interfaceVariableSelector<T extends Variable>
- Returns:
- the current selected variable if any,
null
otherwise.
-
evaluate
public double evaluate(T variable)
Description copied from interface:VariableEvaluator
Evaluates the heuristic that is minimized in order to find the best variable- Specified by:
evaluate
in interfaceVariableEvaluator<T extends Variable>
- Parameters:
variable
- array of variable- Returns:
- the result of the evaluation, to minimize
-
-