x = model.NewIntVar(0, 5, 'x')
y = model.NewIntVar(0, 8, 'y')
# Create the conmstraints
model.Add(y+2*x-x*y<30)
--
You received this message because you are subscribed to the Google Groups "or-tools-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to or-tools-discu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/or-tools-discuss/c0908d18-ffd8-4aa3-9cf9-6230daa10189%40googlegroups.com.
You have to create an intermediate integer variable:xy = model.NewIntVar(0, 8*5, 'xy')model.AddMultiplicationEquality(xy, [x, y])
El mar., 11 feb. 2020 10:23, Jack <jakob....@gmail.com> escribió:
Forgot to add [CP-SAT, Python]--
On Tuesday, February 11, 2020 at 10:13:58 AM UTC+1, Jack wrote:Hello,I am also new to OR tools and have to deal with a nonlinear constraint (term x*y).x = model.NewIntVar(0, 5, 'x')
y = model.NewIntVar(0, 8, 'y')
# Create the conmstraints
model.Add(y+2*x-x*y<30)I found that this can be solved using intermediate boolean variables and AddMultiplicationEquality.Don't really understand how to do this. So I have to loop through all x and y and sum it up via AddMultiplicationEquality?Can you help me out?Thanks,Jack
You received this message because you are subscribed to the Google Groups "or-tools-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to or-tools...@googlegroups.com.