Skip to content
Permalink
Browse files

[bonsai][libstd] Update to Choco 4.10 and fix a bug in bounded search.

  • Loading branch information...
ptal committed Mar 1, 2019
1 parent fcf3f2b commit dbd1d4c45e822a39cc5ee45a70d5f0fdfb73a0f6
@@ -22,7 +22,7 @@
<dependency>
<groupId>org.choco-solver</groupId>
<artifactId>choco-solver</artifactId>
<version>4.0.0</version>
<version>4.10.0</version>
</dependency>
<dependency>
<groupId>bonsai</groupId>
@@ -30,8 +30,8 @@
private int trials = 10;
private int timeLimitSeconds = 1080;

private List<Integer> paramsNQueens = Arrays.asList(4,5,6,7,8,9,10,11,12,13,14);
private List<Integer> paramsGolombRuler = Arrays.asList(4,5,6,7,8,9,10,11,12,13,14);
private List<Integer> paramsNQueens = Arrays.asList(4,5,6,7,8,9,10);//,11,12,13,14);
private List<Integer> paramsGolombRuler = Arrays.asList(4,5,6,7,8,9);//,10,11,12,13,14);
private List<Integer> paramsLatinSquare = Arrays.asList(30,35,40,45,50,55,60,65,70,75,80);

public static void main(String[] args) {
@@ -42,7 +42,7 @@ private void start() {
Config.timeout = timeLimitSeconds;
System.out.println(Config.headerCSV());
benchNQueens();
benchLatinSquare();
// benchLatinSquare();
benchGolombRuler();
}

@@ -59,18 +59,18 @@ private void benchGolombRuler() {
for (Integer n : paramsGolombRuler) {
runBonsaiGolombRulerIOLB(n);
}
// for (Integer n : paramsGolombRuler) {
// runBonsaiGolombRulerFFM(n);
// }
for (Integer n : paramsGolombRuler) {
runBonsaiGolombRulerFFM(n);
}
// for (Integer n : paramsGolombRuler) {
// runBonsaiGolombRulerMDLB(n);
// }
for (Integer n : paramsGolombRuler) {
runChocoGolombRulerIOLB(n);
}
// for (Integer n : paramsGolombRuler) {
// runChocoGolombRulerFFM(n);
// }
for (Integer n : paramsGolombRuler) {
runChocoGolombRulerFFM(n);
}
}

private void benchLatinSquare() {
@@ -124,7 +124,7 @@ public void configureSearch(boolean isFFM) {
if (isFFM) {
model.getSolver().setSearch(Search.intVarSearch(new FirstFail(model),
new IntDomainMiddle(true),
DecisionOperator.int_split,
DecisionOperatorFactory.makeIntSplit(),
model.retrieveIntVars(true)));
}
else {
@@ -87,5 +87,6 @@ public void buildModel() {
public void configureSearch() {
model.getSolver().setSearch(minDomLBSearch(vars));
model.getSolver().limitTime(Config.timeout + "s");
// model.getSolver().showDecisions();
}
}
@@ -27,7 +27,7 @@
<dependency>
<groupId>org.choco-solver</groupId>
<artifactId>choco-solver</artifactId>
<version>4.0.0</version>
<version>4.10.0</version>
</dependency>
<dependency>
<groupId>bonsai</groupId>
@@ -22,7 +22,7 @@
<dependency>
<groupId>org.choco-solver</groupId>
<artifactId>choco-solver</artifactId>
<version>4.0.0</version>
<version>4.10.0</version>
</dependency>
<dependency>
<groupId>bonsai</groupId>
@@ -27,8 +27,8 @@ public BoundedDepth(LMax limit) {
public proc bound() =
module Depth depth = new Depth();
par
|| run depth.count();
|| flow
<> run depth.count();
<> flow
when depth.value |= limit then
prune
end
@@ -17,6 +17,9 @@
import bonsai.runtime.lattices.*;
import bonsai.statistics.Discrepancy;

// This strategy explores the search tree until it reaches a limit for the number of discrepancies taken, it is described in the following paper:
// W. D. Harvey and M. L. Ginsberg, “Limited discrepancy search,” in IJCAI (1), 1995, pp. 607–615.
// Note that this class only perform one iteration (given by limit).
public class BoundedDiscrepancy
{
ref single_space LMax limit;
@@ -27,8 +30,8 @@ public BoundedDiscrepancy(LMax limit) {
public proc bound() =
module Discrepancy dis = new Discrepancy();
par
|| run dis.count();
|| flow
<> run dis.count();
<> flow
space nothing end;
when dis.value |= limit then
prune
@@ -20,7 +20,7 @@
<dependency>
<groupId>org.choco-solver</groupId>
<artifactId>choco-solver</artifactId>
<version>4.0.0</version>
<version>4.10.0</version>
</dependency>
</dependencies>
</project>

0 comments on commit dbd1d4c

Please sign in to comment.
You can’t perform that action at this time.