Skip to content

Commit 2410868

Browse files
committed
Added example
1 parent 57bfb73 commit 2410868

File tree

1 file changed

+12
-60
lines changed

1 file changed

+12
-60
lines changed

development/examples.jl

Lines changed: 12 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,5 @@
11
using SimplexTableaux
22

3-
"""
4-
example1()
5-
6-
Sample linear program from here: https://www.youtube.com/watch?v=rzRZLGD_aeE
7-
"""
8-
function example1()
9-
A = [3 5; 4 1]
10-
b = [78; 36]
11-
c = [5; 4]
12-
return Tableau(A, b, c)
13-
end
14-
15-
"""
16-
example2()
17-
18-
Sample linear program from here: https://www.youtube.com/watch?v=rzRZLGD_aeE
19-
"""
20-
function example2()
21-
A = [3 10 5; 5 2 8; 8 10 3]
22-
b = [120; 6; 105]
23-
c = [3; 4; 1]
24-
return Tableau(A, b, c)
25-
end
26-
27-
function example3()
28-
A = [1 1 3; 2 2 5; 4 1 2]
29-
b = [30; 24; 36]
30-
c = [3; 1; 1]
31-
return Tableau(A, b, c)
32-
end
33-
34-
function example4()
35-
A = [4 5; 8 5; 4 1]
36-
b = [60; 80; 20]
37-
c = [1; 1]
38-
return Tableau(A, b, c)
39-
end
40-
41-
function example5()
42-
A = [8 3; 1 1; 1 4]
43-
b = [24; 4; 12]
44-
c = [2; 1]
45-
return T = Tableau(A, b, c)
46-
end
47-
48-
function unbounded_example()
49-
A = [-1 0; 0 -1]
50-
b = [-1; -1]
51-
c = [1; 1]
52-
return Tableau(A, b, c)
53-
end
54-
55-
function random_example(n_vars::Int, n_cons::Int, modulus::Int=10)
56-
f(x::Int) = mod1(x, modulus)
57-
A = f.(rand(Int, n_cons, n_vars))
58-
b = f.(rand(Int, n_cons))
59-
c = f.(rand(Int, n_vars))
60-
return Tableau(A, b, c)
61-
end
62-
633
"""
644
dog_food()
655
@@ -92,4 +32,16 @@ function fishkind4()
9232
T = Tableau(A, b, c, false)
9333
end
9434

35+
"""
36+
small_example()
37+
38+
Small example for section 4.4
39+
"""
40+
function small_example()
41+
A = [3 2 -1; 1 -1 3]
42+
b = [1; 6]
43+
c = [1;2;3]
44+
return Tableau(A, b, c, false)
45+
end
46+
9547
nothing

0 commit comments

Comments
 (0)