1

The mathematical model indicated below makes a trouble to the solver CPLEX. I understand that the issue arises due to non-convexity in constraints.

min { (b)*(d*m) + (1-b)*(d*n) }
st.
Cons0: d = p-g,
Cons1: b*d => 0,
Cons2: (1-b)*(-d) => 0

Model seeks the optimal value for p. The idea is that; the objective function should consider the cost of m (i.e. dm) for p values greater than g, and vice versa (i.e. dn). b is a binary variable and m, n and g are parameters that are assumed given.

I use Pyomo (Python-based optimisation modelling language) with solver CPLEX. Running the code ends up with this error message:

"CPLEX Error  5002: 'c_Cons1_' is not convex."

Please, consult me regarding how to by-pass this non-convexity issue by either modifying the constraints or sth else.

Thanks.

Izzy
  • 21
  • 4
  • 1) CPLEX is not able to handle non-convex constraints 2) You can always try some solver supporting this (NLP; MINLP solvers like Knitro, Baron, Couenne...) 3) Your constraint is feasible *iff* both variables are non-negative / ```>=0``` -> just add indicator-constraints/variables (b_pos, d_pos) and add an additional constraint ```b_pos + d_pos >= 2``` (*logical and*). These indicator-variables are very common and googling will show you some approaches. In a convex-setting, one typically uses binary-variables (which results in an Mixed-integer problem) which is reflected in the *logical and* – sascha Nov 01 '16 at 15:50
  • Thank you! I will definitely try other solvers. However, regarding your suggestion, I am afraid we have our hands tied as d is not always non-negative (i.e. p and g are non-negative; `if g > p then d < 0`). You said this approach can be utilised _iff_ both b and d are non-negative right? So, what else can we do? – Izzy Nov 01 '16 at 17:18
  • 1
    The multiplication of a binary and a continuous variable can be linearized [link](http://yetanothermathprogrammingconsultant.blogspot.com/2008/05/multiplication-of-continuous-and-binary.html). – Erwin Kalvelagen Nov 01 '16 at 18:42
  • If ```b*d >= 0``` is a constraint, your problem is only feasible if b>=0 and d>=0 (**edit:** i forgot negative*negative; this can be added too). Only then, the multiplication is resulting in a value >= 0 (or inverse perspective: it's only infeasible if the signs differ = xor; ignoring special-case 0). This can easily be linearized with the help of indicator-constraints and logical-constraints like sketched above. **EDIT** Ok, i was focused on constraint 1 which the error mentioned. Constraint 2 is some other problem and not as easily handled as C1.If one of those vars is binary -> Erwins post – sascha Nov 01 '16 at 22:03
  • @ErwinKalvelagen I've checked the link you provided. That seems useful for me. However, I have a question. The approach was exemplified for `z = x*b` where x and b are continuous and binary variables, respectively. What about a _"less/greater than or equal to"_ inequality is the case, rather than an equality? (i.e., `x*b >= z`) – Izzy Nov 05 '16 at 22:04
  • `z <= x*b` is a much simpler case: just two inequalities are needed `z <= x` and `z <= xup * b` where `xup` is an upper bound of `x`.. – Erwin Kalvelagen Nov 05 '16 at 22:51
  • In the above I assumed `xup >= 0`. If `xup<0` things we need to change a few things. – Erwin Kalvelagen Nov 05 '16 at 23:42
  • @ErwinKalvelagen, one more quick question; does the same method work for a system of two constraints too? See the above model in the main question. (i.e., `x*b >= 0 && (-x)*(1-b) >= 0`). – Izzy Nov 06 '16 at 04:45
  • The idea here is apparently that, for `x >= 0` we force the model to choose `b=1`, otherwise `b=0`. – Izzy Nov 06 '16 at 04:51

0 Answers0