reindent java code

This commit is contained in:
Laurent Perron
2018-11-10 23:43:32 +01:00
parent 333cf82f0f
commit 837cdbbbc8
22 changed files with 292 additions and 325 deletions

View File

@@ -81,7 +81,8 @@ public class BinPackingProblem {
// slack[b] => load[b] <= safeCapacity.
model.addLessOrEqual(load[b], safeCapacity).onlyEnforceIf(slacks[b]);
// not(slack[b]) => load[b] > safeCapacity.
model.addGreaterOrEqual(load[b], safeCapacity + 1).onlyEnforceIf(slacks[b].not());
model.addGreaterOrEqual(load[b], safeCapacity + 1)
.onlyEnforceIf(slacks[b].not());
}
// Maximize sum of slacks.
@@ -92,7 +93,8 @@ public class BinPackingProblem {
CpSolverStatus status = solver.solve(model);
System.out.println("Solve status: " + status);
if (status == CpSolverStatus.OPTIMAL) {
System.out.printf("Optimal objective value: %f%n", solver.objectiveValue());
System.out.printf("Optimal objective value: %f%n",
solver.objectiveValue());
for (int b = 0; b < numBins; ++b) {
System.out.printf("load_%d = %d%n", b, solver.value(load[b]));
for (int i = 0; i < numItems; ++i) {