Download - Tugas PO V
8/3/2019 Tugas PO V
http://slidepdf.com/reader/full/tugas-po-v 1/5
Fajar Munichputranto
F34090011
Research Operation
INTEGER PROGRAMMING
1. Formulation:
Maximize 12X1+5X2+15X3 with constrains:
a. 5X1+X2+9X3 ≤ 1500
b. 2X1+3X2+4X3 ≤ 1000
c. 3X1+2X2+5X3 ≤ 800
d. X1 ≥ 40
e. X2 ≥ 130
f. X3 ≥ 30
Using LpSolve software:
TITLE lp
! Objective function
MAXIMIZE
+12 x1 +5 x2 +15 x3
! Constraints
SUBJECT TO
C1) +5 x1 +1 x2 +9 x3 <= 1500
+2 x1 +3 x2 +4 x3 <= 1000
+3 x1 +2 x2 +5 x3 <= 800
C2) x1 >= 40
x2 >= 130
x3 >= 30
END
! Integer definitions
GIN x1
GIN x2
GIN x3
8/3/2019 Tugas PO V
http://slidepdf.com/reader/full/tugas-po-v 2/5
Fajar Munichputranto
F34090011
Research Operation
Result in cmd.exe:
Using Java Programming with Netbeans IDE :
Using CommonMath and LpSolve library.
Coding:
/**
*
* @author Munichputranto
*/import lpsolve.*;
public class Solve2 {
public static void main(String[] args) {
try {
LpSolve solver = LpSolve.makeLp(0,3);
solver.strAddConstraint("5 1 9", LpSolve.LE,
1500);
solver.strAddConstraint("2 3 4", LpSolve.LE,
1000);
8/3/2019 Tugas PO V
http://slidepdf.com/reader/full/tugas-po-v 3/5
Fajar Munichputranto
F34090011
Research Operationsolver.strAddConstraint("3 2 5", LpSolve.LE, 800);
solver.strSetObjFn("12 5 15");
solver.solve();
System.out.println("Nilai dari fungsi objektif: "
+ solver.getObjective());
double[] var=solver.getPtrVariables();
for (int i =0;i<var.length;i++) {
System.out.println("Nilai dari variabel["+i+"]="
+var[i]);
}
solver.deleteLp();
}
catch (LpSolveException e) {e.printStackTrace();
}
}
}
Result of running in 32-bit processor:
8/3/2019 Tugas PO V
http://slidepdf.com/reader/full/tugas-po-v 4/5
Fajar Munichputranto
F34090011
Research Operation
2. Solve this goal programming problem below:
Minimize z = d1+
+ d2-
Subject to:2x1+3x2 ≤ 640
x1+ d1-- d1
+= 200
x2+d2-- d2
+= 120
x1, x2 ≥ 0
d1+, d1
-, d2
+, d2
- ≥ 0
Using LINGO software:
MIN d1p+d2n
SUBJECT TO
2x1+3x2 <= 640
x1+ d1n - d1p = 200
x2+ d2n - d2p = 120
x1 >= 0
x2 >= 0
d1p >= 0
d1n >= 0
d2p >= 0
d2n >= 0
END
Result:
Global optimal solution found.
Objective value: 0.000000
Infeasibilities: 0.000000
Total solver iterations: 0
Model Class: LP
Total variables: 6Nonlinear variables: 0
Integer variables: 0
Total constraints: 10
Nonlinear constraints: 0
Total nonzeros: 16
Nonlinear nonzeros: 0
Variable Value Reduced
Cost
D1P 0.000000 1.000000
8/3/2019 Tugas PO V
http://slidepdf.com/reader/full/tugas-po-v 5/5
Fajar Munichputranto
F34090011
Research OperationD2N 0.000000
1.000000
X1 0.000000
0.000000
X2 213.3333
0.000000
D1N 200.0000 0.000000
D2P 93.33333
0.000000
Row Slack or Surplus Dual
Price
1 0.000000 -
1.000000
2 0.000000
0.000000
3 0.000000
0.000000
4 0.0000000.000000
5 0.000000
0.000000
6 213.3333
0.000000
7 0.000000
0.000000
8 200.0000
0.000000
9 93.33333
0.000000
10 0.000000
0.000000