Skip to content

Files

Latest commit

 

History

History

python-hexaly-knapsack

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Nextmv Python Hexaly Knapsack

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

If you have a Hexaly license, remove the .template extension from the license.dat.template file and replace the contents with your actual license key. Modify the app.yaml file to include the license.dat in the files list.

  1. Install packages.

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

    python3 main.py -input input.json -output output.json -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/hexaly: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!