Exercises
Practice linear and integer programming.
Let’s solve some continuous and discrete linear optimization problems.
Exercise 1: Fractional knapsack
The fractional knapsack is the continuous version of the knapsack problem. In this version, we can get a fraction of the item. The value would be the same fraction of the item’s value and weight of the same fraction of the weight. For example, consider an item of value and a weight of kg. If we decide to take one-third of the item, then we get value from the object, and the weight added to the load will be kg. As in the knapsack problem, the constraint is not to load more than the maximum weight allowed and the goal is to get as much value as possible.
In this exercise, we have to solve the fractional version of the knapsack problem.
Get hands-on with 1400+ tech skills courses.