|
FRODO Version 2.19.1
An open-source framework for Distributed Constraint Optimization (DCOP)
|
A solution iterator for JaCoPutilSpace that runs a JaCoP search in an extra thread. More...

Protected Member Functions | |
| void | finalize () throws Throwable |
Protected Attributes | |
| JaCoPutilSpace< V > | space |
| The JaCoPutilSpace we are iterating over. | |
| V | valuation |
| Current valuation. | |
| AddableInteger[] | assignments |
| Current variable assignments. | |
| String[] | variables |
| The order of iteration over the variables. | |
| int | nbrVars |
| The number of variables. | |
| AddableInteger[][] | domains |
| The variables' domains. | |
Private Member Functions | |
| void | getNextFromSearch (final boolean first) |
| The transaction between the current thread and the search thread. | |
| void | terminateSearch () |
| As long as the search has not ended its thread is kept alive. | |
| void | initSearch (final V strictBound) |
| This method starts the search thread. | |
Private Attributes | |
| V | strictBound |
| Any solution returned by this iterator has to be strictly better than this bound. | |
| final boolean | maximize |
| Whether to maximize utility or minimize cost. | |
| StoreCloneable | store |
| The JaCoP Store. | |
| JaCoPiterSearch< V > | search |
| The JaCoPSearch object that wraps the JaCoP search. | |
| Thread | searchThread |
| The thread that carries out the JaCoP search. | |
| boolean | searchTerminated = false |
| Whether the search has already finished going through all solutions. | |
| boolean | searchInitiated |
If true, the JaCoP search has already been initiated. | |
| final Lock | lock = new ReentrantLock() |
| The lock used to ensure that only a single thread is running at a time. | |
| final Condition | nextAsked = lock.newCondition() |
| The condition used to signal the search to continue until a next solution is found. | |
| final Condition | nextDelivered = lock.newCondition() |
| The condition used to signal this thread that a new solution has been found and has been delivered. | |
| final V | infeasibleValuation |
| The infeasible valuation. | |
A solution iterator for JaCoPutilSpace that runs a JaCoP search in an extra thread.
This iterator uses less space as all the solutions are not temporarily stored but are computed one by one by pausing the JaCoP search. Additionally, the variables whose projection has been requested are projected in an optimization search that is performed on top of the first search in the same way as a master/slave search combination.
| <V> | the type used for valuations |
| frodo2.solutionSpaces.JaCoP.JaCoPutilSpaceIter2< V extends Addable< V > >.JaCoPutilSpaceIter2 | ( | JaCoPutilSpace< V > | space, |
| String[] | variables, | ||
| AddableInteger | domains[][] ) |
|
protected |
References finalize(), and terminateSearch().
Referenced by finalize().

| AddableInteger[] frodo2.solutionSpaces.JaCoP.JaCoPutilSpaceIter2< V extends Addable< V > >.getCurrentSolution | ( | ) |
| V frodo2.solutionSpaces.JaCoP.JaCoPutilSpaceIter2< V extends Addable< V > >.getCurrentUtility | ( | ) |
| V frodo2.solutionSpaces.JaCoP.JaCoPutilSpaceIter2< V extends Addable< V > >.getCurrentUtility | ( | V | bound, |
| boolean | minimize ) |
| AddableInteger[][] frodo2.solutionSpaces.JaCoP.JaCoPutilSpaceIter2< V extends Addable< V > >.getDomains | ( | ) |
|
private |
The transaction between the current thread and the search thread.
The control is given to the search thread that will search for the next solution. When the next solution is found, the search records it in its fields and gives back the control to the current thread. Finally, we get the next solution and its valuation using the corresponding getter of the search.
| first | whether the search thread must be created and started |
References assignments, frodo2.solutionSpaces.JaCoP.JaCoPutilSpace< V extends Addable< V > >.defaultValuation, lock, nextAsked, nextDelivered, search, searchInitiated, and terminateSearch().
Referenced by initSearch(), nextSolution(), nextUtility(), and nextUtility().

| String[] frodo2.solutionSpaces.JaCoP.JaCoPutilSpaceIter2< V extends Addable< V > >.getVariablesOrder | ( | ) |
|
private |
This method starts the search thread.
| strictBound | the initial strict valuation bound, null if we do not want to set one |
References getNextFromSearch(), frodo2.solutionSpaces.JaCoP.JaCoPutilSpace< V extends Addable< V > >.imposeConstraints(), frodo2.solutionSpaces.JaCoP.JaCoPutilSpace< V extends Addable< V > >.initStore(), frodo2.solutionSpaces.JaCoP.JaCoPutilSpace< V extends Addable< V > >.isConsistent, lock, nbrVars, nextAsked, nextDelivered, space, store, strictBound, and terminateSearch().
Referenced by nextSolution(), nextUtility(), and nextUtility().

| AddableInteger[] frodo2.solutionSpaces.JaCoP.JaCoPutilSpaceIter2< V extends Addable< V > >.nextSolution | ( | ) |
Implements frodo2.solutionSpaces.SolutionSpace< V extends Addable< V > >.SparseIterator< V >.
References getNextFromSearch(), and initSearch().

| V frodo2.solutionSpaces.JaCoP.JaCoPutilSpaceIter2< V extends Addable< V > >.nextUtility | ( | ) |
References getNextFromSearch(), and initSearch().

| V frodo2.solutionSpaces.JaCoP.JaCoPutilSpaceIter2< V extends Addable< V > >.nextUtility | ( | V | bound, |
| boolean | minimize ) |
References frodo2.solutionSpaces.JaCoP.JaCoPutilSpace< V extends Addable< V > >.defaultValuation, getNextFromSearch(), initSearch(), maximize, frodo2.solutionSpaces.JaCoP.JaCoPiterSearch< V extends Addable< V > >.setNewBound(), and strictBound.

| void frodo2.solutionSpaces.JaCoP.JaCoPutilSpaceIter2< V extends Addable< V > >.setCurrentUtility | ( | V | valuation | ) |
References valuation.
|
private |
As long as the search has not ended its thread is kept alive.
We might want to kill this thread if we do not need any longer the iterator. This method can be used for that purpose.
References searchThread.
Referenced by finalize(), getNextFromSearch(), and initSearch().
| String frodo2.solutionSpaces.JaCoP.JaCoPutilSpaceIter2< V extends Addable< V > >.toString | ( | ) |
| void frodo2.solutionSpaces.JaCoP.JaCoPutilSpaceIter2< V extends Addable< V > >.update | ( | ) |
Implements frodo2.solutionSpaces.SolutionSpace< V extends Addable< V > >.SparseIterator< V >.
|
protected |
Current variable assignments.
Referenced by getNextFromSearch().
|
protected |
The variables' domains.
Referenced by JaCoPutilSpaceIter2().
|
private |
The infeasible valuation.
|
private |
The lock used to ensure that only a single thread is running at a time.
Referenced by getNextFromSearch(), and initSearch().
|
private |
Whether to maximize utility or minimize cost.
Referenced by nextUtility().
|
protected |
The number of variables.
Referenced by initSearch().
|
private |
The condition used to signal the search to continue until a next solution is found.
Referenced by getNextFromSearch(), and initSearch().
|
private |
The condition used to signal this thread that a new solution has been found and has been delivered.
Referenced by getNextFromSearch(), and initSearch().
|
private |
The JaCoPSearch object that wraps the JaCoP search.
Referenced by getNextFromSearch().
|
private |
If true, the JaCoP search has already been initiated.
Referenced by getNextFromSearch().
|
private |
Whether the search has already finished going through all solutions.
|
private |
The thread that carries out the JaCoP search.
Referenced by terminateSearch().
|
protected |
The JaCoPutilSpace we are iterating over.
Referenced by initSearch(), and JaCoPutilSpaceIter2().
|
private |
The JaCoP Store.
Referenced by initSearch().
|
private |
Any solution returned by this iterator has to be strictly better than this bound.
Referenced by initSearch(), and nextUtility().
|
protected |
Current valuation.
Referenced by setCurrentUtility().
|
protected |
The order of iteration over the variables.
Referenced by JaCoPutilSpaceIter2().