

0 / 2 embers
0 / 3000 xp
click for more info
Complete a lesson to start your streak
click for more info
Difficulty: 7
click for more info
Not enough gems
Cost: 6 gems
1: Linear Programming
incomplete
2: Profit Function
incomplete
3: Contour Lines
incomplete
4: Simplex Algorithm
incomplete
5: Simplex Algorithm for Solving LP Problems
incomplete
6: Tableau Review
incomplete
7: Simplex Tableau – Slack Variables
incomplete
8: Simplex Tableau – Slack Variables
incomplete
9: Simplex Tableau – Basic Variables and the Solution
incomplete
10: Tableau Solution
incomplete
11: Pivoting the Tableau – When to Stop
incomplete
12: Finding the Pivot Column
incomplete
13: Finding the Pivot Row
incomplete
14: Pivot Row Review
incomplete
15: The Pivot Operation
incomplete
16: Pivot Review
incomplete
17: Solving the Whole Simplex
incomplete
Back
ctrl+,
Next
ctrl+.
This lesson's interactive features are locked, please to keep using them
Let's add a method to our class to get the current solution from the state of the tableau. Remember, this isn't the final solution; it's just the solution of the current tableau, which we'll update in the next assignments.
Complete the get_solution_from_tableau method. It should return a tuple containing 1) a list of numbers that represent the current values of each variable in column order, including slack variables, and 2) the current value of the profit variable.
For example, this tableau, with self.basis set to [2, 3, 4]:
[1.0, 0.0, 1.0, 0.0, 0.0, 250.0]
[0.0, 1.0, 0.0, 1.0, 0.0, 200.0]
[1.0, 1.0, 0.0, 0.0, 1.0, 300.0]
[-5.0, -1.0, 0.0, 0.0, 0.0, 0.0]
Would return the following tuple:
([0, 0, 250.0, 200.0, 300.0], 0.0)