0

I want to solve an MINLP problem with SCIP in Python and therefore use PySCIPOpt. I already introduced the variables, the objective function, and set the constraints (as far as it was possible, given my issue).

Within one constraint, there is a variable in the exponent of another pair of variables. Currently, it looks like this (x_1, x_2, y_1, y_2, z, v all are variables):

model.addCons( x_1 * x_2 * ( (y_1/y_2)**((z-1)/z) -1 ) - v == 0 )

This gives back the following error: NotImplementedError: exponents must be numbers

I was reading about a builtin exp() method, but did not find a good example of how to use it in my specific code.

The only alternative I could imagine would be using the constraint handler, which of course is more work than just putting in exp().

Does anyone has an idea on how to implement the respective constraint in PySCIPOpt?

Thanks for your help in advance!

LukPau
  • 23
  • 2
  • 1
    I don't think you can directly model constraints with variables in the exponent in SCIP/PySCIPOpt. The documentation states that only constants can be used as exponents: https://scipopt.org/doc/html/group__EXPRHDLRS.php#gaebe772008384fe8ec53cd5e0c8909f9b – mattmilten Mar 29 '22 at 21:20
  • @mattmilten , I know you're involved with PySCIPOpt, do you think my workaround may cause issues? – J. Dionisio Sep 22 '22 at 16:54

1 Answers1

0

I believe you can model this with PySCIPOpt, by taking into account that

formula

Which for your exponential yields

formula

So I think your constraint can then be modeled like this:

model.addCons( x_1 * x_2 * (exp(((z-1)/z)*log(y_1/y_2))-1) - v == 0 )

At least the code runs, and if I'm not mistaken, it's mathematically equivalent to what you wanted.

J. Dionisio
  • 159
  • 1
  • 13