jopt.csp.search
Interface SearchActions


public interface SearchActions

Interface for a class that returns common search actions that can be used to locate solutions to a CSP problem


Method Summary
 SearchAction addConstraint(CspConstraint constraint)
          Adds a constraint during a search that can be undone as the search routine backtracks
 SearchAction choice(SearchAction[] actions)
          Creates a choice point between an array of actions
 SearchAction choice(SearchAction action1, SearchAction action2)
          Creates a choice point between two different actions
 SearchAction combine(SearchAction[] actions)
          Creates a new combined action
 SearchAction combine(SearchAction action1, SearchAction action2)
          Creates a new combined action
 SearchAction combine(SearchAction action1, SearchAction action2, SearchAction action3)
          Creates a new combined action
 SearchAction generate(CspDoubleVariable[] vars, double precision)
          Creates an action that will instantiate an array of variables in order.
 SearchAction generate(CspDoubleVariable[] vars, double precision, boolean minFirst)
          Creates an action that will instantiate an array of variables in order.
 SearchAction generate(CspFloatVariable[] vars, float precision)
          Creates an action that will instantiate an array of variables in order.
 SearchAction generate(CspFloatVariable[] vars, float precision, boolean minFirst)
          Creates an action that will instantiate an array of variables in order.
 SearchAction generate(CspIntVariable[] vars)
          Creates an action that will instantiate an array of variables in order.
 SearchAction generate(CspIntVariable[] vars, IntegerSelector selector)
          Creates an action that will instantiate an array of variables in order.
 SearchAction generate(CspLongVariable[] vars)
          Creates an action that will instantiate an array of variables in order.
 SearchAction generate(CspLongVariable[] vars, LongSelector selector)
          Creates an action that will instantiate an array of variables in order.
 SearchAction generate(CspSetVariable[] vars)
          Creates an action that will instantiate an array of variables in order.
 SearchAction generate(CspSetVariable[] vars, SetSelector selector)
          Creates an action that will instantiate an array of variables in order.
 SearchAction generateNonBinary(CspIntVariable[] vars)
          Creates an action that will instantiate an array of variables in order.
 SearchAction restoreSolution(SolverSolution solution)
          Action that will push all current changes onto the stack and restore another solution.
 SearchAction splitGenerate(CspIntVariable[] vars)
          Creates an action that will instantiate an array of variables in order.
 SearchAction splitGenerate(CspIntVariable[] vars, boolean minFirst)
          Creates an action that will instantiate an array of variables in order.
 SearchAction splitGenerate(CspLongVariable[] vars)
          Creates an action that will instantiate an array of variables in order.
 SearchAction splitGenerate(CspLongVariable[] vars, boolean minFirst)
          Creates an action that will instantiate an array of variables in order.
 SearchAction storeSolution(SolverSolution solution)
          Creates an action that will store all information for the current problem state in a solution that can be restored at a later date.
 

Method Detail

generate

public SearchAction generate(CspIntVariable[] vars)
Creates an action that will instantiate an array of variables in order. The generator will instantiate each variable by creating binary choice points for the search tree to traverse. At each point, the choice will be either to assign an available value to the variable or remove the value and look for another value to assign.

Parameters:
vars - Array of variables to instantiate

generate

public SearchAction generate(CspIntVariable[] vars,
                             IntegerSelector selector)
Creates an action that will instantiate an array of variables in order. The generator will instantiate each variable by creating binary choice points for the search tree to traverse. At each point, the choice will be either to assign an available value to the variable or remove the value and look for another value to assign. A selector method will be used to determine which value of the remaining values in the domain should be assigned to a variable at the next choice point in the search tree.

Parameters:
vars - Array of variables to instantiate
selector - Used to select next value to reduce domain of variable

generate

public SearchAction generate(CspLongVariable[] vars)
Creates an action that will instantiate an array of variables in order. The generator will instantiate each variable by creating binary choice points for the search tree to traverse. At each point, the choice will be either to assign an available value to the variable or remove the value and look for another value to assign.

Parameters:
vars - Array of variables to instantiate

generate

public SearchAction generate(CspLongVariable[] vars,
                             LongSelector selector)
Creates an action that will instantiate an array of variables in order. The generator will instantiate each variable by creating binary choice points for the search tree to traverse. At each point, the choice will be either to assign an available value to the variable or remove the value and look for another value to assign. A selector method will be used to determine which value of the remaining values in the domain should be assigned to a variable at the next choice point in the search tree.

Parameters:
vars - Array of variables to instantiate
selector - Used to select next value to reduce domain of variable

generate

public SearchAction generate(CspFloatVariable[] vars,
                             float precision)
Creates an action that will instantiate an array of variables in order. The generator will instantiate each variable by creating binary choice points for the search tree to traverse. At each point, the choice will reduce each variable by removing either the upper or lower half of values within the domain of the variable. Since real numbers can be divided an infinite number of times, a precision value must be specified to indicate when the range of the variable is small enough to consider the variable completely instantiated.

Parameters:
vars - Array of variables to instantiate
precision - Minimum precision to which variable domain will be reduced

generate

public SearchAction generate(CspFloatVariable[] vars,
                             float precision,
                             boolean minFirst)
Creates an action that will instantiate an array of variables in order. The generator will instantiate each variable by creating binary choice points for the search tree to traverse. At each point, the choice will reduce each variable by removing either the upper or lower half of values within the domain of the variable. Since real numbers can be divided an infinite number of times, a precision value must be specified to indicate when the range of the variable is small enough to consider the variable completely instantiated.

Parameters:
vars - Array of variables to instantiate
precision - Minimum precision to which variable domain will be reduced
minFirst - True if bottom half of domain should be used to restrict domain first, false to use upper half

generate

public SearchAction generate(CspDoubleVariable[] vars,
                             double precision)
Creates an action that will instantiate an array of variables in order. The generator will instantiate each variable by creating binary choice points for the search tree to traverse. At each point, the choice will reduce each variable by removing either the upper or lower half of values within the domain of the variable. Since real numbers can be divided an infinite number of times, a precision value must be specified to indicate when the range of the variable is small enough to consider the variable completely instantiated.

Parameters:
vars - Array of variables to instantiate
precision - Minimum precision to which variable domain will be reduced

generate

public SearchAction generate(CspDoubleVariable[] vars,
                             double precision,
                             boolean minFirst)
Creates an action that will instantiate an array of variables in order. The generator will instantiate each variable by creating binary choice points for the search tree to traverse. At each point, the choice will reduce each variable by removing either the upper or lower half of values within the domain of the variable. Since real numbers can be divided an infinite number of times, a precision value must be specified to indicate when the range of the variable is small enough to consider the variable completely instantiated.

Parameters:
vars - Array of variables to instantiate
precision - Minimum precision to which variable domain will be reduced
minFirst - True if bottom half of domain should be used to restrict domain first, false to use upper half

generateNonBinary

public SearchAction generateNonBinary(CspIntVariable[] vars)
Creates an action that will instantiate an array of variables in order. The generator will instantiate each variable by creating a choice point for each variable with one child for each possible value. Each child will attempt to assign a single value to the variable. This differs from standard generation by creating a tree that may have more than two child nodes at a choice point. This could have performance implications that should be considered when choosing between the two operations.

Parameters:
vars - Array of variables to instantiate

splitGenerate

public SearchAction splitGenerate(CspIntVariable[] vars)
Creates an action that will instantiate an array of variables in order. The generator will instantiate each variable by creating binary choice points for the search tree to traverse. At each point, the choice will reduce each variable by removing either the upper or lower half of values within the domain of the variable. This generation technique is similar to the way in which float and double variables are generated, but the variable will be reduced to a single value rather than a range of values within a precision value.

Parameters:
vars - Array of variables to instantiate

splitGenerate

public SearchAction splitGenerate(CspIntVariable[] vars,
                                  boolean minFirst)
Creates an action that will instantiate an array of variables in order. The generator will instantiate each variable by creating binary choice points for the search tree to traverse. At each point, the choice will reduce each variable by removing either the upper or lower half of values within the domain of the variable. This generation technique is similar to the way in which float and double variables are generated, but the variable will be reduced to a single value rather than a range of values within a precision value.

Parameters:
vars - Array of variables to instantiate
minFirst - True if bottom half of domain should be used to restrict domain first, false to use upper half

splitGenerate

public SearchAction splitGenerate(CspLongVariable[] vars)
Creates an action that will instantiate an array of variables in order. The generator will instantiate each variable by creating binary choice points for the search tree to traverse. At each point, the choice will reduce each variable by removing either the upper or lower half of values within the domain of the variable. This generation technique is similar to the way in which float and double variables are generated, but the variable will be reduced to a single value rather than a range of values within a precision value.

Parameters:
vars - Array of variables to instantiate

splitGenerate

public SearchAction splitGenerate(CspLongVariable[] vars,
                                  boolean minFirst)
Creates an action that will instantiate an array of variables in order. The generator will instantiate each variable by creating binary choice points for the search tree to traverse. At each point, the choice will reduce each variable by removing either the upper or lower half of values within the domain of the variable. This generation technique is similar to the way in which float and double variables are generated, but the variable will be reduced to a single value rather than a range of values within a precision value.

Parameters:
vars - Array of variables to instantiate
minFirst - True if bottom half of domain should be used to restrict domain first, false to use upper half

generate

public SearchAction generate(CspSetVariable[] vars)
Creates an action that will instantiate an array of variables in order. The generator will instantiate each variable by creating binary choice points for the search tree to traverse. At each point, the choice will be either to assign an available value to the variable or remove the value and look for another value to assign.

Parameters:
vars - Array of variables to instantiate

generate

public SearchAction generate(CspSetVariable[] vars,
                             SetSelector selector)
Creates an action that will instantiate an array of variables in order. The generator will instantiate each variable by creating binary choice points for the search tree to traverse. At each point, the choice will be either to assign an available value to the variable or remove the value and look for another value to assign. A selector method will be used to determine which value of the remaining values in the domain should be assigned to a variable at the next choice point in the search tree.

Parameters:
vars - Array of variables to instantiate
selector - Used to select next value to reduce domain of variable

storeSolution

public SearchAction storeSolution(SolverSolution solution)
Creates an action that will store all information for the current problem state in a solution that can be restored at a later date.

Parameters:
solution - Solution to store information in

restoreSolution

public SearchAction restoreSolution(SolverSolution solution)
Action that will push all current changes onto the stack and restore another solution. This action can then be undone to return to other choices in the search tree. This is useful when trying to manipulate an existing solution and determining if it is valid.

Parameters:
solution - Solution to restore from

addConstraint

public SearchAction addConstraint(CspConstraint constraint)
Adds a constraint during a search that can be undone as the search routine backtracks


choice

public SearchAction choice(SearchAction action1,
                           SearchAction action2)
Creates a choice point between two different actions

Parameters:
action1 - First choice
action2 - Second choice

choice

public SearchAction choice(SearchAction[] actions)
Creates a choice point between an array of actions

Parameters:
actions - Array of actions that should be separated into individual search nodes

combine

public SearchAction combine(SearchAction action1,
                            SearchAction action2)
Creates a new combined action

Parameters:
action1 - First action to perform
action2 - Second action to perform

combine

public SearchAction combine(SearchAction action1,
                            SearchAction action2,
                            SearchAction action3)
Creates a new combined action

Parameters:
action1 - First action to perform
action2 - Second action to perform
action3 - Third action to perform

combine

public SearchAction combine(SearchAction[] actions)
Creates a new combined action

Parameters:
actions - Collection of actions that should be combined into one actions