Skip to content
Ariel Luján Giamportone

← Projects

Open package 08/2025 · Autor único

Simplex vs ML in operations research

Optimising and predicting answer different questions. A fishing-fleet model to see what the simplex decides, what limits each plan and where prediction comes in.

AI and data science

Repository ↗

  • 91 → 99.8 %of the optimum reached when deciding with ML-estimated yields instead of nominal ones
  • 38 → 93 %scenarios where the decision is the optimal one
  • 0.89 / 0.97R² of the best model against the ceiling of the formula that generated the data
  • 45cases of the demo solver checked against SciPy (HiGHS)

Try it: plan the fleet and see what limits it

The model coefficients are the repository's and are for teaching, not real data from any fleet.

The repository's teaching model: choose how many boats of each type to send out, given the fuel, crew and fleet available. Everything is computed in your browser, exactly (by enumerating the vertices of the feasible region), and checked against SciPy in the site's tests.

Resources available

Each boat type

ProfitFuelCrew
Type 1
Type 2
Type 3

This is where prediction enters: if the profit of a boat type depends on the weather or the price, a model can estimate it, and the optimisation decides with that estimate.

The idea

The repository supports a class on how operations research has changed since Dantzig published the simplex method in 1947: from solving well-defined linear problems to working with abundant data, uncertainty and models that learn. The common thread is a fishing case: how many boats of each type should go out given the fuel, crew and fleet available.

What the demo shows

  • The optimal solution and why it is optimal. The bars show which resource runs out and which is spare. The binding resource is the one that matters.
  • The value of one more unit of each resource (the shadow price). If one more litre of fuel does not raise the profit, buying fuel is not the answer.
  • Alternative optima. In the repository’s model, types 1 and 2 yield exactly the same per litre, so several plans tie: a sign that the model needs more information to decide.
  • Whole boats. The simplex returns fractions; requiring whole boats can cost profit, and the demo quantifies it.
  • Where machine learning comes in. The simplex does not get captures right or wrong: it decides with the coefficients it is given. Prediction is useful upstream, to estimate them when they depend on the weather or the price. The control for the expected yield of type 3 shows the point at which that estimate changes the decision.

What the analysis shows

The repository’s analysis separates three questions on a synthetic world in which wind affects each boat type differently:

  • Deciding. Linear programming gives the optimal plan (20, 6 and 10 small, medium and large boats, 3,720 kg), says what binds (the crew: 24 kg per extra person) and what is spare (fuel and budget). It is judged on that, not on R².
  • Predicting. For total catch, gradient boosting reaches an R² of 0.89 against 0.79 for a linear regression and −0.003 for the mean, with a ceiling of 0.97: the true formula without noise. No model exceeds it; a high R² on synthetic data only says the model recovers the formula.
  • Predict, then optimise. Deciding with nominal yields reaches 91 % of the optimum on average and finds the best decision in 38 % of the scenarios. With yields estimated by ML from the weather it rises to 99.7–99.8 % and 90–93 %. And a linear regression does almost as well as gradient boosting: deciding well does not require the most accurate model.

This version of the material corrects an earlier one that put the simplex and the ML models in the same accuracy table. The figures come from running the scripts (seed 42) and nine tests check them in CI with both the minimum and the latest dependency versions. The material itself is in Spanish.

Technologies

  • Python
  • Streamlit
  • Plotly
  • SciPy