I currently started working with Google OR Tools CP-Sat Solver in Java and facing Problems with simple mathematical equations including constants and the OR-Tools internal "IntVar".
A Small Example of my Problem:
// Variables
IntVar a = model.newIntVar(0, 5, "a");
IntVar b = model.newIntVar(0, 5, "b");
int c = 1;
// Constraint
model.addEquality(a, a * c); // Cannot apply * with IntVar and int
model.addEquality(a, a + b); // Cannot Apply + with IntVars
// What I want to achieve
model.addEquality(a, a * c + b);
I'm used to Python where these type - problematic didnt really exist, there a simple model.Add(a == a * c + b)
did the job.
Also Or-Tools LinearExpr.sum or LinearExpr.term didnt help me at all.
Has anyone worked with CP-Sat Optimization Problems in Java and knows a workaround?