0

Is it possible to add as a dynamic constraint an external custom function in Mixed Integer Nonlinear Programming libraries in Python? I am working with boolean variables and Numpy matrices (size m x n) where i want to minimize the sum of total values requested (e.g tot_vals = 2,3......n). Therefore, i want to add some "spatial" constraints, I've created the functions (based on Boolean indexing) and i try to implement them in my optimization procedure. In CVXPY, it fails as i can only add CVXPY's formatted constraints (as far as i know), PULP fails as it works only for LP problems, maybe a choice could be Pyomo, OpenOpt or PySCIPopt?

Thank you in advance for your help

1 Answer 1

1

With PySCIPOpt this is possible. You would need to create a custom constraint handler which checks the current LP solution for feasibility and maybe adds valid inequalities to circumvent the infeasibility in the next node.

One example of this procedure is the TSP implementation in PySCIPOpt. This is also explained in some more detail in this tutorial article about PySCIPOpt.

Sign up to request clarification or add additional context in comments.

2 Comments

Matt thank you for your immediate response and the additional information and as i see my only choice and chance to solve it is working with graphs. I am trying to install PySCIPopt but as i see the installation is a bit tricky and is more complicated than just a single 'pip install' right?I am working on Python 3.6 in Windows 10.
It's actually not that complicated. You need to install the SCIP Opt Suite using the provided Windows installer, set your PATH and SCIPOPTDIR environment variables accordingly and then youcan run pip install pyscipopt. If there are problems you cannot solve, you my consider opening an issue on the PySCIPOpt GitHub page.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.