V - VariableT - Valuepublic class RandomSwapMove<V extends Variable<V,T>,T extends Value<V,T>> extends Object implements NeighbourSelection<V,T>, HillClimberSelection
| Modifier and Type | Class and Description |
|---|---|
class |
RandomSwapMove.SwapNeighbour |
| Modifier and Type | Field and Description |
|---|---|
protected boolean |
iHC |
protected int |
iMaxAttempts |
protected int |
iTimeLimit |
| Constructor and Description |
|---|
RandomSwapMove(DataProperties config) |
| Modifier and Type | Method and Description |
|---|---|
void |
init(Solver<V,T> solver)
Criterion initialization
|
protected boolean |
isTimeLimitReached(long startTime)
Return true if the time limit was reached, number of attempts are limited to 1 in such a case.
|
protected Double |
resolve(Solution<V,T> solution,
double total,
long startTime,
Map<V,T> assignments,
List<T> conflicts,
int index)
Try to resolve given conflicts.
|
Neighbour<V,T> |
selectNeighbour(Solution<V,T> solution)
select a neighbour of a given solution
|
void |
setHcMode(boolean hcMode)
True if employed by a hill climber, e.g., worsening moves may be skipped.
|
protected int iMaxAttempts
protected boolean iHC
protected int iTimeLimit
public RandomSwapMove(DataProperties config)
public void setHcMode(boolean hcMode)
HillClimberSelectionsetHcMode in interface HillClimberSelectionhcMode - true if used by a hill climber (worsening moves are automatically discarded)public void init(Solver<V,T> solver)
NeighbourSelectionpublic Neighbour<V,T> selectNeighbour(Solution<V,T> solution)
NeighbourSelectionselectNeighbour in interface NeighbourSelection<V extends Variable<V,T>,T extends Value<V,T>>solution - given solutionprotected boolean isTimeLimitReached(long startTime)
startTime - start timeprotected Double resolve(Solution<V,T> solution, double total, long startTime, Map<V,T> assignments, List<T> conflicts, int index)
solution - current solutiontotal - original value of the current solutionstartTime - starting timeassignments - re-assignments to be madeconflicts - list of conflicts to resolveindex - index in the list of conflicts