I would like to know how can I implement a SUM operation in C# using OR-Tools. In my problem, I have the following constraint:
NOTE: My problem is a Linear Programming Problem.
You can use arithmetic operators:
model.Add(4 * r + 2 * p == 56);
or
model.Add(LinearExpr.Sum(new IntVar[] {r, p}) == 20);
See: https://github.com/google/or-tools/blob/master/ortools/sat/doc/integer_arithmetic.md
You can follow the examples in this section:
https://github.com/google/or-tools/blob/master/ortools/sat/doc/integer_arithmetic.md
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.