Package org.jacop.examples.fd
Class ExampleFD
java.lang.Object
org.jacop.examples.fd.ExampleFD
- Direct Known Subclasses:
ArchFriends
,BabySitting
,BasicLogicPascal
,BIBD
,BlueberryMuffins
,BreakingNews
,BuildingBlocks
,CalendarMen
,CarSequencing
,Conference
,CrossWord
,Cryptogram
,DeBruijn
,Diet
,DollarAndTicket
,DonaldGeraldRobert
,Exodus
,FittingNumbers
,Flowers
,FourIslands
,FurnitureMoving
,Gates
,GeostExample
,Golf
,Golomb
,HistoricHomes
,Kakro
,KnapsackExample
,Langford
,LatinSquare
,LeastDiff
,LectureSeries
,MagicSquares
,MasterClass
,MineSweeper
,MUCA
,Newspaper
,Nonogram
,NonTransitiveDice
,Parcel
,PerfectSquare
,PigeonHole
,ProAndCon
,QCP
,Queens
,SendMoreMoney
,SiblingUproar
,SleepingArrangements
,StonesOfHeaven
,Sudoku
,SurvoPuzzle
,TSP
,Tunapalooza
,WhoKilledAgatha
,WolfGoatCabbage
,Zebra
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 TypeMethodDescriptionboolean
creditSearch
(int credits, int backtracks, int maxDepth) It uses credit search to solve a problem.It 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
searchLDS
(int noDiscrepancy) It searches for solution using Limited Discrepancy Search.boolean
searchMasterSlave
(List<Var> masterVars, List<Var> slaveVars) It conducts master-slave search.boolean
It searches for optimal solution using max regret variable ordering and indomain min for value ordering.boolean
It searches using an input order search with indomain based on middle value.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 searches using smallest domain variable ordering and indomain middle value ordering.boolean
It searches using smallest domain variable ordering and indomain middle value ordering.boolean
It searches using Smallest Min variable ordering heuristic and indomainMin value ordering heuristic.boolean
It specifies simple search method based on weighted degree variable order and lexigraphical ordering of values.boolean
It uses MaxRegret variable ordering heuristic to search for a solution.boolean
It conducts the search with restarts from which the no-goods are derived.boolean
shavingSearch
(List<Constraint> guidingShaving, boolean printInfo) It searches with shaving which is guided by supplied constraints.
-
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
-
ExampleFD
public ExampleFD()
-
-
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.
-
searchMiddle
public boolean searchMiddle()It searches using an input order search with indomain based on middle value.- Returns:
- true if there is a solution, false otherwise.
-
shavingSearch
It searches with shaving which is guided by supplied constraints.- Parameters:
guidingShaving
- the array of constraints proposing shaving candidates.printInfo
- it specifies if that function should print any info.- Returns:
- true if the solution was found, false otherwise.
-
searchWithRestarts
public boolean searchWithRestarts()It conducts the search with restarts from which the no-goods are derived. Every search contributes with new no-goods which are kept so eventually the search is complete (although can be very expensive to maintain explicitly all no-goods found during search).- Returns:
- true if there is a solution, false otherwise.
-
creditSearch
public boolean creditSearch(int credits, int backtracks, int maxDepth) It uses credit search to solve a problem.- Parameters:
credits
- the number of credits available.backtracks
- the maximum number of backtracks used when a path exhausts its credits.maxDepth
- the maximum depth to which the credit distribution takes place.- Returns:
- true if a solution was found, false otherwise.
-
searchWithMaxRegret
public boolean searchWithMaxRegret()It uses MaxRegret variable ordering heuristic to search for a solution.- Returns:
- true if there is a solution, false otherwise.
-
searchLDS
public boolean searchLDS(int noDiscrepancy) It searches for solution using Limited Discrepancy Search.- Parameters:
noDiscrepancy
- maximal number of discrepancies- Returns:
- true if the solution was found, false otherwise.
-
searchMaxRegretOptimal
public boolean searchMaxRegretOptimal()It searches for optimal solution using max regret variable ordering and indomain min for value ordering.- Returns:
- true if there is a solution, false otherwise.
-
searchSmallestMiddle
public boolean searchSmallestMiddle()It searches using smallest domain variable ordering and indomain middle value ordering.- Returns:
- true if there is a solution, false otherwise.
-
searchSmallestMedian
public boolean searchSmallestMedian()It searches using smallest domain variable ordering and indomain middle value ordering.- Returns:
- true if there is a solution, false otherwise.
-
searchSmallestMin
public boolean searchSmallestMin()It searches using Smallest Min variable ordering heuristic and indomainMin value ordering heuristic.- 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.
-