Skip to content

Latest commit

 

History

History
66 lines (45 loc) · 1.48 KB

README.md

File metadata and controls

66 lines (45 loc) · 1.48 KB

Nextmv Python PyOptInterface Knapsack

Example for running a Python application on the Nextmv Platform using the PyOptInterface package. We solve a knapsack Mixed Integer Programming problem.

  1. Install packages.

    • With pip

      pip install .
    • With uv

      uv sync
  2. Run the app.

    • With python

      cat input.json | python main.py
    • With uv

      cat input.json | uv run main.py

      Or with custom options:

      cat input.json | uv run main.py -duration 30

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/python:3.11 \
sh -c 'pip install . > /dev/null && 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!