@@ -4,56 +4,56 @@ Simplex Method Implementation in Java
4
4
Suppose, we have:
5
5
Maximize Z = 40x1 + 30x2 <br />
6
6
Subject to: <br />
7
- x1 + x2 ≤ 12
8
- 2x1 + x2 ≤ 16
9
- x1≥0; x2≥0
7
+ x1 + x2 ≤ 12 < br />
8
+ 2x1 + x2 ≤ 16 < br />
9
+ x1≥0; x2≥0 < br />
10
10
11
- Then, After running the simplex_method.java file, Enter values in console as:
12
-
13
- Choose Problem Type:
14
- 1) Maximization Problem
15
- 2) Minimization Problem
16
- Enter chosen type: 1
17
- Enter No. of variables: 2
18
- Enter No. of constraints: 2
19
- Enter coefficients of Objective Function:
20
- Enter the value of x1: 40
21
- Enter the value of x2: 30
22
- Enter LHS coefficients of constraints(1) :
23
- Enter the value of x1: 1
24
- Enter the value of x2: 1
25
- Choose Inequality option:
26
- 1) ≤
27
- 2) ≥
28
- 3) =
29
- Enter chosen option: 1
30
- Enter RHS coefficient of constraints(1) : 12
31
- Enter LHS coefficients of constraints(2) :
32
- Enter the value of x1: 2
33
- Enter the value of x2: 1
34
- Choose Inequality option:
35
- 1) ≤
36
- 2) ≥
37
- 3) =
38
- Enter chosen option: 1
39
- Enter RHS coefficient of constraints(2) : 16
40
-
41
- *********** * Iteration - 1 *********** *
42
- Incoming Variable is: x1
43
- Outgoing Variable is: s2
44
-
45
- *********** * Iteration - 2 *********** *
46
- Incoming Variable is: x2
47
- Outgoing Variable is: s1
48
-
49
-
50
- Final table: [[ 1.0, 0.0, 0.0, 20.0, 10.0, 400.0] , [ 0.0, 0.0, 1.0, 2.0, -1.0, 8.0] , [ 0.0, 1.0, 0.0, -1.0, 1.0, 4.0]]
51
-
52
- ************** * Optimal Solution: ******************** *
53
- The value of x1 is: 4.0
54
- The value of x2 is: 8.0
55
- The value of s1 is: 0
56
- The value of s2 is: 0
57
- The value of Z_max is: 400.0
58
-
59
- Process finished with exit code 0
11
+ If you want to solve this problem then, simply run the simplex_method.java code and enter values in console as: < br />
12
+
13
+ Choose Problem Type: < br />
14
+ 1) Maximization Problem < br />
15
+ 2) Minimization Problem < br />
16
+ Enter chosen type: 1 < br />
17
+ Enter No. of variables: 2 < br />
18
+ Enter No. of constraints: 2 < br />
19
+ Enter coefficients of Objective Function: < br />
20
+ Enter the value of x1: 40 < br />
21
+ Enter the value of x2: 30 < br />
22
+ Enter LHS coefficients of constraints(1) : < br />
23
+ Enter the value of x1: 1 < br />
24
+ Enter the value of x2: 1 < br />
25
+ Choose Inequality option: < br />
26
+ 1) ≤ < br />
27
+ 2) ≥ < br />
28
+ 3) = < br />
29
+ Enter chosen option: 1 < br />
30
+ Enter RHS coefficient of constraints(1) : 12 < br />
31
+ Enter LHS coefficients of constraints(2) : < br />
32
+ Enter the value of x1: 2 < br />
33
+ Enter the value of x2: 1 < br />
34
+ Choose Inequality option: < br />
35
+ 1) ≤ < br />
36
+ 2) ≥ < br />
37
+ 3) = < br />
38
+ Enter chosen option: 1 < br />
39
+ Enter RHS coefficient of constraints(2) : 16 < br />
40
+
41
+ *********** * Iteration - 1 *********** * < br />
42
+ Incoming Variable is: x1 < br />
43
+ Outgoing Variable is: s2 < br />
44
+
45
+ *********** * Iteration - 2 *********** * < br />
46
+ Incoming Variable is: x2 < br />
47
+ Outgoing Variable is: s1 < br />
48
+
49
+
50
+ Final table: [[ 1.0, 0.0, 0.0, 20.0, 10.0, 400.0] , [ 0.0, 0.0, 1.0, 2.0, -1.0, 8.0] , [ 0.0, 1.0, 0.0, -1.0, 1.0, 4.0]] < br />
51
+
52
+ ************** * Optimal Solution: ******************** * < br />
53
+ The value of x1 is: 4.0 < br />
54
+ The value of x2 is: 8.0 < br />
55
+ The value of s1 is: 0 < br />
56
+ The value of s2 is: 0 < br />
57
+ The value of Z_max is: 400.0 < br />
58
+
59
+ Process finished with exit code 0 < br />
0 commit comments