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.