logo

... cvxpy one.


There's loads of usecases in logistics where you'd like to optimise a system while being subjected to constraints. In this series of videos we'd like to highlight a tool that can handle a subset of these problems called cvxpy.


Notes

You can download the dataset here.

You can also pull it locally by running this on the terminal;

wget https://calmcode.io/datasets/stigler.csv

You need to install some tools before starting your notebook.

pip install cvxpy pandas

The notebook in this video contains the following code;

import cvxpy as cp
import pandas as pd

df = pd.read_csv("/path/to/stigler.csv")
price = df['price_cents'].values

x = cp.Variable(price.shape[0])
objective = cp.Minimize(cp.sum(price*x))
prob = cp.Problem(objective)
prob.solve()

Feedback? See an issue? Something unclear? Feel free to mention it here.

If you want to be kept up to date, consider getting the newsletter.