Skip to content

Commit b2fb223

Browse files
committed
doc work
1 parent cf9c42a commit b2fb223

File tree

11 files changed

+427
-526
lines changed

11 files changed

+427
-526
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"documenter":{"julia_version":"1.11.5","generation_timestamp":"2025-07-06T10:21:18","documenter_version":"1.10.1"}}
1+
{"documenter":{"julia_version":"1.11.6","generation_timestamp":"2025-07-13T15:24:34","documenter_version":"1.10.1"}}

docs/build/create/index.html

Lines changed: 99 additions & 0 deletions
Large diffs are not rendered by default.

docs/build/index.html

Lines changed: 1 addition & 199 deletions
Large diffs are not rendered by default.

docs/build/objects.inv

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Sphinx inventory version 2
22
# Project: SimplexTableaux
3-
# Version: 0.0.4
3+
# Version: 0.0.6
44
# The remainder of this file is compressed using zlib.
5-
x�}�;O�@���+A�-%HT"$ڍ}']n�{8ɿ�v�pN*K�o<��Q��Gp�{�|h�~�򸡭���K�`zF����j�J��G(:x���W2lTK{�{\�]e9#���x!�j�:!k�5�9HK^����1z�䗔&�)�CBˇJ�T ��X� ��A� ��l!�M�����lq��g[q3��B�oW&w�GY��G/��`�{�TJ��ƥ�{�i��������+�����P��,BE#�O�a�CO7�O^ C}�ħ�����3puyO�#����L\��hH5X`��*�x̴�JIזw�� ��A�`�r��;un�:�� ��i�2��6�
5+
x�}��n�0 ��y
6+
K�ժv�mCکR�� 04R��$e���P��pJ�����I�my��V�7���n����x}v���Wm{ �B%f����+ vk"pJ���m��U2`�U<Sm�n 2T�Y��ޣ��R-��1��Q[&������w��u�XXXu1�`�caM^o:&1�Y I�Jv��!MX��jx�Ӌ��2lYe(�!x@��1
7+
��)Tˋ=9�����'�7D����L��|��3�o�\���7]�&}���Xݐ�#���@�

docs/build/other/index.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<!DOCTYPE html>
2+
<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>Other Functions · SimplexTableaux</title><meta name="title" content="Other Functions · SimplexTableaux"/><meta property="og:title" content="Other Functions · SimplexTableaux"/><meta property="twitter:title" content="Other Functions · SimplexTableaux"/><meta name="description" content="Documentation for SimplexTableaux."/><meta property="og:description" content="Documentation for SimplexTableaux."/><meta property="twitter:description" content="Documentation for SimplexTableaux."/><script data-outdated-warner src="../assets/warner.js"></script><link href="https://cdnjs.cloudflare.com/ajax/libs/lato-font/3.0.0/css/lato-font.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/juliamono/0.050/juliamono.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/fontawesome.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/solid.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/brands.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.16.8/katex.min.css" rel="stylesheet" type="text/css"/><script>documenterBaseURL=".."</script><script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js" data-main="../assets/documenter.js"></script><script src="../search_index.js"></script><script src="../siteinfo.js"></script><script src="../../versions.js"></script><link class="docs-theme-link" rel="stylesheet" type="text/css" href="../assets/themes/catppuccin-mocha.css" data-theme-name="catppuccin-mocha"/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="../assets/themes/catppuccin-macchiato.css" data-theme-name="catppuccin-macchiato"/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="../assets/themes/catppuccin-frappe.css" data-theme-name="catppuccin-frappe"/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="../assets/themes/catppuccin-latte.css" data-theme-name="catppuccin-latte"/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="../assets/themes/documenter-dark.css" data-theme-name="documenter-dark" data-theme-primary-dark/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="../assets/themes/documenter-light.css" data-theme-name="documenter-light" data-theme-primary/><script src="../assets/themeswap.js"></script></head><body><div id="documenter"><nav class="docs-sidebar"><div class="docs-package-name"><span class="docs-autofit"><a href="../">SimplexTableaux</a></span></div><button class="docs-search-query input is-rounded is-small is-clickable my-2 mx-auto py-1 px-2" id="documenter-search-query">Search docs (Ctrl + /)</button><ul class="docs-menu"><li><a class="tocitem" href="../">Overview</a></li><li><a class="tocitem" href="../create/">Creating and Solving LPs</a></li><li class="is-active"><a class="tocitem" href>Other Functions</a></li></ul><div class="docs-version-selector field has-addons"><div class="control"><span class="docs-label button is-static is-size-7">Version</span></div><div class="docs-selector control is-expanded"><div class="select is-fullwidth is-size-7"><select id="documenter-version-selector"></select></div></div></div></nav><div class="docs-main"><header class="docs-navbar"><a class="docs-sidebar-button docs-navbar-link fa-solid fa-bars is-hidden-desktop" id="documenter-sidebar-button" href="#"></a><nav class="breadcrumb"><ul class="is-hidden-mobile"><li class="is-active"><a href>Other Functions</a></li></ul><ul class="is-hidden-tablet"><li class="is-active"><a href>Other Functions</a></li></ul></nav><div class="docs-right"><a class="docs-navbar-link" href="https://github.com/scheinerman/SimplexTableaux.jl" title="View the repository on GitHub"><span class="docs-icon fa-brands"></span><span class="docs-label is-hidden-touch">GitHub</span></a><a class="docs-navbar-link" href="https://github.com/scheinerman/SimplexTableaux.jl/blob/main/docs/src/other.md" title="Edit source on GitHub"><span class="docs-icon fa-solid"></span></a><a class="docs-settings-button docs-navbar-link fa-solid fa-gear" id="documenter-settings-button" href="#" title="Settings"></a><a class="docs-article-toggle-button fa-solid fa-chevron-up" id="documenter-article-toggle-button" href="javascript:;" title="Collapse all docstrings"></a></div></header><article class="content" id="documenter-page"></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="../create/">« Creating and Solving LPs</a><div class="flexbox-break"></div><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="auto">Automatic (OS)</option><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option><option value="catppuccin-latte">catppuccin-latte</option><option value="catppuccin-frappe">catppuccin-frappe</option><option value="catppuccin-macchiato">catppuccin-macchiato</option><option value="catppuccin-mocha">catppuccin-mocha</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.10.1 on <span class="colophon-date" title="Sunday 13 July 2025 15:24">Sunday 13 July 2025</span>. Using Julia version 1.11.6.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>

docs/build/search_index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/make.jl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,8 @@
22
# julia --color=yes --project make.jl
33

44
using Documenter, SimplexTableaux
5-
makedocs(; sitename="SimplexTableaux")
5+
makedocs(pages=[
6+
"Overview" => "index.md",
7+
"Creating and Solving LPs" => "create.md",
8+
"Other Functions" => "other.md"
9+
],; sitename="SimplexTableaux")

docs/src/color-tab.png

35.8 KB
Loading

docs/src/create.md

Lines changed: 157 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,157 @@
1+
# Creating and Solving Linear Programs
2+
3+
## Create the Tableau
4+
5+
### Canonical LPs
6+
7+
A canonical LP has the form $\min c^T x$ s.t. $Ax ≥ b, x \ge 0$. To set up a tableau for this problem simply create the matrix `A` and the vectors `b` and `c`, and call `Tableau(A,b,c)`.
8+
9+
For example, let `A`, `b`, and `c` be as follows:
10+
```
11+
julia> A = [3 10; 5 6; 10 2];
12+
13+
julia> b = [100, 100, 100];
14+
15+
julia> c = [25, 10];
16+
17+
julia> Tableau(A, b, c)
18+
┌──────────┬───┬─────┬─────┬─────┬─────┬─────┬─────┐
19+
│ │ z │ x_1 │ x_2 │ x_3 │ x_4 │ x_5 │ RHS │
20+
│ Obj Func │ 1 │ -25 │ -10 │ 0 │ 0 │ 0 │ 0 │
21+
├──────────┼───┼─────┼─────┼─────┼─────┼─────┼─────┤
22+
│ Cons 1 │ 0 │ 3 │ 10 │ -1 │ 0 │ 0 │ 100 │
23+
│ Cons 2 │ 0 │ 5 │ 6 │ 0 │ -1 │ 0 │ 100 │
24+
│ Cons 3 │ 0 │ 10 │ 2 │ 0 │ 0 │ -1 │ 100 │
25+
└──────────┴───┴─────┴─────┴─────┴─────┴─────┴─────┘
26+
```
27+
Notice that extra variables $x_3$, $x_4$, and $x_5$ are added to the `Tableau`
28+
as slack variables to convert inequalities into equations. That is, canonical
29+
form LPs are automatically converted into standard form.
30+
31+
### Standard LPs
32+
33+
A linear program in standard form is $\min c^T x$ s.t. $Ax = b$, $x ≥ 0$.
34+
For example,
35+
```
36+
julia> A = [2 1 0 9 -1; 1 1 -1 5 1]
37+
2×5 Matrix{Int64}:
38+
2 1 0 9 -1
39+
1 1 -1 5 1
40+
41+
julia> b = [9, 7]
42+
2-element Vector{Int64}:
43+
9
44+
7
45+
46+
julia> c = [2, 4, 2, 1, -1]
47+
5-element Vector{Int64}:
48+
2
49+
4
50+
2
51+
1
52+
-1
53+
54+
julia> T = Tableau(A, b, c, false)
55+
┌──────────┬───┬─────┬─────┬─────┬─────┬─────┬─────┐
56+
│ │ z │ x_1 │ x_2 │ x_3 │ x_4 │ x_5 │ RHS │
57+
│ Obj Func │ 1 │ -2 │ -4 │ -2 │ -1 │ 1 │ 0 │
58+
├──────────┼───┼─────┼─────┼─────┼─────┼─────┼─────┤
59+
│ Cons 1 │ 0 │ 2 │ 1 │ 0 │ 9 │ -1 │ 9 │
60+
│ Cons 2 │ 0 │ 1 │ 1 │ -1 │ 5 │ 1 │ 7 │
61+
└──────────┴───┴─────┴─────┴─────┴─────┴─────┴─────┘
62+
```
63+
The fourth argument `false` means that the constraints are already equalities and slack variables should not be appended.
64+
65+
66+
## Specify a Basis
67+
68+
Use `set_basis!(T, B)` to specify a staring basis for the tableau. Here, `B` is a list (`Vector`)
69+
of integers specifying the columns that are in the basis.
70+
71+
```
72+
julia> set_basis!(T,[1,4,5])
73+
┌──────────┬───┬─────┬───────┬───────┬─────┬─────┬────────┐
74+
│ │ z │ x_1 │ x_2 │ x_3 │ x_4 │ x_5 │ RHS │
75+
│ Obj Func │ 1 │ 0 │ 220/3 │ -25/3 │ 0 │ 0 │ 2500/3 │
76+
├──────────┼───┼─────┼───────┼───────┼─────┼─────┼────────┤
77+
│ Cons 1 │ 0 │ 1 │ 10/3 │ -1/3 │ 0 │ 0 │ 100/3 │
78+
│ Cons 2 │ 0 │ 0 │ 32/3 │ -5/3 │ 1 │ 0 │ 200/3 │
79+
│ Cons 3 │ 0 │ 0 │ 94/3 │ -10/3 │ 0 │ 1 │ 700/3 │
80+
└──────────┴───┴─────┴───────┴───────┴─────┴─────┴────────┘
81+
```
82+
> Note: On the screen, the headings for the basis (in this case, `x_1`, `x_3`, and `x_4`) appear in green.
83+
![](color-tab.png)
84+
85+
86+
### Tools to find a basis
87+
88+
The function `find_all_bases(T)` returns a list of all feasible bases for `T`:
89+
```
90+
julia> find_all_bases(T)
91+
4-element Vector{Vector{Int64}}:
92+
[1, 2, 3]
93+
[1, 2, 5]
94+
[1, 4, 5]
95+
[2, 3, 4]
96+
```
97+
The function `find_a_basis(T)` returns a feasible basis for `T` (the first it finds).
98+
```
99+
julia> find_a_basis(T)
100+
3-element Vector{Int64}:
101+
1
102+
2
103+
3
104+
```
105+
106+
These are inefficient functions. We plan to change the implementation of `find_a_basis` to something more performant.
107+
108+
109+
110+
## Perform the Simplex Algorithm
111+
112+
Once a tableau has been set up with a feasible basis, use `simplex_solve!(T)` to run the simplex algorithm and return solution to the LP.
113+
```
114+
julia> simplex_solve!(T)
115+
Starting tableau
116+
117+
┌──────────┬───┬─────┬───────┬───────┬─────┬─────┬────────┐
118+
│ │ z │ x_1 │ x_2 │ x_3 │ x_4 │ x_5 │ RHS │
119+
│ Obj Func │ 1 │ 0 │ 220/3 │ -25/3 │ 0 │ 0 │ 2500/3 │
120+
├──────────┼───┼─────┼───────┼───────┼─────┼─────┼────────┤
121+
│ Cons 1 │ 0 │ 1 │ 10/3 │ -1/3 │ 0 │ 0 │ 100/3 │
122+
│ Cons 2 │ 0 │ 0 │ 32/3 │ -5/3 │ 1 │ 0 │ 200/3 │
123+
│ Cons 3 │ 0 │ 0 │ 94/3 │ -10/3 │ 0 │ 1 │ 700/3 │
124+
└──────────┴───┴─────┴───────┴───────┴─────┴─────┴────────┘
125+
126+
Column 4 leaves basis and column 2 enters
127+
128+
┌──────────┬───┬─────┬─────┬───────┬────────┬─────┬──────┐
129+
│ │ z │ x_1 │ x_2 │ x_3 │ x_4 │ x_5 │ RHS │
130+
│ Obj Func │ 1 │ 0 │ 0 │ 25/8 │ -55/8 │ 0 │ 375 │
131+
├──────────┼───┼─────┼─────┼───────┼────────┼─────┼──────┤
132+
│ Cons 1 │ 0 │ 1 │ 0 │ 3/16 │ -5/16 │ 0 │ 25/2 │
133+
│ Cons 2 │ 0 │ 0 │ 1 │ -5/32 │ 3/32 │ 0 │ 25/4 │
134+
│ Cons 3 │ 0 │ 0 │ 0 │ 25/16 │ -47/16 │ 1 │ 75/2 │
135+
└──────────┴───┴─────┴─────┴───────┴────────┴─────┴──────┘
136+
137+
Column 5 leaves basis and column 3 enters
138+
139+
┌──────────┬───┬─────┬─────┬─────┬────────┬───────┬─────┐
140+
│ │ z │ x_1 │ x_2 │ x_3 │ x_4 │ x_5 │ RHS │
141+
│ Obj Func │ 1 │ 0 │ 0 │ 0 │ -1 │ -2 │ 300 │
142+
├──────────┼───┼─────┼─────┼─────┼────────┼───────┼─────┤
143+
│ Cons 1 │ 0 │ 1 │ 0 │ 0 │ 1/25 │ -3/25 │ 8 │
144+
│ Cons 2 │ 0 │ 0 │ 1 │ 0 │ -1/5 │ 1/10 │ 10 │
145+
│ Cons 3 │ 0 │ 0 │ 0 │ 1 │ -47/25 │ 16/25 │ 24 │
146+
└──────────┴───┴─────┴─────┴─────┴────────┴───────┴─────┘
147+
148+
Optimality reached
149+
Value = 300
150+
5-element Vector{Rational}:
151+
8
152+
10
153+
24
154+
0
155+
0
156+
```
157+

0 commit comments

Comments
 (0)