简体   繁体   中英

CPLEX - Java How to create an absolute values summation constraint

I have to create a constraint like this:

z = Σi|xi - 1|

How can I do this in java with CPLEX?

x is an integer vector and z an integer.

Use functions IloCplex.eq(), IloCplex.abs(), IloCplex.sum() and IloCplex.diff(). The are all described in the reference documentation . You may also want to take a look at the Java examples that ship with CPLEX. They illustrate how to build and add constraints.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM