Store store = new Store ();
// Create the variables
IntVar cost = new IntVar (store, "cost", 0, 2);
IntVar[] vars = new IntVar [2];
vars[0] = new IntVar (store, "v_0", 0, 1);
vars[1] = new IntVar (store, "v_1", 0, 1);
// Ground the variables using In constraints, such that the store is infeasible
store.impose(new In (cost, new IntervalDomain (0, 0)));
store.impose(new In (vars[0], new IntervalDomain (0, 0)));
store.impose(new In (vars[1], new IntervalDomain (0, 0)));
// Impose a SoftAlldifferent constraint
store.imposeDecomposition(new SoftAlldifferent (vars, cost, ViolationMeasure.DECOMPOSITION_BASED));
System.out.println(store.consistency());
Exception in thread "main" java.lang.AssertionError: non-optimal arcs:
[1->sink, flow=0/1 reduced=-1, index=2]
at org.jacop.constraints.netflow.Assert.checkOptimality(Assert.java:269)
at org.jacop.constraints.netflow.simplex.NetworkSimplex.networkSimplex(NetworkSimplex.java:368)
at org.jacop.constraints.netflow.NetworkFlow.consistency(NetworkFlow.java:255)
at org.jacop.core.Store.consistency(Store.java:547)
when asserts are enabled.
The following code:
throws
when asserts are enabled.