In our section on solving your first problem, you’ll find all the instructions you need to kick off your journey with Octeract Engine.  After going

How to use Python with the Engine

submited by
Super Jumper
2020-06-22 14:59:13

In our section on solving your first problem, you’ll find all the instructions you need to kick off your journey with Octeract Engine. After going through the guide, you’ll have:

Whether Python is your programming language of choice or you’re trying it out, you’ll be in the know after these four steps on using it and the Engine.

Let’s start by creating a simple model in Python. To do this, you’ll need to open text editor on your PC. For example, Notepad, Notepad++ etc. In text editor, you can create an empty model by using the command in the snippet below.

In text editor, start writing a model by defining some variables and setting variable bounds. From there, define an objective function and a constraint for the model. For the finishing touches, we’ll state that we want the problem to be solved to global optimality, using the Engine and 4 cores. To view a summary of the solution in Powershell, include the command m.print_solution_summary();

Now you can go ahead and save the model on your PC. It'll need to be saved as a .py file. Let's save it as my_example_python.py

Leave a Comment