solving linear programand knapsack problem in matlab

15
SOLVING LINEAR PROGRAM AND KNAPSACK PROBLEM IN MATLAB 1. Revised Simplex Method: RSM, BigM 2. MATLAB LP Solver: linprog 3. Unbounded Knapsack Problem: uknap

Upload: others

Post on 18-Dec-2021

26 views

Category:

Documents


0 download

TRANSCRIPT

SOLVING LINEAR PROGRAM AND KNAPSACK PROBLEM IN MATLAB

1. Revised Simplex Method: RSM, BigM

2. MATLAB LP Solver: linprog

3. Unbounded Knapsack Problem: uknap

Use a function in MATLAB

• [output1, output2, …] = function(input1, input2, …)

• Example 1:

• Example 2:

Revised Simplex Method: RSM.m

• Standard form:

• Usage:

• Initial BFS is needed.

RSM.m: Example

• Problem:

• Input (standard form):

RSM.m: Example (cont.)

• Result:

Big-M method: BigM.m

• Standard form: Big-M:

• Usage:

• No initial BFS is needed.

• An appropriate M is needed.

BigM.m: Example

• Problem:

• Input:

BigM.m: Example (cont.)

• Result:

BigM.m: Example (cont.)

• Use a larger M.

• Result:

MATLAB built-in solver: linprog.m

• Problem:

• Usage:

• Algorithms: large-scale, active-set, simplex

• Output: optimal solution/value, terminating reason, dual variables…

linprog.m: Example

• Problem:

• Input:

• No Aeq/beq: use []

linprog.m: Example (cont.)

• Result:

Unbounded Knapsack problem

• Auxiliary problem in column generation method for cutting-stock problem.

• General form:

• A branch-and-bound algorithm:

• MATLAB implementation: uknap

• Usage:

uknap.m: Example

• Problem:

• Input: Result:

Branch-and-bound algorithm

• Efficiency p_i / w_i in decreasing order

• Start from

• Enumeration trees

• Enumerating

• Pruning