Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the possibility to specify the seed for LNS Neighbor based on a Random Java Object #633

Closed
wants to merge 8 commits into from
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,17 @@ public static INeighbor blackBox(IntVar... vars) {
* @return a random neighborhood fixing variables randomly
*/
public static IntNeighbor random(IntVar... vars) {
return new RandomNeighborhood(vars, 3, 0);
return random(0, vars);
}

/**
* Create a random neighborhood fixing variables randomly
* @param seed the seed for randomness
* @param vars the pool of variables to be freezed
* @return a random neighborhood fixing variables randomly
*/
public static IntNeighbor random(long seed, IntVar... vars) {
return new RandomNeighborhood(vars, 3, seed);
}

/**
Expand All @@ -48,7 +58,18 @@ public static IntNeighbor random(IntVar... vars) {
* @return a propagation-guided neighborhood
*/
public static IntNeighbor propagationGuided(IntVar... vars) {
return new PropagationGuidedNeighborhood(vars, 30, 10, 0);
return propagationGuided(0, vars);
}

/**
* Create a propagation guided neighborhood fixing variables based on constraint propagation
* Based on "Propagation-Guided LNS", Perronn Shaw and Furnon, CP2004
* @param seed the seed for randomness
* @param vars the pool of variables to be freezed
* @return a propagation-guided neighborhood
*/
public static IntNeighbor propagationGuided(long seed, IntVar... vars) {
return new PropagationGuidedNeighborhood(vars, 30, 10, seed);
}

/**
Expand All @@ -57,7 +78,17 @@ public static IntNeighbor propagationGuided(IntVar... vars) {
* @return a reverse propagation-guided neighborhood
*/
public static IntNeighbor reversedPropagationGuided(IntVar... vars) {
return new ReversePropagationGuidedNeighborhood(vars, 0, 30, 10);
return reversedPropagationGuided(10, vars);
}

/**
* Create a reverse propagation guided neighborhood fixing variables based on constraint propagation
* @param seed the seed for randomness
* @param vars the pool of variables to be freezed
* @return a reverse propagation-guided neighborhood
*/
public static IntNeighbor reversedPropagationGuided(long seed, IntVar... vars) {
return new ReversePropagationGuidedNeighborhood(vars, 0, 30, seed);
}

/**
Expand Down