Hello, I'm new to constraint satisfaction problems. I have no experience in prolog but I know java and thus jacop is the perfect tool for me. So, congratulations for the good job!
I have a question.
Constraint ctr = new Sum(v, sum);
is for imposing a constraint over the sum of IntVar v.But, how can impose a constraint over the sum of square of v elements?
For example, if v=, I want a^2+b^2+c^2=1000. How can I impose this constraint?
Thank you in advance!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello, I'm new to constraint satisfaction problems. I have no experience in prolog but I know java and thus jacop is the perfect tool for me. So, congratulations for the good job!
I have a question.
is for imposing a constraint over the sum of IntVar v.But, how can impose a constraint over the sum of square of v elements?
For example, if v=, I want a^2+b^2+c^2=1000. How can I impose this constraint?
Thank you in advance!
Hi,
You need to create an auxiliary variable aSquare that will be constrained to hold square of a.
store.impose(new XmulYeqZ(a, a, aSquare));
The same for bSquare and cSquare
later on you use Sum constraints with *Square variables.
best,
Radek
Thank you very much Radek :)
I just created a simple solver for number partitioning csp (http://www.cs.st-andrews.ac.uk/~ianm/CSPLib/prob/prob049/specification.html).
If anyone interested, please let me know, I would be happy to share it.