Package org.jacop.examples.set
Class ExampleSet
java.lang.Object
org.jacop.examples.set.ExampleSet
- Direct Known Subclasses:
Gardner
,SocialGolfer
,Steiner
It is an abstract class to describe all necessary functions of any store.
- Version:
- 4.8
-
Field Summary
FieldsModifier and TypeFieldDescriptionIt specifies the cost function, null if no cost function is used.It specifies the search procedure used by a given example.It specifies the constraint store responsible for holding information about constraints and variables.It contains all variables used within a specific example. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionIt returns the search used within an example.It returns an array list of variables used to model the example.getStore()
It specifies the constraint store used within an example.abstract void
model()
It specifies a standard way of modeling the problem.static void
printMatrix
(IntVar[][] matrix, int rows, int cols) It prints a matrix of variables.boolean
search()
It specifies simple search method based on input order and lexigraphical ordering of values.boolean
It specifies simple search method based on most constrained static and lexigraphical ordering of values.boolean
It searches for all solutions with the optimal value.boolean
searchMasterSlave
(List<Var> masterVars, List<Var> slaveVars) It conducts master-slave search.boolean
It specifies simple search method based variable order which takes into account the number of constraints attached to a variable and lexigraphical ordering of values.boolean
It specifies simple search method based on input order and lexigraphical ordering of values.boolean
searchSmallestDomain
(boolean optimal) It specifies simple search method based on smallest domain variable order and lexigraphical ordering of values.boolean
It specifies simple search method based on weighted degree variable order and lexigraphical ordering of values.
-
Field Details
-
vars
It contains all variables used within a specific example. -
cost
It specifies the cost function, null if no cost function is used. -
store
It specifies the constraint store responsible for holding information about constraints and variables. -
search
It specifies the search procedure used by a given example.
-
-
Constructor Details
-
ExampleSet
public ExampleSet()
-
-
Method Details
-
model
public abstract void model()It specifies a standard way of modeling the problem. -
search
public boolean search()It specifies simple search method based on input order and lexigraphical ordering of values.- Returns:
- true if there is a solution, false otherwise.
-
searchOptimal
public boolean searchOptimal()It specifies simple search method based on input order and lexigraphical ordering of values. It optimizes the solution by minimizing the cost function.- Returns:
- true if there is a solution, false otherwise.
-
searchAllOptimal
public boolean searchAllOptimal()It searches for all solutions with the optimal value.- Returns:
- true if any optimal solution has been found.
-
searchSmallestDomain
public boolean searchSmallestDomain(boolean optimal) It specifies simple search method based on smallest domain variable order and lexigraphical ordering of values.- Parameters:
optimal
- it specifies if the search the optimal solution takes place.- Returns:
- true if there is a solution, false otherwise.
-
searchWeightedDegree
public boolean searchWeightedDegree()It specifies simple search method based on weighted degree variable order and lexigraphical ordering of values. This search method is rather general any problem good fit. It can be a good first trial to see if the model is correct.- Returns:
- true if there is a solution, false otherwise.
-
searchMostConstrainedStatic
public boolean searchMostConstrainedStatic()It specifies simple search method based variable order which takes into account the number of constraints attached to a variable and lexigraphical ordering of values.- Returns:
- true if there is a solution, false otherwise.
-
searchAllAtOnce
public boolean searchAllAtOnce()It specifies simple search method based on most constrained static and lexigraphical ordering of values. It searches for all solutions.- Returns:
- true if there is a solution, false otherwise.
-
searchMasterSlave
It conducts master-slave search. Both of them use input order variable ordering.- Parameters:
masterVars
- it specifies the search variables used in master search.slaveVars
- it specifies the search variables used in slave search.- Returns:
- true if the solution exists, false otherwise.
-
getSearch
It returns the search used within an example.- Returns:
- the search used within an example.
-
getStore
It specifies the constraint store used within an example.- Returns:
- constraint store used within an example.
-
getSearchVariables
It returns an array list of variables used to model the example.- Returns:
- the array list of variables used to model the example.
-
printMatrix
It prints a matrix of variables. All variables must be grounded.- Parameters:
matrix
- matrix containing the grounded variables.rows
- number of elements in the first dimension.cols
- number of elements in the second dimension.
-