The call to propagate_impl will return an ExecStatus that is not checked. Not checking the result means that any failure or subsumption reported in propagate_impl will be discarded. Surrounding the call with GECODE_ES_CHECK will check for those cases and return appropriately. This is a clear error, I have not checked...

If I understand you correctly you want to ensure that the sums of the full matrix is equal to 1. Then you can use an ArrayList ("all") to collect all the IntegerVariables into one list and then add a constraint to "all". Your example is not complete, e.g. the number...

prolog,constraint-programming,clpfd,gnu-prolog

There is a library for Constrained Logic Programming in SWI-Prolog. It's called clpfd. :-use_module(library(clpfd)). Let's say that you'll have a variable for the length of the subsequence. Its domain goes from zero (corresponding to the empty subsequence) to the length of the list. In order to get the longest sequence...

constraints,constraint-programming,check-constraints,minizinc

(Hi, this question is easier to answer than your original question since it is much more to the point.) Here is a version that use two extra arrays of decision variables: "ExamsRoom" to handle the assignment of the room to an exam, and "ExamsStart" for the start time of the...

I was taking this from the wrong angle completely. Instead of trying to build a variable as a sum of other variables, I create a plain variable and then Constrain it to be the sum of other variables, like this: IntVar overflows = VariableFactory.integer("overflows", 0, maxOverflows, solver); Constraint tracker =...

prolog,metaprogramming,constraint-programming

This is an ECLiPSe solution that takes the Golorp description directly: :- lib(ic). golorp((?(Jaws):-Stomach), Food) :- term_vars(Jaws, Xs, []), Xs :: 0..9, call(Stomach)@ic, once labeling(Xs), concat_string(Xs, Food). term_vars(X, [X|Vs], Vs) :- var(X). term_vars(Xs, Vs, Vs0) :- nonvar(Xs), ( foreacharg(X,Xs), fromto(Vs,Vs2,Vs1,Vs0) do term_vars(X, Vs2, Vs1) ). I've used a duplicate-preserving variant...

constraint-programming,minizinc

I ran the following model and it gave a lot of solutions (using "solve satisfy") for both Gecode and G12fd solvers. Which MiniZinc version do you use? I use the latest Git version MiniZinc 2.0 which is about the same as v2.0.2. var 1..5: k=1; array[1..2] of var 1..48: key2;...

java,constraint-programming,optaplanner

The TSP and Vehicle Routing example already have planning values that are planning entities too, although they both use a chained=true variable. Because chained=true, it implies that no 2 planning entities have the same planning variable (and all are directly or indirectly connected to an anchor). See docs section "chained...

constraint-programming,minizinc

Two notes: I got the same result as you: running via the command line works. Using MiniZincIDE give the same error, but after resetting the MZN_STDLIB_DIR in the terminal that run MiniZincIDE.sh then it works. Do you have MZN_STDLIB_DIR set? Then try to reset it with this command. export MZN_STDLIB_DIR=...

java,graph-theory,constraint-programming

i managed to find an easier solution to implement than the one proposed by stuXnet. Using Jung library, i check whether there are more than one path available between each pair of a given dependency. If it's the case, then this dependency is certainly needless, so i just have to...

Here is another improvement to @Celelibi's improved version (cele_n). Roughly, it gets a factor of two by constraining the length of the first argument, and another factor of two by pretesting the two versions. cele_n SICStus 2.630s cele_n SWI 12.258s 39,546,768 inferences cele_2 SICStus 0.490s cele_2 SWI 2.665s 9,074,970 inferences...

c#,constraint-programming,ms-solver-foundation

I found the problems I should define more constraints in my model My time limits was very large, I change DateTimes to double converting method with hankank guidance So the final solution is here: //extention method for converting DateTime to normalized double public static double ToMinutes(this DateTime value) { return...

java,optaplanner,constraint-programming,drools-planner

For generic moves, you would be able to do this with a mimic value selector (see docs "mimic selection"), but it doesn't exist yet. Feel free to create a jira: OptaPlanner should support it in the future. Meanwhile, you can do it with a custom Move, see docs "Customer MoveListFactory/MoveIteratorFactory"....

constraints,check-constraints,constraint-programming,minizinc

For the output section, the following code should work. I only changed the Day schedule, the rest is unchanged. output ["\n" ++ "MiniZinc paper: Exams schedule " ++ "\n" ] ++ [ if t mod 10 = 1 /\ r = 1 then "\n\nDay " ++ show(d) ++ " \n"...

prolog,constraint-programming,clpfd

What I understand, your want to get concrete solutions (and not the domains). For this, use label/1 or labeling/2, which will give all the explicit solutions (via backtracking). In SWI-Prolog, these predicates are documented here: labeling/2 . label(List) is equivalent to labeling([],List). For this simple example, label(List) would suffice: ?-...

prolog,swi-prolog,constraint-programming,clpfd

There is no constraint to express maximum difference. Nor any constraint to express a maximum1. To permit such a construct some form of quantification would be necessary. And/or problems with monotonicity would arise. However, there is something related: you might want to generate values such that the largest value is...

A functional transformation from x to y (i.e., one where each value for x is assigned a single value for y) is best done through the element constraint when possible. The constraint takes an array that maps the domain of x to the domain of y, starting at the zero...