Solving Integer Problems with CVXPY

Learn to solve the famous knapsack problem using integer programming with CVXPY.

We'll cover the following

We already know how to define an integer problem mathematically. In this lesson, we’ll solve an integer problem using cvxpy. Let’s find out what the problem is about.

The knapsack problem

The salesman is moving from one city to another. Unfortunately, he can’t carry all his possessions. He has a knapsack that can carry up to ww kilograms, so he can’t load more than that weight. The salesman has a list of all the items he has with the weight and value of each item. He has to try to decide what items to carry with him, so he gets the maximum possible value without exceeding the weight that the knapsack can load.

Get hands-on with 1200+ tech skills courses.