Setting constraints with variables as exponents in PySCIPOpt

194 Views Asked by At

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!

1

There are 1 best solutions below

0
J. Dionisio On

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.