Forum Discussion

FICO's avatar
FICO
Community Manager
1 year ago

Xpress range constraint

Using the latest Xpress interface I can add a constraint x_i + y_i <= UB_i for all i like this:

xprsProb.addConstraints(nrNodes, i -> sum(x+y).leq(UB));

How can I add a range constraint like:

LB_i <= x_i + y_i <= UB_i

I cannot seem to find the range/rng restrictions anymore?

1 Reply

  • FICO's avatar
    FICO
    Community Manager

    Hi Joris,

    I think the method you are looking for is "in":

    xprsProb.addConstraints(nrNodes, i -> sum(x+y).in(UB, LB));