# Python Class Assignment Template

This is a template for a Nextmv application that solves a school class
assignment problem using mixed-integer programming (MIP) with Pyomo. It has the
following characteristics:

* Type: Python
* Content format: `multi-file`. Input files are read from disk and
  output files are written to disk.

This is the basic structure:

```text
├── app.yaml
├── main.py
├── pyproject.toml
├── README.md
├── uv.lock
└── visualizations.py
```

* `app.yaml`: App manifest, containing the configuration to run the app with Nextmv.
* `main.py`: Entrypoint for the app. Loads input data, solves the assignment
  problem, and writes the output.
* `pyproject.toml`: Python project configuration.
* `README.md`: Description of the app.
* `uv.lock`: Lockfile for the Python dependencies. This file is generated by
  `uv` and should not be edited manually.
* `visualizations.py`: Generates visual assets from the solution.

A sample input file is also provided as `inputs/input.json`. It contains
students (with preferences, priority, class level, and optional extended-day
requests) and classes to assign them to.

1. Sync the project.

    With `uv`

    ```bash
    uv sync
    ```

    With `pip`

    ```bash
    pip install .
    ```

2. Run the app. Options can be omitted and will default to the values specified
   in `app.yaml`.

    With `uv`

    ```bash
    uv run main.py \
        --duration 30 \
        --solver highs \
        --extended_day_time 17 \
        --extended_day_bonus 2.0 \
        --extended_day_penalty 0.5
    ```

    With `python`

    ```bash
    python main.py \
        --duration 30 \
        --solver highs \
        --extended_day_time 17 \
        --extended_day_bonus 2.0 \
        --extended_day_penalty 0.5
    ```
