Activity for JaCoP

  • JaCoP JaCoP released /JaCoP-4.11/jacop-4.11.0.jar

  • JaCoP JaCoP released /JaCoP-4.11/minizinc.zip

  • JaCoP JaCoP released /JaCoP-4.11/jacop-4.11.0-SNAPSHOT.jar

  • kris kris posted a comment on discussion Open Discussion

    No, the underlaying solver is exactly the same. It only helped me to control the stack size.

  • openfokus openfokus posted a comment on discussion Open Discussion

    So would it help to try the minizinc way ? On Mon, Mar 17, 2025 at 5:51 PM kris krzku@users.sourceforge.net wrote: Minizinc problem is rather simple in your problem. You define variables of the form var 0..3000: N3_6_fdv_i; %1374 var 0..2800: N3_6_fdv_j; %400 var 0..3000: A1_16_fdv_i; %1500 var 0..2800: A1_16_fdv_j; %1107 ... and then constraints such as constraint O_0_fdv_i = 0; constraint O_0_fdv_j = 0; constraint G1_1_fdv_i = 50; constraint G1_1_fdv_j = 50; constraint A1_0_fdv_i + 0 = G1_0_fdv_i;...

  • kris kris posted a comment on discussion Open Discussion

    Minizinc problem is rather simple in your problem. You define variables of the form var 0..3000: N3_6_fdv_i; %1374 var 0..2800: N3_6_fdv_j; %400 var 0..3000: A1_16_fdv_i; %1500 var 0..2800: A1_16_fdv_j; %1107 ... and then constraints such as constraint O_0_fdv_i = 0; constraint O_0_fdv_j = 0; constraint G1_1_fdv_i = 50; constraint G1_1_fdv_j = 50; constraint A1_0_fdv_i + 0 = G1_0_fdv_i; constraint A1_0_fdv_j + 0 = G1_0_fdv_j; .... Finally the search is defined solve :: int_search([N3_6_fdv_i, N3_6_fdv_j,...

  • openfokus openfokus posted a comment on discussion Open Discussion

    Hi Kris That is interesting. Thanks Would it help if I try to generate minizinc rather than the csv format I choose ? I am not familiar with minizinc but I can probably figure out how to do that. One question: did you try to make the search tail-recursive, for example using a tail recursive fold function rather than direct recursion ? Kind regards Peter On Mon, Mar 17, 2025 at 4:13 PM kris krzku@users.sourceforge.net wrote: Hi again, I half-manually translated your problem to minizinc and tried it...

  • kris kris posted a comment on discussion Open Discussion

    Hi again, I half-manually translated your problem to minizinc and tried it with different search strategies. It is interesting that amximal search depth for InputOrder and IndomainMiddle is 1943 wihile for InputOrder and IndomainMin is 8557. It can explain original stack overflow. You may try to set stack size for Junit, not only for java. Best, /Kris

  • openfokus openfokus posted a comment on discussion Open Discussion

    Hi Kris Thanks a lot for your support, good to know I am not using anything weird. Kind regards Peter

  • kris kris posted a comment on discussion Open Discussion

    Hi Peter, Now I understand why you wanted to give me minizinc code ;) Specifically, I do not use Intellij and have problems to use your code. I propose you check the maximal depth of stack, both when search succeded and when it fails. You can get it using DepthFirstSearch method getMaximumDepth(). Using this information you can explore why search overflow happens. In general, your model uses well tested primitive constraints and does not contains and suspected things. Best, /Kris

  • openfokus openfokus posted a comment on discussion Open Discussion

    Hi Kris I have tried to isolate the problem from the code base, you can clone it here: https://github.com/vittali/solve Instructions on how to reproduce the problem are include in the Readme.md. Please let me know if you have any problems running the test. Thanks for your support Kind regard Peter

  • openfokus openfokus posted a comment on discussion Open Discussion

    I see, hopefully you didn't misunderstand my question related to minizinc as challenging your java knowledge, it is just that the solver is part of a larger application and I first need to isolate the relevant part to make it easier to communicate. I thought that if I could generate the minizinc file from the Store(), I simply could send you this file and you could load the model and run it. Anyway, I will be back ... Thanks Peter On Sat, Mar 15, 2025 at 9:31 PM kris krzku@users.sourceforge.net wrote:...

  • kris kris posted a comment on discussion Open Discussion

    There is no merhod to generate minizinc from Java JaCoP progrma. I have programmed JaOoP and you can send me Java program ;) Best, /Kris

  • openfokus openfokus posted a comment on discussion Open Discussion

    How can I generate the minizinc model from the content of Store() ?

  • kris kris posted a comment on discussion Open Discussion

    Yes, please give me a model and I can try to look at it.

  • openfokus openfokus posted a comment on discussion Open Discussion

    Hi Kris Would it help to export the model as minizinc so that you can have a look at it ?

  • kris kris posted a comment on discussion Open Discussion

    Hi Peter, I understand but cannot help much more without your code. You may try to specify smaller intervals for variable domains for domains that are really large... Best, /Kris

  • openfokus openfokus posted a comment on discussion Open Discussion

    Hi Kris Thanks for the reply, unfortunately increasing stacksize up to the allowed max doesn't help ... Kind regards Peter

  • kris kris posted a comment on discussion Open Discussion

    Hi! Stack overflow error is probably quite normal. DepthFirstSearch .label is called recursively for two branches x = c and, if failed x != c. If you use IndomainMin and solution is closer to max value the recursion depth can be rather big. In such case selecting a midddle or max value might be better choice, specially for large domains. Question 2 is probably related problem 1. I have no good knowledge on Junit but it can use smaller stack sizes for several threads. You may try to run java threads...

  • openfokus openfokus modified a comment on discussion Open Discussion

    Hi, I have two, possibly related issues: 1) I can solve my model with IndomainMedian() but not with IndomainMin() The latter results in a StackOverflowError: java.lang.StackOverflowError at org.jacop.core.IntervalDomain.inShift(IntervalDomain.java:4277) at org.jacop.constraints.XplusYeqZ.consistency(XplusYeqZ.java:97) at org.jacop.core.Store.consistency(Store.java:552) at org.jacop.search.DepthFirstSearch.label(DepthFirstSearch.java:545) at org.jacop.search.DepthFirstSearch.label(DepthFirstSearch.java:746)...

  • openfokus openfokus modified a comment on discussion Open Discussion

    Hi, I have two, possibly related issues: 1) I can solve my model with IndomainMedian() but not with IndomainMin() The latter results in a StackOverflowError: java.lang.StackOverflowError at org.jacop.core.IntervalDomain.inShift(IntervalDomain.java:4277) at org.jacop.constraints.XplusYeqZ.consistency(XplusYeqZ.java:97) at org.jacop.core.Store.consistency(Store.java:552) at org.jacop.search.DepthFirstSearch.label(DepthFirstSearch.java:545) at org.jacop.search.DepthFirstSearch.label(DepthFirstSearch.java:746)...

  • openfokus openfokus posted a comment on discussion Open Discussion

    Hi, I have two, possibly related issues: 1) I can solve my model with IndomainMedian() but not with IndomainMin() The latter results in a StackOverflowError: java.lang.StackOverflowError at org.jacop.core.IntervalDomain.inShift(IntervalDomain.java:4277) at org.jacop.constraints.XplusYeqZ.consistency(XplusYeqZ.java:97) at org.jacop.core.Store.consistency(Store.java:552) at org.jacop.search.DepthFirstSearch.label(DepthFirstSearch.java:545) at org.jacop.search.DepthFirstSearch.label(DepthFirstSearch.java:746)...

  • JaCoP JaCoP updated /JaCoP-4.10/minizinc.zip

  • JaCoP JaCoP released /JaCoP-4.10/minizinc.zip

  • JaCoP JaCoP released /JaCoP-4.10/jacop-4.10.0.jar

  • Thomas B. Léauté Thomas B. Léauté posted a comment on discussion Help

    Thank you for your suggestions. I was hoping to be able to avoid introducing so many auxiliary variables, but I guess the most efficient way is indeed to implement my own constraint, which, as you pointed out, might not be very complicated (although more propagation power to the c[i] may be possible).

  • kris kris posted a comment on discussion Help

    In the current version of JaCoP, I think, you can use the following solution written in peudo-code. IntVar[] z = new IntVar[n]; make domains for each z[i].domain = x[i].domain union {0} forall i store.impose(new IfThenElse(c[i], new XeqY(z[i], x[i]), new XeqC(z[i], 0) result = sum(z) For sum you can use either Sum constraint (avoids recomputations of already ground variables) or SumInt constraint (recomputs everything). Depending on cache efficiency one of constraints can be mnore efficient. If you...

  • Thomas B. Léauté Thomas B. Léauté posted a comment on discussion Help

    Consider an array of FDVs: x = { x1, ..., xn } and a same-sized array of primitive constraints: c = { c1, ..., cn } What is the most efficient way of computing the sum of the x variables, where each variable xi is included in the sum only if its corresponding constraint ci is satisfied?

  • Thomas B. Léauté Thomas B. Léauté posted a comment on discussion Help

    The simplest way to encode your connected region constraint might actually be to implement your own global Constraint, which shouldn't be too complicated. In its consistency() method, this constraint would arbitrarily pick a square that is guaranteed not to be zero (i.e. its domain does not contain 0), and then perform a depth-first traversal of the grid from that root square, only passing through neighboring squares that may still be non-zero (i.e. their domains contain positive numbers). When the...

  • Thomas B. Léauté Thomas B. Léauté posted a comment on discussion Help

    In fact, a very elegant formulation would have been the following, involving a single Network Flow constraint. Each square is a node in the network, with arcs pointing to its neighboring squares. If any of the two nodes of an arc corresponds to an empty square (i.e. a square of value 0), then the arc must have a capacity of 0 (no flow is allowed). You arbitrarily pick one of the already filled squares as the single source in the network, and then each undefined square is a sink, whose balance must...

  • Thomas B. Léauté Thomas B. Léauté posted a comment on discussion Help

    The connected region constraint means that there must exist a path between any pair of non-empty squares that only involves non-empty squares. You might be able to express this path existence constraint using global constraints like Network Flow or Circuit.

  • Matías Matías posted a comment on discussion Help

    Hi Kris, thank you very much for your interest in finding a solution. I haven't had time to analyze your two proposals yet, but I see much more understandable the second one (I use Jacop as Java library, in Eclipse IDE). My query comes from a puzzle that I am trying to model in Jacop. Maybe I should have started there, as I am probably complicating things unnecessarily. Specifically, what prompted me to open this post was that I couldn't find a way to model the "connected region" part of this puzzle:...

  • kris kris posted a comment on discussion Help

    There is, in fact another posibility to solve your problem. This formulation dies not use set variables. It basically creates a vector of values that are not in y (for othe values a constant outside the domain is added) and the finds a m inimal value. The program looks like that. int n = 5; Store store = new Store(); IntVar[] x = new IntVar[n]; for (int i = 0; i < n; i++) { x[i] = new IntVar(store, "x["+i+"]", 1, n); } IntVar[] y = new IntVar[n]; for (int i = 0; i < n; i++) { y[i] = new IntVar(store,...

  • kris kris posted a comment on discussion Help

    I do not see any simple solution. The solution I propose is based on set variables. In minizinc it can be programmed as follows. include "globals.mzn"; int: n = 5; array[1..n] of var 1..n: x; array[1..n] of var 1..n: y; var 1..n: m; var set of 1..n: xs; constraint xs = array2set(x) diff array2set(y) /\ m = min(xs); solve satisfy; output["x = (x)\ny = (y)\nmin = (m)\nxs = (xs)"] It basically creates set variable xs that contains all elements of x that are not in y and then it finds minimum value in...

  • Matías Matías posted a comment on discussion Help

    Hi, if I have an IntVar array, say x = {x_1, x_2, ..., x_n}. How can I restrict the IntVar variable called min, to the minimum value of the list x, but which is none of the values of this other IntVar list y = {y_1, y_2, ..., y_m}? That is if x = {0,7,9,14,15} and y = {0,7,17,18}, then min = 9. In principle, it works for me if y only contains the value 0 (y = {0}). The generalization is not yet precise. Thank you very much.

  • kris kris posted a comment on discussion Help

    I do not know :( The constraints should be in store... /Kris

  • openfokus openfokus posted a comment on discussion Help

    Hi Yes , I found this one in the store printout, but why can't I find: XplusYeqZ21 352 XplusYeqZ19 34 ? Kind regards Peter

  • kris kris posted a comment on discussion Help

    Hi! No, if you print the store you will see the constraint. In your first question it was constraint XplusYeqZ46, that is the foolowing constraint. *** Constraint: XplusYeqZ46 : XplusYeqZ(U1-2-R1-1:(1)-li = 110, U1-2-R1-1:(1)-w2::{1..362}, U1-2-R1-1:(1)-i::{111..472} ) Best, /Kris

  • openfokus openfokus posted a comment on discussion Help

    Hi Kris So there is no way to track down which constraint exactly XplusYeqZ21 corresponds to in my program ?

  • kris kris posted a comment on discussion Help

    Hi Peter, Yes, XplusYeqZ21 is an particular instance of XplusYeqZ. Similar for XplusYeqZ19. You can see all the constraints when you print the store in Java. However, you will not see waht was the store state when constraint failed :( Best, /Kris

  • openfokus openfokus posted a comment on discussion Help

    HI Kris Thanks for explanation What does this mean: XplusYeqZ21 352 XplusYeqZ19 34 Does this refer to specific instances of constraints ? How can I identify which ones in the store are responsible for the failures ? Kind regards Peter

  • kris kris posted a comment on discussion Help

    Hi! The informartion is that 182 times constraints of type XplusYeqZ failed during search and more specifically 182 times fails constraint XplusYeqZ46. I hope it helps to understand the output of statistics. Best, /Kris

  • openfokus openfokus posted a comment on discussion Help

    I followed "C.1 Simple trace facilities" and set up FailConstraintsStatistics. This is the output: J1-i = 810 J1-j = 175 J1-li = 746 J1-ri = 874 J1-tj = 325 J1-bj = 25 J1-w2 = 64 J1-h2 = 150 J1-w = 128 J1-h = 300 J1-3i = 810 J1-3j = 275 J1-2i = 810 J1-2j = 175 J1-1i = 810 J1-1j = 75 U1-i = 210 U1-j = 325 U1-li = 40 U1-ri = 380 U1-tj = 625 U1-bj = 25 U1-w2 = 170 U1-h2 = 300 U1-w = 340 U1-h = 600 U1-2i = 110 U1-2j = 425 U1-1i = 110 U1-1j = 225 C1-i = 646 C1-j = 265 C1-li = 566 C1-ri = 726 C1-tj = 505...

  • JaCoP JaCoP released /JaCoP-4.9/minizinc.zip

  • JaCoP JaCoP released /JaCoP-4.9/jacop-4.9.0.jar

  • openfokus openfokus posted a comment on discussion Open Discussion

    Hi Thanks for the update, but the link seems to be wrong ...

  • vgfn gvfdb vgfn gvfdb modified a comment on discussion Open Discussion

    There is a same kind of issue I faced at stackoverflow. But you can check here now after some serious changes its running normally.

  • vgfn gvfdb vgfn gvfdb posted a comment on discussion Open Discussion

    There is a same kind of issue I faced at stackoverflow. But you can check here now after some serious changes its running normally.

  • openfokus openfokus posted a comment on discussion Help

    Hi Kris That's exactly the kind of document that I find helpful at the current state of my experience with jacop. In the meantime, it turns out that the Diffn Constraint is the issue in my code that I have to investigate. Many thanks Peter

  • kris kris posted a comment on discussion Help

    Hi Peter, You can take a look at my slides at https://fileadmin.cs.lth.se/cs/Education/EDAN01/presentations/lecture6.pdf. First 18 slides discuss depth-fist-search in general and slides 14-15 present a simpliied Java method for search in JaCoP. In this method variable selection uses input order and value selection starts from minimal value. Alternatively, you can try to find similar discussions on internet. Best, /Kris

  • openfokus openfokus posted a comment on discussion Help

    Hi Kris Thanks. Until now, I considered "Search" as a black box, apparantly, this view needs now to be refined. Can you recommend papers or books that would help me to better understand how search is done in jacop ? Material that influenced the design of jacop ? Thanks Peter

  • kris kris posted a comment on discussion Help

    Hi Peter, Explanation of search in constraint programmin requires several presentations :( Therefore, I send you a link to get more information how it is defined in JaCoP, for more details see http://jacopguide.osolpro.com/guideJaCoP.html#x1-570006 and http://jacopguide.osolpro.com/guideJaCoP.html#x1-87000B. I do not know your problem but, in general, you should probably group variables using SimpleMatrixSelect or search first on x and then on y variables. The important is also to use rgiht variable...

  • openfokus openfokus posted a comment on discussion Help

    Hi Kris Thanks, what do you mean with: In general depth-first-search is very important and you should make a more "intelligent" search. Does this mean that I should use another search strategy ? How can I make a search more "intelligent" ? While I can certainly increase the stack size, the search for this very small problem is already prohibitive. So the only way is the be more "intelligent" , but how ? Thanks Peter

  • kris kris posted a comment on discussion Help

    Hi Peter, It is difficult to answer your question without looking at your code but I think this is caused by your search. It seems that the search goes very deeply (recursive calls) and there is a stack overflow. It is probably different stack size in Eclipse and gradle. You can try to use your model from command line using java command with option -Xss100M, for example (it makes stack size of 100M). In general depth-first-search is very important and you should make a more "intelligent" search....

  • openfokus openfokus posted a comment on discussion Open Discussion

    Hi Thanks, perfect, that works very well ! Kind regards Peter

  • kris kris posted a comment on discussion Open Discussion

    Hi, Diffn constraint assures that all defined rectangles does not overlap. It does not generate any combination of the defined rectangles but uses several pruning method, such as sweep line algorithm. To have a spacing between rectangles you can use larger retangles, that is define additional space around them. Use your geometrical knowledge. /Kris

  • openfokus openfokus posted a comment on discussion Open Discussion

    Hi Thank you, two questions: 1) The doc for Diffn says ".. for each pair ... of such rectangles". I understand that the constraint will therefore generated the correct number of combinations: n C k = n! / [k! (n-k) !]. For example, for an input of n = 10 (with k=2), the code would generate 45 combinations of pairs . Is this correct ? 2) I would like to introduce spacing between the non-overlapping rectangles. How could this be done ? I could use Distance but then I need some boolean primitive again....

  • Thomas B. Léauté Thomas B. Léauté posted a comment on discussion Open Discussion

    Kris beat me by a few minutes :-)

  • Thomas B. Léauté Thomas B. Léauté posted a comment on discussion Open Discussion

    Hi Peter, The problem you are facing is probably not due to the number of constraints, but to the number of auxiliary variables that are incurred by your problem formulation. For each pair of rectangles, you have a recursive Boolean predicate constraint (an Or of And's), which JaCoP internally flattens by introducing auxiliary variables. Then, JaCoP's DepthFirstSearch is implemented using recursion, calling itself every time the search branches on a value of a variable; this results in the JVM running...

  • kris kris posted a comment on discussion Open Discussion

    Hi! To impose a non-overlapping constraint on rectangels use org.jacop.constraints.diffn.Diffn.java constraint. It can handle better many recatngles than combination of primitive constraints. The number of constraints is not a problem. The problem is search. You can look at your search definition, for example a variable selection method. God luck, /Kris

  • kris kris posted a comment on discussion Open Discussion

    Hi! No, it is not possible to export constraints from the store to flatzinc file. /Kris

  • openfokus openfokus modified a comment on discussion Open Discussion

    Hi, I want to impose a non-overlapping constraint on rectangular shapes: private Cst cst_noOverlap_ij(RectCst r1, RectCst r2) { String index = r1.id + r2.id; int iMinDistance = r1.w / 2 + r2.w / 2 + minDist; int jMinDistance = r1.h / 2 + r2.h / 2 + minDist; int iMaxDistance = bb.w() - r1.w / 2 - r2.w / 2 - minDist; int jMaxDistance = bb.h() - r1.h / 2 - r2.h / 2 - minDist; IntVar di = new IntVar(st, fmt("di-%s", index), 0, iMaxDistance); IntVar dj = new IntVar(st, fmt("dj-%s", index), 0, jMaxDistance);...

  • openfokus openfokus posted a comment on discussion Open Discussion

    Hi, I want to impose a non-overlapping constraint on rectangular shapes: private Cst cst_noOverlap_ij(RectCst r1, RectCst r2) { String index = r1.id + r2.id; int iMinDistance = r1.w / 2 + r2.w / 2 + minDist; int jMinDistance = r1.h / 2 + r2.h / 2 + minDist; int iMaxDistance = bb.w() - r1.w / 2 - r2.w / 2 - minDist; int jMaxDistance = bb.h() - r1.h / 2 - r2.h / 2 - minDist; IntVar di = new IntVar(st, fmt("di-%s", index), 0, iMaxDistance); IntVar dj = new IntVar(st, fmt("dj-%s", index), 0, jMaxDistance);...

  • openfokus openfokus posted a comment on discussion Open Discussion

    Hi Is it possible to export the constraints in the store ( added during the execution of my java program) to minizinc and have an external tool (or suite of tools) process the minizinc file, save the results somewhere so that I can import them in my java programm again. The idea is to compare different solvers , driven by a java program, Thanks Peter

  • JaCoP JaCoP released /JaCoP-4.8/jacop-4.8.0.jar

  • JaCoP JaCoP released /JaCoP-4.8/minizinc.zip

  • kris kris posted a comment on discussion Open Discussion

    Hi Simon, OK, I understad. This is basically the search on IntVar but cost variable is FloatVar. Am I right? I this case, when the solver finds a solution it tries to find better, that is at least of "value = current value - ulp" (unit at the last position). It might help to define a biger optiomization step by using FloatDomain.setStep(0.1);, for example. You may try also jacop.floats.search.Optimize but I am ot sure if this will work in your case. BTW, how many solutions you get? Best, /Kris

  • Simon Simon posted a comment on discussion Open Discussion

    Hi Kris, thanks for the replay. Yes, I've used diff2 to model the scheduling problem and if I use a simple cost function (like latest completion time) it solves the problem in "no time". I have the efficiency issues only when I add to the model the cost function (c=P*X(1-X), where X is again a complex function of time, and I need to calcutate it for starting time and end time of each task to finally calculat totat cost). In my actual aproach the c equation is modelled as a set of primitive float...

  • kris kris posted a comment on discussion Open Discussion

    Hi! I do ot kow your problem but, i general, to make CP model efficient you need to make two things. First, you need to use global costraints since they are more efficient than primitive. For schedulig one ususally uses Cumulative and Diffn costraits. Possibly, depennding on the problem other constraints may be usefull. Second, good search heuristic that tekes into account the problem structure. Of course, it might be that your complex cost function is the problem for the solver. Best regards, /...

  • kris kris posted a comment on discussion Open Discussion

    Hi! I do ot kow your problem but, i general, to make CP model efficient you need to make two things. First, you need to use global costraints since they are more efficient than primitive. For schedulig one ususally uses Cumulative and Diffn costraits. Possibly, depennding on the problem other constraints may be usefull. Second, good search heuristic that tekes into account the problem structure. Of course, it might be that your complex cost function is the problem for the solver. Best regards, /...

  • Simon Simon posted a comment on discussion Open Discussion

    Hi, I'm just wondering if there is a better way to solve a problem of task scheduling with the cost function that is a "complex" function of the start and finish times of all tasks. The problem is to schedule several operations for the machine and for each operation the cost function can be calculated. The cost function itself is a composition of several math operations (multiplication, adding and subtracting and even natural logarithm) with some constant parameters and tasks start and stop time...

  • Yurii Oleynik Yurii Oleynik modified a comment on discussion Help

  • Yurii Oleynik Yurii Oleynik posted a comment on discussion Help

    Thank you for such quick and informative answer! I'll be glad to get any code examples, especially simple ones. Could you send them on yoleynik@iimm.ru please?

  • Yurii Oleynik Yurii Oleynik posted a comment on discussion Help

    Thank you for such quick and informative answer! I'll be glad to get any code examples, especially simple ones. Could you send them on yoleynik@iimm.ru please?

  • kris kris posted a comment on discussion Help

    Hi Yurii, Unfortunately we do not have any manual that describes clearly how to build new constraints or search but we can help you if you will have questions. Below there is a very short guide on this. The constraints always extend either PrimitiveConstraint or Constraint. You probably will extend Constraint since it does not need to implement methods for negated versions of the constraint (notConsistency and norSatisfied). Bascially you need to create a constructor that builds all needed data structures...

  • Yurii Oleynik Yurii Oleynik posted a comment on discussion Help

    Hi all. I've searching the best way to represent own constraint. I'm trying different CP solvers and now I've come to JaCoP, but can't find a proper manual for some specific tasks so asking here for help. I have a several integer variables and a table-like structure with domain values of variables as a single constraint. I have an algorithm that parse the structure, reduce domains of the variables and change the structure accordingly - propogation of the constraint. I have branching or search algorithms...

  • Adriano Cavalheiro Marchesan Adriano Cavalheiro Marchesan posted a comment on discussion Help

    I understand now! Thank you very much Kris!

  • kris kris posted a comment on discussion Help

    Hi! As I wrote in the previous mail, you need to do search. It is not enough to do consistency. The solver does not "see" that the index is the same in both ElementFloat constraints when pruning domains. Possible search can look as follows. DepthFirstSearch<FloatVar> label = new DepthFirstSearch<FloatVar>(); SplitSelectFloat<FloatVar> s = new SplitSelectFloat<FloatVar>(store, new FloatVar[] {var1, var2, mult}, null); label.setSolutionListener(new PrintOutListener<FloatVar>()); label.getSolutionListener().searchAll(true);...

  • Adriano Cavalheiro Marchesan Adriano Cavalheiro Marchesan posted a comment on discussion Help

    Hi Kris! Thanks for your answer! I summarized my problem, maybe it got confused I used the same index on both Element constraints: IntVar index = new IntVar(store, 1, 3); FloatVar var1 = new FloatVar(store, 3.0, 5.0); FloatVar var2 = new FloatVar(store, 3.0, 8.0); FloatVar mult = new FloatVar(store, “mult”, -100.0, 100.0); double[] array1 = {3.0, 4.0, 5.0}; double[] array2 = {6.0, 8.0, 3.0}; store.impose(new ElementFloat(index, array1, var1)); store.impose(new ElementFloat(index, array2, var2));...

  • kris kris posted a comment on discussion Help

    Hi! I am not sure if I understand your question but if you need the arrays indexes to change together you simply use the same index for both Element constraints. In such case you will get the answer you ask for. The main point is that you need to define your search to search for all solutions and JaCoP will find 18.0 then 32.0 and finally 15.0. Bset, /Kris

  • kris kris posted a comment on discussion Help

    Hi! I am not sure if I understand your question but if you need the arrays indexes to change together you simply use the same index for both Element constraints. In such case you will get the answer you ask for. The main point is that you need to define your search to search for all solutions and JaCoP will find 18.0 then 32.0 and finally 15.0. Bset, /Kris

  • Adriano Cavalheiro Marchesan Adriano Cavalheiro Marchesan modified a comment on discussion Help

    Hi all Could anyone help me define the following constraint: I have two coefficient arrays (float) and i need their indexes to change together. For example: IntVar index = new IntVar(store, 1, 3); FloatVar var1 = new FloatVar(store, 3.0, 5.0); FloatVar var2 = new FloatVar(store, 3.0, 8.0); FloatVar mult = new FloatVar(store, -100.0, 100.0); double[] array1 = {3.0, 4.0, 5.0}; double[] array2 = {6.0, 8.0, 3.0}; store.impose(new ElementFloat(index, array1, var1)); store.impose(new ElementFloat(index,...

  • Adriano Cavalheiro Marchesan Adriano Cavalheiro Marchesan modified a comment on discussion Help

    Hi all Could anyone help me define the following constraint: I have two coefficient arrays (float) and i need their indexes to change together. For example: IntVar index = new IntVar(store, 1, 3); FloatVar var1 = new FloatVar(store, 3.0, 5.0); FloatVar var2 = new FloatVar(store, 3.0, 8.0); FloatVar mult = new FloatVar(store, -100.0, 100.0); double[] array1 = {3.0, 4.0, 5.0}; double[] array2 = {6.0, 8.0, 3.0}; store.impose(new ElementFloat(index1, array1, var1)); store.impose(new ElementFloat(index2,...

  • Adriano Cavalheiro Marchesan Adriano Cavalheiro Marchesan modified a comment on discussion Help

    Hi all Could anyone help me define the following constraint: I have two coefficient arrays (float) and i need their indexes to change together. For example: IntVar index = new IntVar(store, 1, 3); FloatVar var1 = new FloatVar(store, 3.0, 5.0); FloatVar var2 = new FloatVar(store, 3.0, 8.0); FloatVar mult = new FloatVar(store, -100.0, 100.0); double[] array1 = {3.0, 4.0, 5.0}; double[] array2 = {6.0, 8.0, 3.0}; store.impose(new ElementFloat(index1, array1, var1)); store.impose(new ElementFloat(index2,...

  • Adriano Cavalheiro Marchesan Adriano Cavalheiro Marchesan posted a comment on discussion Help

    Hi all Could anyone help me define the following constraint: I have two coefficient arrays (float) and i need their indexes to change together. For example: IntVar index = new IntVar(store, 1, 3); FloatVar var1 = new FloatVar(store, 3.0, 5.0); FloatVar var2 = new FloatVar(store, 3.0, 8.0); FloatVar mult = new FloatVar(store, -100.0, 100.0); double[] array1 = {3.0, 4.0, 5.0}; double[] array2 = {6.0, 8.0, 3.0}; store.impose(new ElementFloat(index1, array1, var1)); store.impose(new ElementFloat(index2,...

  • JaCoP JaCoP released /JaCoP-4.7/minizinc_jacop_lib.zip

  • JaCoP JaCoP released /JaCoP-4.7/jacop-4.7.0.jar

  • Erik Zhamakochyan Erik Zhamakochyan posted a comment on discussion Help

    Thnak you so much for the answers

  • kris kris posted a comment on discussion Help

    1) Yes, because IndomainMin starts from minimal values of varibales. You may try IndomainMiddle. It starts from middle values, zero in your case. 2) No. /Kris

  • Erik Zhamakochyan Erik Zhamakochyan posted a comment on discussion Help

    Thanks 1) about IndomainRandom which Indomain must I use? I tried some of them but it solved and most of values of the variables were 100 or -100. 2) May you know another library by Java which works another algorithm and can solve these expressions ?

  • kris kris posted a comment on discussion Help

    1) The order of expressions (constraints more precisly) is irrelevent. Important is order in search of variables and values. 2) Yes, but it will try many possible assignments. In worst case 201^(number of variables) in your example. It might take ages... :( 3) If your expressions are linear (example attached to your question) you may try linear programming. Linear solvers are better for such cases. /Kris

  • Erik Zhamakochyan Erik Zhamakochyan modified a comment on discussion Help

    thank you again for the answer 1) about MostConstrain and MinDomainOverDegree comparators But When I try to solve 200 or more such expressions these and left comparators don't work and I get infinite loop. Is there such order of expressions in which case solver will be able to solve those expressions? 2)There is no such thing as infinite loop! Does This mean if I don't stop solving process solver may solve expressions for some time? 3) Can you explain to me more detailed about why Solver cannot solve...

  • Erik Zhamakochyan Erik Zhamakochyan posted a comment on discussion Help

    thank again you for the answer 1) about MostConstrain and MinDomainOverDegree comparators But When I try to solve 200 or more such expressions these and left comparators don't work and I get infinite loop. Is there such order of expressions in which case solver will be able to solve those expressions? 2)There is no such thing as infinite loop! Does This mean if I don't stop solving process solver may solve expressions for some time? 3) Can you explain to me more detailed about why Solver cannot solve...

  • kris kris posted a comment on discussion Help

    BTW, in the new release later this year there will be new variable selection methods that are based on activity or fault count of variables. It seems that they work well for such cases as yours. Next comment. IndomainRandom is not very reliable method for the solver. /Kris

  • kris kris posted a comment on discussion Help

    There is no such thing as infinite loop! The solver tries values and do not come to a solution in a reasonable time. Heuristics MostConstrain and MinDomainOverDegree seems to make a good job since you start with variables that are present in most constraints. Best, /Kris

1 >
MongoDB Logo MongoDB