0
votes

I am trying to solve quadratic programming problem using IBM's Cplex Python API. The problem has non-linear constraints. Does Cplex accept non-linear constraint for quadratic programming? More specifically, given unknowns [x1,x2,x3,x4,x5], I need to put in two constraints

Constraint A (x2+x3) / (1-x1) = z1

Constraint B (x4+x5) / (1-x1) = z2

Where z1 and z2 are known numbers.

Cplex does have instructions on how to enter quadratic constraints, but none that I can find on entering non-linear constraints in general.

1
CPLEX doesn't support general non-linear constraints. However I think that if you rearrange those constraints by moving the denominator term to the other side, they can be entered as linear constraints. - TimChippingtonDerrick
thanks, did that, it worked. - user58925

1 Answers

2
votes

could

from docplex.mp.model import Model


mdl = Model(name='example')

z1=2;
z2=3;


mdl.x1 = mdl.continuous_var(0,10,name='x1')
mdl.x2 = mdl.continuous_var(0,10,name='x2')
mdl.x3 = mdl.continuous_var(0,10,name='x3')
mdl.x4 = mdl.continuous_var(0,10,name='x4')
mdl.x5 = mdl.continuous_var(0,10,name='x5')


mdl.add_constraint(mdl.x2+mdl.x3==z1*(1-mdl.x1), 'A')
mdl.add_constraint(mdl.x4+mdl.x5==z2*(1-mdl.x1), 'B')

mdl.solve()

print(mdl.x1.solution_value);
print(mdl.x2.solution_value);
print(mdl.x3.solution_value);
print(mdl.x4.solution_value);
print(mdl.x5.solution_value);

help ?