Package org.jacop.examples.set
Class ExampleSet
- java.lang.Object
-
- org.jacop.examples.set.ExampleSet
-
- Direct Known Subclasses:
Gardner
,SocialGolfer
,Steiner
public abstract class ExampleSet extends java.lang.Object
It is an abstract class to describe all necessary functions of any store.- Version:
- 4.7
-
-
Field Summary
Fields Modifier and Type Field Description IntVar
cost
It specifies the cost function, null if no cost function is used.Search<SetVar>
search
It specifies the search procedure used by a given example.Store
store
It specifies the constraint store responsible for holding information about constraints and variables.java.util.List<SetVar>
vars
It contains all variables used within a specific example.
-
Constructor Summary
Constructors Constructor Description ExampleSet()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description Search<SetVar>
getSearch()
It returns the search used within an example.java.util.List<SetVar>
getSearchVariables()
It returns an array list of variables used to model the example.Store
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
searchAllAtOnce()
It specifies simple search method based on most constrained static and lexigraphical ordering of values.boolean
searchAllOptimal()
It searches for all solutions with the optimal value.boolean
searchMasterSlave(java.util.List<Var> masterVars, java.util.List<Var> slaveVars)
It conducts master-slave search.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.boolean
searchOptimal()
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
searchWeightedDegree()
It specifies simple search method based on weighted degree variable order and lexigraphical ordering of values.
-
-
-
Field Detail
-
vars
public java.util.List<SetVar> vars
It contains all variables used within a specific example.
-
cost
public IntVar cost
It specifies the cost function, null if no cost function is used.
-
store
public Store store
It specifies the constraint store responsible for holding information about constraints and variables.
-
-
Method Detail
-
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
public boolean searchMasterSlave(java.util.List<Var> masterVars, java.util.List<Var> slaveVars)
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
public Search<SetVar> getSearch()
It returns the search used within an example.- Returns:
- the search used within an example.
-
getStore
public Store getStore()
It specifies the constraint store used within an example.- Returns:
- constraint store used within an example.
-
getSearchVariables
public java.util.List<SetVar> 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
public static void printMatrix(IntVar[][] matrix, int rows, int cols)
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.
-
-