範例四:生產管理應用例(Production
Management)
LINDO 為 Linear, INteractive, Discrete Optimizer 之縮寫,
在 DOS prompt 之下輸入 lindo 即可進入 LINDO 軟體。
C:\LINDO>lindo <-- [使用者輸入]
LINDO/PC (9 FEB 89)
COPYRIGHT (C) 1989 LINDO SYSTEMS, INC. PORTIONS
COPYRIGHT (C) 1981 MICROSOFT CORPORATION. LICENSED
MATERIAL, ALL RIGHTS RESERVED. COPYING EXCEPT AS
AUTHORIZED IN LICENSE AGREEMENT IS PROHIBITED.
STUDENT VERSION - FOR ACADEMIC USE ONLY
:help <-- [使用者輸入]
THIS IS LINDO (LINEAR, INTERACTIVE, DISCRETE OPTIMIZER),
COPYRIGHT (C) 1989 LINDO SYSTEMS. LINDO IS LICENSED
MATERIAL WITH ALL RIGHTS RESERVED. COPYING EXCEPT AS
AUTHORIZED IN LICENSE AGREEMENT IS PROHIBITED.
LINDO SOLVES LINEAR, INTEGER, AND QUADRATIC PROGRAMS ENTERED
IN NATURAL FORM. THE FOLLOWING WOULD BE VALID INPUT:
MAX 2X + 3Y
ST 小的模式,可如此建立
4X + 5Y < 9
7X + 6Y < 13
END
GO
TO LEARN THE AVAILABLE COMMANDS TYPE "COMMANDS". TO GET
HELP FOR A PARTICULAR COMMAND, TYPE "HELP name" WHERE "name"
IS THE COMMAND NAME. FOR MORE HELP ON ENTERING A
FORMULATION, TYPE "HELP MAX".
TO GET OUT OF A COMMAND WHICH IS PROMPTING FOR INPUT, TYPE
EITHER "END" OR SIMPLY A CARRIAGE RETURN. YOU WILL RETURN
TO COMMAND MODE. SEE SPECIFIC COMMANDS FOR THE EFFECT IF
ANY, ON PROCESSING DONE BY THAT COMMAND.
MAXIMUM SIZE OF INPUTS ARE:
INPUT MAX. SIZE
-------------------------------
NONZEROES 3000
COLUMNS 120
ROWS 60
INTEGER VARIABLES 100
VAR/ROW NAME CHARACTERS 8
LARGER VERSIONS ARE AVAILABLE.
: commands <-- [使用者輸入]
LINDO COMMANDS BY CATEGORY. FOR INFORMATION
ON A SPECIFIC COMMAND, TYPE "HELP" FOLLOWED
BY THE COMMAND NAME.
1)INFORMATION
HELP COM LOCAL CAT
2)INPUT
MAX MIN RETR RMPS TAKE LEAV RDBC
3)DISPLAY
PIC TABL LOOK NONZ SHOC SOLU RANGE BPIC
CPRI RPRI
4)FILE OUTPUT
SAVE DIVE RVRT SMPS SDBC
5)SOLUTION
GO PIV
6)PROBLEM EDITING
ALT EXT DEL SUB APPC SLB FREE
7)QUIT
8)INTEGER, QUADRATIC, AND PARAMETRIC PROGRAMS
INT QCP PARA POSD TITAN BIP GIN IPTOL
9)CONVERSATIONAL PARAMETERS
WIDTH TERS VERB BAT PAGE PAUS
10)USER SUPPLIED ROUTINES
USER
11)MISCELLANEOUS
INV STAT BUG DEB SET
: take test1.dat <-- [使用者輸入]
:! A staff scheduling model.
:! Type "TAKE TEST1.DAT" to read this model into LINDO.
:!
: MIN 130 X12M + 120 X4A + 100 X8A + 110 X12N + 120 X4P + 130 X8P
: - YALL
: SUBJECT TO
: 2) X12M + X8P - Y12M >= 3
: 3) X12M + X4A - Y4A >= 5
: 4) X4A + X8A - Y8A >= 6
: 5) X8A + X12N - Y12M >= 5
: 6) X12N + X4P - Y4P >= 6
: 7) X4P + X8P - Y8P >= 3
: 8) Y12M <= 1
: 9) Y4A <= 1
: 10) Y8A <= 1
: 11) Y12N <= 1
: 12) Y4P <= 1
: 13) Y8P <= 1
: 14) - YALL + 37.92 Y12M + 48.96 Y4A + 84.96 Y8A + 84.96 Y4P
: + 37.92 Y8P + 48.96 Y12N = 0
: END
:! Type "GO" to solve the model. The objective value should be 1614.16
: BAT
:go <-- [使用者輸入]
LP OPTIMUM FOUND AT STEP 9
OBJECTIVE FUNCTION VALUE
1) 1614.16000
VARIABLE VALUE REDUCED COST
X12M 3.000000 .000000
X4A 3.000000 .000000
X8A 3.000000 .000000
X12N 2.000000 .000000
X4P 4.000000 .000000
X8P .000000 10.000000
YALL 135.840000 .000000
Y12M .000000 72.080000
Y4A 1.000000 .000000
Y8A .000000 .000000
Y4P .000000 10.000000
Y8P 1.000000 .000000
Y12N 1.000000 .000000
ROW SLACK OR SURPLUS DUAL PRICES
2) .000000 -94.960000
3) .000000 -35.040000
4) .000000 -84.960000
5) .000000 -15.040000
6) .000000 -94.960000
7) .000000 -25.040000
8) 1.000000 .000000
9) .000000 13.920000
10) 1.000000 .000000
11) .000000 48.960000
12) 1.000000 .000000
13) .000000 12.880000
14) .000000 -1.000000
NO. ITERATIONS= 9
DO RANGE(SENSITIVITY) ANALYSIS?
? Y <-- [使用者輸入]
RANGES IN WHICH THE BASIS IS UNCHANGED:
OBJ COEFFICIENT RANGES
VARIABLE CURRENT ALLOWABLE ALLOWABLE
COEF INCREASE DECREASE
X12M 130.000000 10.000000 72.080000
X4A 120.000000 13.920000 10.000000
X8A 100.000000 10.000000 15.040000
X12N 110.000000 25.040000 10.000000
X4P 120.000000 10.000000 25.040000
X8P 130.000000 INFINITY 10.000000
YALL -1.000000 .103943 .177024
Y12M .000000 INFINITY 72.080000
Y4A .000000 13.920000 INFINITY
Y8A .000000 10.000000 15.040000
Y4P .000000 INFINITY 10.000000
Y8P .000000 12.880000 INFINITY
Y12N .000000 48.960000 INFINITY
RIGHTHAND SIDE RANGES
ROW CURRENT ALLOWABLE ALLOWABLE
RHS INCREASE DECREASE
2 3.000000 .000000 1.000000
3 5.000000 1.000000 .000000
4 6.000000 .000000 1.000000
5 5.000000 1.000000 .000000
6 6.000000 .000000 1.000000
7 3.000000 1.000000 .000000
8 1.000000 INFINITY 1.000000
9 1.000000 1.000000 .000000
10 1.000000 INFINITY 1.000000
11 1.000000 INFINITY 1.000000
12 1.000000 INFINITY 1.000000
13 1.000000 1.000000 .000000
14 .000000 135.840000 INFINITY
: take test4.dat <-- [使用者輸入]
:! A small but tough integer programming model. Type "TAKE TEST4.DAT"
:! to read this problem into LINDO.
: MAX 77 X1 + 6 X2 + 3 X3 + 6 X4 + 33 X5 + 13 X6 + 110 X7 + 21 X8
: + 47 X9
: SUBJECT TO
: 2) 774 X1 + 76 X2 + 22 X3 + 42 X4 + 21 X5 + 760 X6
: + 818 X7 + 62 X8 + 785 X9 <= 1500
: 3) 67 X1 + 27 X2 + 794 X3 + 53 X4 + 234 X5 + 32 X6
: + 792 X7 + 97 X8 + 435 X9 <= 1500
: END
:
: INTEGER-VARIABLES= 9
:! Type "GO" to solve the model. The best integer solution should have
:! an objective value of 176. To print the best solution type "SOLU"
:! after optimization has finished.
: BAT
:
: go
LP OPTIMUM FOUND AT STEP 7
OBJECTIVE VALUE = 225.694600
FIX ALL VARS.( 5) WITH RC > 14.7382
SET X3 TO <= 0 AT 1, BND= 225.4 TWIN= -.1000E+31 12
SET X1 TO <= 0 AT 2, BND= 176.0 TWIN= -.1000E+31 16
NEW INTEGER SOLUTION OF 176.000000 AT BRANCH 2 PIVOT 16
OBJECTIVE FUNCTION VALUE
1) 176.000000
VARIABLE VALUE REDUCED COST
X1 .000000 -77.000000
X2 1.000000 -6.000000
X3 .000000 -3.000000
X4 1.000000 -6.000000
X5 1.000000 -33.000000
X6 .000000 -13.000000
X7 1.000000 -110.000000
X8 1.000000 -21.000000
X9 .000000 -47.000000
ROW SLACK OR SURPLUS DUAL PRICES
2) 481.000000 .000000
3) 297.000000 .000000
NO. ITERATIONS= 16
BRANCHES= 2 DETERM.= 1.000E 0
BOUND ON OPTIMUM: 210.9565
DELETE X1 AT LEVEL 2
DELETE X3 AT LEVEL 1
RELEASE FIXED VARIABLES
FIX ALL VARS.( 4) WITH RC > 13.1458
SET X3 TO <= 0 AT 1, BND= 210.6 TWIN= -.1000E+31 29
SET X1 TO <= 0 AT 2, BND= 155.0 TWIN= -.1000E+31 34
DELETE X1 AT LEVEL 2
DELETE X3 AT LEVEL 1
RELEASE FIXED VARIABLES
FIX ALL VARS.( 1) WITH RC > 31.1340
SET X7 TO >= 1 AT 1, BND= 195.0 TWIN= 176.0 51
SET X3 TO <= 0 AT 2, BND= 194.5 TWIN= -.1000E+31 57
SET X1 TO <= 0 AT 3, BND= 194.4 TWIN= -.1000E+31 60
SET X9 TO <= 0 AT 4, BND= 143.0 TWIN= -.1000E+31 67
DELETE X9 AT LEVEL 4
DELETE X1 AT LEVEL 3
DELETE X3 AT LEVEL 2
DELETE X7 AT LEVEL 1
ENUMERATION COMPLETE. BRANCHES= 8 PIVOTS= 67
LP OPTIMUM FOUND AT STEP 7
OBJECTIVE VALUE = 225.694600
FIX ALL VARS.( 5) WITH RC > 14.7382
NEW INTEGER SOLUTION OF 176.000000 AT BRANCH 2 PIVOT 16
OBJECTIVE FUNCTION VALUE
1) 176.000000
BOUND ON OPTIMUM: 210.9565
FIX ALL VARS.( 4) WITH RC > 13.1458
FIX ALL VARS.( 1) WITH RC > 31.1340
ENUMERATION COMPLETE. BRANCHES= 8 PIVOTS= 67
LAST INTEGER SOLUTION IS THE BEST FOUND
RE-INSTALLING BEST SOLUTION...
裝配製造業應用例
某公司生產三種產品之淨利如下:產品 A, B, C 分別為 8, 11, 9.5 元。 又,每一產品係由四種不同組件裝配而成,如下表所示:
組件 |
產品A |
B |
C |
總庫存量 |
P |
3 |
2 |
4 |
74 |
Q |
1 |
2 |
|
40 |
R |
2 |
|
3 |
50 |
S |
|
1 |
|
10 |
各組件之總庫存量亦如上表所示,求各產品應生產之件數,以得最大利潤。 Xa, Xb, Xc 分別代表 A, B, C 三樣產品之生產數量,稱之為 「決策變數」 decision variable.
*** Contents in LPADV0.dat ******
MODEL:
1) 3 * Xa+ 2* Xb+4*Xc < 74;
2) 1 * Xa+ 2 *Xb < 40;
3) 2 * Xa+ 3*Xc < 50;
4) Xb < 10;
5) MAX= 8 * Xa+ 11 * Xb + 9.5 * Xc;
END
(在 LINDO 中< 即表示 ≦)
SLB Xa .000000
SLB Xb .000000
SLB Xc .000000
*** Contents in LPADV0.rlt ******
SOLUTION STATUS: OPTIMAL TO TOLERANCES. DUAL CONDITIONS: SATISFIED.
OBJECTIVE FUNCTION VALUE
5) 254.000000
VARIABLE VALUE REDUCED COST ──>即Marginal
XA 18.000000 .000000 Cost
XB 10.000000 .000000
XC .000000 1.166667
ROW SLACK OR SURPLUS DUAL PRICE ──>即Marginal
1) .000000 2.666667 Value
2) 2.000000 .000000
3) 14.000000 .000000
4) .000000 5.666667
某公司生產兩種網球拍,一種為金屬網球拍,一種為玻璃纖維網球拍。生產工廠之工時分配為塑造部 600小時,裝配部 500小時,包裝部 400小時。每隻網球拍所需之工時及利潤如下表:
|
每隻網球拍在各部門所需之工時,小時 |
每隻網球拍之利潤 |
||
|
塑造部 |
裝配部 |
包裝部 |
|
金屬網球拍 |
0.2 |
0.2 |
0.1 |
30 元 |
玻璃纖維網球拍 |
0.3 |
0.1 |
0.1 |
25 元 |
為爭取最大利潤,兩種網球拍之產量各為若干 ?
各部門之工時如何安排最恰當 ?
M 代表金屬網球拍之產量, F 代表玻璃纖維網球拍之產量
*** Contents in LPADV1.dat ******
MODEL:
1) 0.2 * M + 0.3 * F < 600 ;
2) 0.2 * M + 0.1 * F < 500 ;
3) 0.1 * M + 0.1 * F < 400 ;
4) MAX= 30 * M + 35 * F ;
END
SLB M .000000
SLB F .000000
*** Contents in LPADV1.rlt ******
SOLUTION STATUS: OPTIMAL TO TOLERANCES. DUAL CONDITIONS: SATISFIED.
OBJECTIVE FUNCTION VALUE
4) 75057.305473
VARIABLE VALUE REDUCED COST
M 2498.567298 .000000
F 2.865330 .000000
ROW SLACK OR SURPLUS PRICE
1) .000000 .573066
2) .000000 149.426932
3) 149.856734 .000000
本例之答案為 M 2498.567298 金屬網球拍之產量
F 2.865330 玻璃纖維網球拍之產量
並非整數,在 LINDO 之模式中應再加上兩行指令:
GIN M 宣告 M 與 F 皆為 General INteger
GIN F 一般整數
★ 在 LINDO 中,INTeger 指令代表只為 0 或 1 之整數 ★
★ 在 LINDO 中,INTeger 指令代表只為 0 或 1 之整數 ★
LP 問題並不規定其解為整數,
若強制要求其解為整數,則屬 IP(Integer Programming,或稱 ILP)問題。
若可求得最佳解,則各變數之相關 REDUCED COST 之值應為 0.
請參考以下 LINDO 範例(有※之處)
: take example1.dat
: look all
MAX 20 A + 30 C
SUBJECT TO
2) A <= 60
3) C <= 50
4) A + 2 C <= 60
END
: go
OBJECTIVE FUNCTION VALUE 1) 1200.00000 VARIABLE VALUE REDUCED COST A 60.000000 .000000 ※ C .000000 .000000 ※ ROW SLACK OR SURPLUS DUAL PRICES 2) .000000 5.000000 3) 50.000000 .000000 4) .000000 15.000000 |
續前例
: alter 4 rhs / 更改模式中第4式之 rhs 之值(第1式為目標函數)
NEW COEFFICIENT: / LINDO 之回應訊息
? 59 / 輸入新值
: look all
MAX 20 A + 30 C
SUBJECT TO
2) A <= 60
3) C <= 50
4) A + 2 C <= 59 ***
END
: go
OBJECTIVE FUNCTION VALUE 1) 1180.00000 VARIABLE VALUE REDUCED COST A 59.000000 .000000 C .000000 10.000000 ※ ROW SLACK OR SURPLUS DUAL PRICES 2) 1.000000 .000000 3) 50.000000 .000000 4) .000000 20.000000 |
變數 C 之最佳解為 0,相當於此變數為 unused,此時其 reduced cost 可能為 > 0 之數,如上※所示。在此情況下,reduced cost 所代表的意義為:
若將 C 之值設為 1 而非如 LINDO 所建議之 0,則其 O.F.V. 將會減少 10 (該變數之 reduced cost 值)。茲以下例說明:
***** about REDUCED COST example 1 *****
: look all
MAX 20 A + 30 C
SUBJECT TO
2) A <= 60
3) C <= 50
4) A + 2 C <= 59
END
: alter 3 dir
NEW DIRECTION:
? =
: alter 3 rhs
NEW COEFFICIENT:
? 1
: look all
MAX 20 A + 30 C
SUBJECT TO
2) A <= 60
3) C = 1 ※※ 更改後之新限制式
4) A + 2 C <= 59
END
: go
OBJECTIVE FUNCTION VALUE 1) 1170.00000 VARIABLE VALUE REDUCED COST A 57.000000 .000000 C 1.000000 .000000 ROW SLACK OR SURPLUS DUAL PRICES 2) 3.000000 .000000 3) .000000 -10.000000 4) .000000 20.000000 |
|
MAX 20 A + 30 C
SUBJECT TO
2) A <= 60
3) C <= 50
4) A + 2 C <= 59 *****
END
: go
OBJECTIVE FUNCTION VALUE 1) 1180.00000 VARIABLE VALUE REDUCED COST A 59.000000 .000000 C .000000 10.000000 ROW SLACK OR SURPLUS DUAL PRICES 2) 1.000000 .000000 3) 50.000000 .000000 4) .000000 20.000000 |
※ |
變數 C 之最佳解為 0,相當於此變數為 unused,此時其 reduced cost 可能為 > 0 之數,如上※所示。在此情況下,reduced cost 所代表的另一意義為:
若 O.F. 中’變數 C 之 profitability(即該變數之係數)若能增加 10’(該變數之 reduced cost 之值),則可抵消’將 C 之值設為 1’ 而非如 LINDO 所建議之 0所產生之影響。茲以下例說明:
: alter 1 c
NEW COEFFICIENT:
? 40 / 原為 30,加 10 後,新值為 40
: look all
MAX 20 A + 40 C ※※ 更改後之新目標函式
SUBJECT TO
2) A <= 60
3) C = 1
4) A + 2 C <= 59
END
: go
OBJECTIVE FUNCTION VALUE 1) 1180.00000 VARIABLE VALUE REDUCED COST A 57.000000 .000000 C 1.000000 .000000 ROW SLACK OR SURPLUS DUAL PRICES 2) 3.000000 .000000 3) .000000 .000000 4) .000000 20.000000 |
※ O.F.V. 果然沒變 |
ALLOWABLE DECREASE/INCREASE 出現於 LINDO 之RANGE(SENSITIVITY) ANALYSIS 部份。ALLOWABLE DECREASE 代表在不影響模式之「基底」之情況下該變數之係數所允許之減少量。
MAX 20 A + 30 C
SUBJECT TO
2) A <= 60 基本範例
3) C <= 50
4) A + 2 C <= 60
END
: go
OBJECTIVE FUNCTION VALUE 1) 1200.00000 VARIABLE VALUE REDUCED COST A 60.000000 .000000 C .000000 .000000 ROW SLACK OR SURPLUS DUAL PRICES 2) .000000 5.000000 3) 50.000000 .000000 4) .000000 15.000000 |
原基底 * * * |
DO RANGE(SENSITIVITY) ANALYSIS?
? y
RANGES IN WHICH THE BASIS IS UNCHANGED:
OBJ COEFFICIENT RANGES
VARIABLE CURRENT ALLOWABLE ALLOWABLE ※
COEF INCREASE DECREASE ※
A 20.000000 INFINITY 5.000000
C 30.000000 10.000000 30.000000
RIGHTHAND SIDE RANGES
ROW CURRENT ALLOWABLE ALLOWABLE
RHS INCREASE DECREASE
2 60.000000 .000000 60.000000
3 50.000000 INFINITY 50.000000
4 60.000000 100.000000 .000000
超過允許範圍之範例
本例中故意更改變數 A 之係數(使低於允許之範圍)
: alter 1 A
NEW COEFFICIENT:
? 14 <---- 允許之最低值為 20 - 5 = 15
: look 1
MAX 14 A + 30 C
: go
OBJECTIVE FUNCTION VALUE 1) 900.000000 VARIABLE VALUE REDUCED COST A .000000 1.000000 C 30.000000 .000000 ROW SLACK OR SURPLUS DUAL PRICES 2) 60.000000 .000000 3) 20.000000 .000000 4) .000000 15.000000 |
新基底 與原基底不符 * * * |
符合允許範圍之範例一
本例中更改變數 A 之係數(符合允許之範圍)
: alter 1 A
NEW COEFFICIENT:
? 15 ※ 允許之最低值為 20 - 5 = 15
: look all
MAX 15 A + 30 C
SUBJECT TO
2) A <= 60
3) C <= 50
4) A + 2 C <= 60
END
: go
OBJECTIVE FUNCTION VALUE 1) 900.000000 VARIABLE VALUE REDUCED COST A 60.000000 .000000 C .000000 .000000 ROW SLACK OR SURPLUS DUAL PRICES 2) .000000 .000000 3) 50.000000 .000000 4) .000000 15.000000 |
新基底 與原基底相同 * * |
符合允許範圍之範例二
本例中更改變數 C 之係數(符合允許之範圍)
: look 1
MAX 15 A + 30 C ※
: alter 1 c
NEW COEFFICIENT:
? 2
: look all
MAX 15 A + 2 C ※允許之最低值為 30 - 30 = 0
SUBJECT TO
2) A <= 60
3) C <= 50
4) A + 2 C <= 60
END
: go
OBJECTIVE FUNCTION VALUE 1) 900.000000 VARIABLE VALUE REDUCED COST A 60.000000 .000000 C .000000 .000000 ROW SLACK OR SURPLUS DUAL PRICES 2) .000000 14.000000 3) 50.000000 .000000 4) .000000 1.000000 |
新基底 與原基底相同 * * |
觀念:當 slack 與 dual prices 都為 0 時,極可能有另一組最佳解。
求另一組解之方法: 在 O.F. 中將另外其它變數之係數做一微小變動。
MAX 15 A + 30 C
SUBJECT TO
2) A <= 60
3) C <= 50 ß
4) A + 2 C <= 120
END
: go
OBJECTIVE FUNCTION VALUE
1) 1800.00000
VARIABLE VALUE REDUCED COST
A 20.000000 .000000
C 50.000000 .000000
ROW SLACK OR SURPLUS DUAL PRICES
2) 40.000000 .000000
3) .000000 .000000 ß
4) .000000 15.000000
求另一組解之方法: 在 O.F. 中將另外其它變數之係數做一微小變動。
茲以下例說明:
: alter 1 a
NEW COEFFICIENT:
? 15.00001 ※
: look 1
MAX 15.00001 A + 30 C ※
: go
OBJECTIVE FUNCTION VALUE
1) 1800.00100
VARIABLE VALUE REDUCED COST
A 60.000000 .000000
C 30.000000 .000000
ROW SLACK OR SURPLUS DUAL PRICES
2) .000000 .000010 <---
3) 20.000000 .000000
4) .000000 15.000000
注意:當此微小變動小於 0.00001(即 10 的 -5 次方),則模式中不會顯示此微小變動,但仍會納入計算。如下例之說明:
? alter 1 a
NEW COEFFICIENT:
? 15.000001 ※
: look 1
MAX 15 A + 30 C ※
: go
OBJECTIVE FUNCTION VALUE 1) 1800.00000 VARIABLE VALUE REDUCED COST A 60.000000 .000000 C 30.000000 .000000 ROW SLACK OR SURPLUS DUAL PRICES 2) .000000 .000001 3) 20.000000 .000000 4) .000000 15.000000 |
※ ※ |
DO RANGE(SENSITIVITY) ANALYSIS?
? y
RANGES IN WHICH THE BASIS IS UNCHANGED:
OBJ COEFFICIENT RANGES
VARIABLE CURRENT ALLOWABLE ALLOWABLE
COEF INCREASE DECREASE
A 15.000000 ☆ INFINITY .000001 ※
C 30.000000 .000002 30.000000
RIGHTHAND SIDE RANGES
ROW CURRENT ALLOWABLE ALLOWABLE
RHS INCREASE DECREASE
2 60.000000 60.000000 40.000000
3 50.000000 INFINITY 20.000000
4 120.000000 40.000000 60.000000
當 SLACK 為 0,且 dual prices 為 > 0 時,此 dual prices 代表之意義為:
當該 限制式之 rhs 之值少 1(限制更緊縮)或 多 1(限制放鬆),
則其 O.F.V. 會減少 或 增加 相當於該限制式之 dual prices 之量。
假設有一 LP 模式如下:
MAX 20 A + 30 C
SUBJECT TO
2) A <= 59 ※
3) C <= 50
4) A + 2 C <= 60 ※
END
: go
OBJECTIVE FUNCTION VALUE 1) 1195.00000 VARIABLE VALUE REDUCED COST A 59.000000 .000000 C .500000 .000000 ROW SLACK OR SURPLUS DUAL PRICES 2) .000000 5.000000 3) 49.500000 .000000 4) .000000 15.000000 |
※ ※ |
其它內容詳見基本範例一至四。
基本範例一、修改前述 LP 模式
: alter 4 rhs
NEW COEFFICIENT:
? 59
: look all
MAX 20 A + 30 C
SUBJECT TO
2) A <= 59
3) C <= 50
4) A + 2 C <= 59 ※
END
: go
OBJECTIVE FUNCTION VALUE
1) 1180.00000 ※ 1195 - 15
VARIABLE VALUE REDUCED COST
A 59.000000 .000000
C .000000 .000000
ROW SLACK OR SURPLUS DUAL PRICES
2) .000000 5.000000
3) 50.000000 .000000
4) .000000 15.000000
基本範例二、修改前述 LP 模式
: alter 4 rhs
NEW COEFFICIENT:
? 61
: look all
MAX 20 A + 30 C
SUBJECT TO
2) A <= 59
3) C <= 50
4) A + 2 C <= 61 ※
END
: go
OBJECTIVE FUNCTION VALUE
1) 1210.00000 ※ 1195 + 15
VARIABLE VALUE REDUCED COST
A 59.000000 .000000
C 1.000000 .000000
ROW SLACK OR SURPLUS DUAL PRICES
2) .000000 5.000000
3) 49.000000 .000000
4) .000000 15.000000
基本範例三、修改前述 LP 模式
: alter 2 rhs 58
NEW COEFFICIENT:
? 58
: look all
MAX 20 A + 30 C
SUBJECT TO
2) A <= 58 ※
3) C <= 50
4) A + 2 C <= 60
END
: go
OBJECTIVE FUNCTION VALUE
1) 1190.00000 ※ 1195 - 5
VARIABLE VALUE REDUCED COST
A 58.000000 .000000
C 1.000000 .000000
ROW SLACK OR SURPLUS DUAL PRICES
2) .000000 5.000000
3) 49.000000 .000000
4) .000000 15.000000
基本範例四、修改前述 LP 模式
: alter 2 rhs
NEW COEFFICIENT:
? 60
: look all
MAX 20 A + 30 C
SUBJECT TO
2) A <= 60 ※
3) C <= 50
4) A + 2 C <= 60
END
: go
OBJECTIVE FUNCTION VALUE
1) 1200.00000 ※ 1195 + 5
VARIABLE VALUE REDUCED COST
A 60.000000 .000000
C .000000 .000000
ROW SLACK OR SURPLUS DUAL PRICES
2) .000000 5.000000
3) 50.000000 .000000
4) .000000 15.000000