Skip to content

Latest commit

 

History

History
50 lines (36 loc) · 1.41 KB

File metadata and controls

50 lines (36 loc) · 1.41 KB

Nextmv Python Pyomo Shift Assignment

Example for running a Python application on the Nextmv Platform using the Pyomo solver interface. We solve a shift assignment Mixed Integer Programming problem.

Pyomo does not include any solvers. Install solvers locally or run remotely using Nextmv Cloud.

  1. Install packages.

    pip3 install -r requirements.txt
  2. Run the app.

    python3 main.py -input input.json -output output.json \
      -duration 30 -provider cbc

Mirror running on Nextmv Cloud locally

Docker needs to be installed.

To run the application in the same Docker image as the one used on Nextmv Cloud, you can use the following command:

cat input.json | docker run -i --rm \
-v $(pwd):/app ghcr.io/nextmv-io/runtime/pyomo:latest \
sh -c 'python3 /app/main.py'

You can also debug the application by running it in a Dev Container. This workspace recommends to install the Dev Container extension for VSCode. If you have the extension installed, you can open the workspace in a container by using the command Dev Containers: Reopen in Container.

Next steps

  • Open main.py and modify the model.
  • Visit our docs and blog. Need more assistance? Contact us!