0
使用或約束的RealVariables我用巧克力2.1.5與Eclipse IDE在Windows 8.1在喬科2
當我編譯下面的代碼:
CPModel m = new CPModel();
m.setDefaultExpressionDecomposition(false);
RealVariable A = Choco.makeRealVar("a", -5.5, 5.5);
RealVariable B = Choco.makeRealVar("b", -4.4, 4.4);
RealVariable C = Choco.makeRealVar("c", -3.3, 3.3);
m.addConstraint(Choco.or(
Choco.eq(A, Choco.plus(B,C)),
Choco.eq(B, Choco.plus(A,C)),
Choco.eq(C, Choco.plus(A,B))
));
CPSolver solver = new CPSolver();
solver.read(m);
System.out.println(solver.solve());
我得到以下輸出:
Exception in thread "main" java.lang.UnsupportedOperationException
at choco.kernel.solver.constraints.AbstractSConstraint.opposite(AbstractSConstraint.java:270)
at choco.cp.solver.CPModelToCPSolver.makeSConstraintAndOpposite(CPModelToCPSolver.java:335)
at choco.cp.solver.CPModelToCPSolver.createGenericMetaConstraint(CPModelToCPSolver.java:457)
at choco.cp.solver.CPModelToCPSolver.createMetaConstraint(CPModelToCPSolver.java:432)
at choco.cp.solver.CPModelToCPSolver.readModelConstraint(CPModelToCPSolver.java:353)
at choco.cp.solver.CPModelToCPSolver.readConstraints(CPModelToCPSolver.java:292)
at choco.cp.solver.CPSolver.read(CPSolver.java:519)
at coverbylines.Test.main(Test.java:88)
但是,當我嘗試IntegerVariable
s,我沒有得到任何錯誤。會有什麼問題? 反正有這個嗎?