|
1 | | -@testset "Simplex" begin |
| 1 | +@testset "Simplex" verbose = true begin |
2 | 2 |
|
3 | | - @testset "Gauss Jordan" begin |
| 3 | + @testset "Gauss Jordan" verbose=true begin |
4 | 4 |
|
5 | | - m = Float64[1.0 2 7; -1 6 5; 9 8 -3] |
| 5 | + @testset "3x3 matrix" begin |
6 | 6 |
|
7 | | - expected = [ |
8 | | - 0.142157 -0.151961 0.0784314; |
9 | | - -0.102941 0.161765 0.0294118; |
10 | | - 0.151961 -0.0245098 -0.0196078 |
11 | | - ] |
| 7 | + m = Float64[1.0 2 7; -1 6 5; 9 8 -3] |
| 8 | + |
| 9 | + expected = [ |
| 10 | + 0.142157 -0.151961 0.0784314; |
| 11 | + -0.102941 0.161765 0.0294118; |
| 12 | + 0.151961 -0.0245098 -0.0196078 |
| 13 | + ] |
| 14 | + |
| 15 | + result = gaussjordan(m, verbose=false) |
| 16 | + |
| 17 | + @test isapprox(result, expected, atol=0.0001) |
| 18 | + |
| 19 | + end |
| 20 | + |
| 21 | + @testset "4x4 matrix" begin |
| 22 | + |
| 23 | + m = Float64[1 6 7 4; 5 4 3 2; 3 4 5 1; 5 5 7 5] |
| 24 | + |
| 25 | + expected = [ |
| 26 | + -0.196429 0.0892857 0.0714286 0.107143; |
| 27 | + 0.309524 0.404762 -0.142857 -0.380952; |
| 28 | + -0.14881 -0.386905 0.357143 0.202381; |
| 29 | + 0.0952381 0.047619 -0.428571 0.190476 |
| 30 | + ] |
| 31 | + |
| 32 | + result = gaussjordan(m, verbose=false) |
| 33 | + |
| 34 | + @test isapprox(result, expected, atol=0.0001) |
| 35 | + end |
| 36 | + end |
12 | 37 |
|
13 | | - result = gaussjordan(m, verbose = false) |
14 | 38 |
|
15 | | - @test isapprox(result, expected, atol = 0.0001) |
16 | | - end |
17 | 39 |
|
18 | 40 | @testset "Maximization Problem" begin |
19 | 41 |
|
|
93 | 115 |
|
94 | 116 |
|
95 | 117 |
|
96 | | - @testset "Mini Transportation Problem" begin |
| 118 | + @testset "Mini Transportation Problem" begin |
97 | 119 |
|
98 | 120 | eps = 0.001 |
99 | 121 | # Mini Transportation Problem |
|
123 | 145 | @test isapprox(lastiter.objective_value, 3400.0, atol=eps) |
124 | 146 | @test sort(lastiter.basicvariableindex) == [1, 2, 3, 6, 11] |
125 | 147 | @test sort(lastiter.artificialvariableindices) == [7, 8, 9, 10, 11] |
126 | | - @test isapprox(lastiter.rhs, [10.0, 100.0, 110.0, 80.0, 0.0], atol = eps) |
127 | | - end |
| 148 | + @test isapprox(lastiter.rhs, [10.0, 100.0, 110.0, 80.0, 0.0], atol=eps) |
| 149 | + end |
128 | 150 |
|
129 | 151 |
|
130 | 152 |
|
|
0 commit comments