Mercurial > octave
annotate scripts/optimization/glpk.m @ 29359:7854d5752dd2
maint: merge stable to default.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Wed, 10 Feb 2021 10:10:40 -0500 |
parents | 0de38a6ef693 0a5b15007766 |
children | 796f54d4ddbf |
rev | line source |
---|---|
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
1 ######################################################################## |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
2 ## |
29358
0a5b15007766
update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents:
28814
diff
changeset
|
3 ## Copyright (C) 2005-2021 The Octave Project Developers |
27918
b442ec6dda5c
use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents:
27898
diff
changeset
|
4 ## |
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
5 ## See the file COPYRIGHT.md in the top-level directory of this |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
6 ## distribution or <https://octave.org/copyright/>. |
5233 | 7 ## |
8 ## This file is part of Octave. | |
9 ## | |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
10 ## Octave is free software: you can redistribute it and/or modify it |
5233 | 11 ## under the terms of the GNU General Public License as published by |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
12 ## the Free Software Foundation, either version 3 of the License, or |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
13 ## (at your option) any later version. |
5233 | 14 ## |
15 ## Octave is distributed in the hope that it will be useful, but | |
16 ## WITHOUT ANY WARRANTY; without even the implied warranty of | |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
17 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
18 ## GNU General Public License for more details. |
5233 | 19 ## |
20 ## You should have received a copy of the GNU General Public License | |
7016 | 21 ## along with Octave; see the file COPYING. If not, see |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
22 ## <https://www.gnu.org/licenses/>. |
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
23 ## |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
24 ######################################################################## |
5233 | 25 |
5244 | 26 ## -*- texinfo -*- |
20852
516bb87ea72e
2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents:
20165
diff
changeset
|
27 ## @deftypefn {} {[@var{xopt}, @var{fmin}, @var{errnum}, @var{extra}] =} glpk (@var{c}, @var{A}, @var{b}, @var{lb}, @var{ub}, @var{ctype}, @var{vartype}, @var{sense}, @var{param}) |
20165
f1d0f506ee78
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
28 ## Solve a linear program using the GNU @sc{glpk} library. |
f1d0f506ee78
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
29 ## |
f1d0f506ee78
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
30 ## Given three arguments, @code{glpk} solves the following standard LP: |
6741 | 31 ## @tex |
32 ## $$ | |
33 ## \min_x C^T x | |
34 ## $$ | |
35 ## @end tex | |
36 ## @ifnottex | |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
37 ## |
5244 | 38 ## @example |
39 ## min C'*x | |
40 ## @end example | |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
41 ## |
6741 | 42 ## @end ifnottex |
5237 | 43 ## subject to |
6741 | 44 ## @tex |
45 ## $$ | |
46 ## Ax = b \qquad x \geq 0 | |
47 ## $$ | |
48 ## @end tex | |
49 ## @ifnottex | |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
50 ## |
5244 | 51 ## @example |
52 ## @group | |
53 ## A*x = b | |
54 ## x >= 0 | |
55 ## @end group | |
56 ## @end example | |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
57 ## |
6741 | 58 ## @end ifnottex |
5237 | 59 ## but may also solve problems of the form |
6741 | 60 ## @tex |
61 ## $$ | |
62 ## [ \min_x | \max_x ] C^T x | |
63 ## $$ | |
64 ## @end tex | |
65 ## @ifnottex | |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
66 ## |
5244 | 67 ## @example |
68 ## [ min | max ] C'*x | |
69 ## @end example | |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
70 ## |
6741 | 71 ## @end ifnottex |
5237 | 72 ## subject to |
6741 | 73 ## @tex |
74 ## $$ | |
9051
1bf0ce0930be
Grammar check TexInfo in all .m files
Rik <rdrider0-list@yahoo.com>
parents:
8920
diff
changeset
|
75 ## Ax [ = | \leq | \geq ] b \qquad LB \leq x \leq UB |
6741 | 76 ## $$ |
77 ## @end tex | |
78 ## @ifnottex | |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
79 ## |
5244 | 80 ## @example |
81 ## @group | |
82 ## A*x [ "=" | "<=" | ">=" ] b | |
83 ## x >= LB | |
84 ## x <= UB | |
85 ## @end group | |
86 ## @end example | |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
87 ## |
6741 | 88 ## @end ifnottex |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
89 ## |
5244 | 90 ## Input arguments: |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
91 ## |
5244 | 92 ## @table @var |
93 ## @item c | |
94 ## A column array containing the objective function coefficients. | |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
95 ## |
11471
994e2a93a8e2
Use uppercase 'A' to refer to matrix inputs in m-files.
Rik <octave@nomad.inbox5.com>
parents:
10821
diff
changeset
|
96 ## @item A |
5244 | 97 ## A matrix containing the constraints coefficients. |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
98 ## |
5244 | 99 ## @item b |
20165
f1d0f506ee78
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
100 ## A column array containing the right-hand side value for each constraint in |
f1d0f506ee78
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
101 ## the constraint matrix. |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
102 ## |
5244 | 103 ## @item lb |
20165
f1d0f506ee78
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
104 ## An array containing the lower bound on each of the variables. If @var{lb} |
f1d0f506ee78
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
105 ## is not supplied, the default lower bound for the variables is zero. |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
106 ## |
5244 | 107 ## @item ub |
20165
f1d0f506ee78
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
108 ## An array containing the upper bound on each of the variables. If @var{ub} |
f1d0f506ee78
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
109 ## is not supplied, the default upper bound is assumed to be infinite. |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
110 ## |
5244 | 111 ## @item ctype |
112 ## An array of characters containing the sense of each constraint in the | |
20165
f1d0f506ee78
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
113 ## constraint matrix. Each element of the array may be one of the following |
f1d0f506ee78
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
114 ## values |
14366
b76f0740940e
doc: Periodic grammar check of documentation.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
115 ## |
11595
5ec6aa05638d
Prevent doubled quotes around @table items in Info.
Rik <octave@nomad.inbox5.com>
parents:
11587
diff
changeset
|
116 ## @table @asis |
17281
bc924baa2c4e
doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents:
17180
diff
changeset
|
117 ## @item @qcode{"F"} |
7096 | 118 ## A free (unbounded) constraint (the constraint is ignored). |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
119 ## |
17281
bc924baa2c4e
doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents:
17180
diff
changeset
|
120 ## @item @qcode{"U"} |
7096 | 121 ## An inequality constraint with an upper bound (@code{A(i,:)*x <= b(i)}). |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
122 ## |
17281
bc924baa2c4e
doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents:
17180
diff
changeset
|
123 ## @item @qcode{"S"} |
7096 | 124 ## An equality constraint (@code{A(i,:)*x = b(i)}). |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
125 ## |
17281
bc924baa2c4e
doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents:
17180
diff
changeset
|
126 ## @item @qcode{"L"} |
7096 | 127 ## An inequality with a lower bound (@code{A(i,:)*x >= b(i)}). |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
128 ## |
17281
bc924baa2c4e
doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents:
17180
diff
changeset
|
129 ## @item @qcode{"D"} |
7096 | 130 ## An inequality constraint with both upper and lower bounds |
18679
a142f35f3cb6
doc: Fix unbalanced parentheses in documentation.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
131 ## (@code{A(i,:)*x >= -b(i)}) @emph{and} (@code{A(i,:)*x <= b(i)}). |
5244 | 132 ## @end table |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
133 ## |
5244 | 134 ## @item vartype |
135 ## A column array containing the types of the variables. | |
14366
b76f0740940e
doc: Periodic grammar check of documentation.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
136 ## |
11595
5ec6aa05638d
Prevent doubled quotes around @table items in Info.
Rik <octave@nomad.inbox5.com>
parents:
11587
diff
changeset
|
137 ## @table @asis |
17281
bc924baa2c4e
doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents:
17180
diff
changeset
|
138 ## @item @qcode{"C"} |
7096 | 139 ## A continuous variable. |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
140 ## |
17281
bc924baa2c4e
doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents:
17180
diff
changeset
|
141 ## @item @qcode{"I"} |
7096 | 142 ## An integer variable. |
5244 | 143 ## @end table |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
144 ## |
5244 | 145 ## @item sense |
20165
f1d0f506ee78
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
146 ## If @var{sense} is 1, the problem is a minimization. If @var{sense} is -1, |
f1d0f506ee78
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
147 ## the problem is a maximization. The default value is 1. |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
148 ## |
5244 | 149 ## @item param |
150 ## A structure containing the following parameters used to define the | |
151 ## behavior of solver. Missing elements in the structure take on default | |
20165
f1d0f506ee78
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
152 ## values, so you only need to set the elements that you wish to change from |
f1d0f506ee78
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
153 ## the default. |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
154 ## |
5244 | 155 ## Integer parameters: |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
156 ## |
5244 | 157 ## @table @code |
17180
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
158 ## @item msglev (default: 1) |
5244 | 159 ## Level of messages output by solver routines: |
14366
b76f0740940e
doc: Periodic grammar check of documentation.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
160 ## |
5244 | 161 ## @table @asis |
17180
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
162 ## @item 0 (@w{@code{GLP_MSG_OFF}}) |
5244 | 163 ## No output. |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
164 ## |
17180
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
165 ## @item 1 (@w{@code{GLP_MSG_ERR}}) |
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
166 ## Error and warning messages only. |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
167 ## |
17180
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
168 ## @item 2 (@w{@code{GLP_MSG_ON}}) |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
169 ## Normal output. |
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
170 ## |
17180
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
171 ## @item 3 (@w{@code{GLP_MSG_ALL}}) |
5244 | 172 ## Full output (includes informational messages). |
173 ## @end table | |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
174 ## |
17180
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
175 ## @item scale (default: 16) |
17281
bc924baa2c4e
doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents:
17180
diff
changeset
|
176 ## Scaling option. The values can be combined with the bitwise OR operator and |
17180
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
177 ## may be the following: |
14366
b76f0740940e
doc: Periodic grammar check of documentation.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
178 ## |
5244 | 179 ## @table @asis |
17180
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
180 ## @item 1 (@w{@code{GLP_SF_GM}}) |
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
181 ## Geometric mean scaling. |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
182 ## |
17180
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
183 ## @item 16 (@w{@code{GLP_SF_EQ}}) |
7001 | 184 ## Equilibration scaling. |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
185 ## |
17180
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
186 ## @item 32 (@w{@code{GLP_SF_2N}}) |
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
187 ## Round scale factors to power of two. |
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
188 ## |
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
189 ## @item 64 (@w{@code{GLP_SF_SKIP}}) |
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
190 ## Skip if problem is well scaled. |
5244 | 191 ## @end table |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
192 ## |
17281
bc924baa2c4e
doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents:
17180
diff
changeset
|
193 ## Alternatively, a value of 128 (@w{@env{GLP_SF_AUTO}}) may be also |
bc924baa2c4e
doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents:
17180
diff
changeset
|
194 ## specified, in which case the routine chooses the scaling options |
bc924baa2c4e
doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents:
17180
diff
changeset
|
195 ## automatically. |
17180
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
196 ## |
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
197 ## @item dual (default: 1) |
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
198 ## Simplex method option: |
14366
b76f0740940e
doc: Periodic grammar check of documentation.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
199 ## |
5244 | 200 ## @table @asis |
17180
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
201 ## @item 1 (@w{@code{GLP_PRIMAL}}) |
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
202 ## Use two-phase primal simplex. |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
203 ## |
17180
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
204 ## @item 2 (@w{@code{GLP_DUALP}}) |
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
205 ## Use two-phase dual simplex, and if it fails, switch to the primal simplex. |
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
206 ## |
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
207 ## @item 3 (@w{@code{GLP_DUAL}}) |
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
208 ## Use two-phase dual simplex. |
5244 | 209 ## @end table |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
210 ## |
17180
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
211 ## @item price (default: 34) |
5244 | 212 ## Pricing option (for both primal and dual simplex): |
14366
b76f0740940e
doc: Periodic grammar check of documentation.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
213 ## |
5244 | 214 ## @table @asis |
17180
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
215 ## @item 17 (@w{@code{GLP_PT_STD}}) |
5244 | 216 ## Textbook pricing. |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
217 ## |
17180
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
218 ## @item 34 (@w{@code{GLP_PT_PSE}}) |
5244 | 219 ## Steepest edge pricing. |
220 ## @end table | |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
221 ## |
17180
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
222 ## @item itlim (default: intmax) |
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
223 ## Simplex iterations limit. It is decreased by one each time when one simplex |
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
224 ## iteration has been performed, and reaching zero value signals the solver to |
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
225 ## stop the search. |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
226 ## |
17180
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
227 ## @item outfrq (default: 200) |
20165
f1d0f506ee78
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
228 ## Output frequency, in iterations. This parameter specifies how frequently |
f1d0f506ee78
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
229 ## the solver sends information about the solution to the standard output. |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
230 ## |
17180
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
231 ## @item branch (default: 4) |
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
232 ## Branching technique option (for MIP only): |
14366
b76f0740940e
doc: Periodic grammar check of documentation.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
233 ## |
5244 | 234 ## @table @asis |
17180
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
235 ## @item 1 (@w{@code{GLP_BR_FFV}}) |
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
236 ## First fractional variable. |
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
237 ## |
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
238 ## @item 2 (@w{@code{GLP_BR_LFV}}) |
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
239 ## Last fractional variable. |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
240 ## |
17180
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
241 ## @item 3 (@w{@code{GLP_BR_MFV}}) |
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
242 ## Most fractional variable. |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
243 ## |
17180
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
244 ## @item 4 (@w{@code{GLP_BR_DTH}}) |
19040
0850b5212619
doc: Add @nospell macro around proper names in documentation.
Rik <rik@octave.org>
parents:
18679
diff
changeset
|
245 ## Heuristic by @nospell{Driebeck and Tomlin}. |
17180
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
246 ## |
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
247 ## @item 5 (@w{@code{GLP_BR_PCH}}) |
17290
17be601bc783
doc: Periodic spellchecking of documentation.
Rik <rik@octave.org>
parents:
17281
diff
changeset
|
248 ## Hybrid @nospell{pseudocost} heuristic. |
5244 | 249 ## @end table |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
250 ## |
17180
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
251 ## @item btrack (default: 4) |
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
252 ## Backtracking technique option (for MIP only): |
14366
b76f0740940e
doc: Periodic grammar check of documentation.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
253 ## |
5244 | 254 ## @table @asis |
17180
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
255 ## @item 1 (@w{@code{GLP_BT_DFS}}) |
5244 | 256 ## Depth first search. |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
257 ## |
17180
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
258 ## @item 2 (@w{@code{GLP_BT_BFS}}) |
5244 | 259 ## Breadth first search. |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
260 ## |
17180
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
261 ## @item 3 (@w{@code{GLP_BT_BLB}}) |
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
262 ## Best local bound. |
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
263 ## |
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
264 ## @item 4 (@w{@code{GLP_BT_BPH}}) |
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
265 ## Best projection heuristic. |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
266 ## @end table |
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
267 ## |
17180
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
268 ## @item presol (default: 1) |
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
269 ## If this flag is set, the simplex solver uses the built-in LP presolver. |
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
270 ## Otherwise the LP presolver is not used. |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
271 ## |
5244 | 272 ## @item lpsolver (default: 1) |
273 ## Select which solver to use. If the problem is a MIP problem this flag | |
274 ## will be ignored. | |
14366
b76f0740940e
doc: Periodic grammar check of documentation.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
275 ## |
5244 | 276 ## @table @asis |
277 ## @item 1 | |
278 ## Revised simplex method. | |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
279 ## |
5244 | 280 ## @item 2 |
281 ## Interior point method. | |
282 ## @end table | |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
283 ## |
17180
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
284 ## @item rtest (default: 34) |
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
285 ## Ratio test technique: |
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
286 ## |
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
287 ## @table @asis |
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
288 ## @item 17 (@w{@code{GLP_RT_STD}}) |
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
289 ## Standard ("textbook"). |
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
290 ## |
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
291 ## @item 34 (@w{@code{GLP_RT_HAR}}) |
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
292 ## Harris' two-pass ratio test. |
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
293 ## @end table |
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
294 ## |
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
295 ## @item tmlim (default: intmax) |
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
296 ## Searching time limit, in milliseconds. |
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
297 ## |
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
298 ## @item outdly (default: 0) |
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
299 ## Output delay, in seconds. This parameter specifies how long the solver |
20165
f1d0f506ee78
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
300 ## should delay sending information about the solution to the standard output. |
17180
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
301 ## |
5244 | 302 ## @item save (default: 0) |
25003
2365c2661b3c
doc: Spellcheck documentation ahead of 4.4 release.
Rik <rik@octave.org>
parents:
24534
diff
changeset
|
303 ## If this parameter is nonzero, save a copy of the problem in @nospell{CPLEX} |
2365c2661b3c
doc: Spellcheck documentation ahead of 4.4 release.
Rik <rik@octave.org>
parents:
24534
diff
changeset
|
304 ## LP format to the file @file{"outpb.lp"}. There is currently no way to |
2365c2661b3c
doc: Spellcheck documentation ahead of 4.4 release.
Rik <rik@octave.org>
parents:
24534
diff
changeset
|
305 ## change the name of the output file. |
5244 | 306 ## @end table |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
307 ## |
5244 | 308 ## Real parameters: |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
309 ## |
5244 | 310 ## @table @code |
17180
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
311 ## @item tolbnd (default: 1e-7) |
5289 | 312 ## Relative tolerance used to check if the current basic solution is primal |
5244 | 313 ## feasible. It is not recommended that you change this parameter unless you |
314 ## have a detailed understanding of its purpose. | |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
315 ## |
17180
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
316 ## @item toldj (default: 1e-7) |
5244 | 317 ## Absolute tolerance used to check if the current basic solution is dual |
318 ## feasible. It is not recommended that you change this parameter unless you | |
319 ## have a detailed understanding of its purpose. | |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
320 ## |
17180
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
321 ## @item tolpiv (default: 1e-10) |
20165
f1d0f506ee78
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
322 ## Relative tolerance used to choose eligible pivotal elements of the simplex |
f1d0f506ee78
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
323 ## table. It is not recommended that you change this parameter unless you have |
f1d0f506ee78
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
324 ## a detailed understanding of its purpose. |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
325 ## |
17180
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
326 ## @item objll (default: -DBL_MAX) |
20165
f1d0f506ee78
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
327 ## Lower limit of the objective function. If the objective function reaches |
f1d0f506ee78
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
328 ## this limit and continues decreasing, the solver stops the search. This |
f1d0f506ee78
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
329 ## parameter is used in the dual simplex method only. |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
330 ## |
17180
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
331 ## @item objul (default: +DBL_MAX) |
20165
f1d0f506ee78
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
332 ## Upper limit of the objective function. If the objective function reaches |
f1d0f506ee78
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
333 ## this limit and continues increasing, the solver stops the search. This |
f1d0f506ee78
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
334 ## parameter is used in the dual simplex only. |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
335 ## |
17180
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
336 ## @item tolint (default: 1e-5) |
5289 | 337 ## Relative tolerance used to check if the current basic solution is integer |
20165
f1d0f506ee78
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
338 ## feasible. It is not recommended that you change this parameter unless you |
f1d0f506ee78
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
339 ## have a detailed understanding of its purpose. |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
340 ## |
17180
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
341 ## @item tolobj (default: 1e-7) |
20165
f1d0f506ee78
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
342 ## Relative tolerance used to check if the value of the objective function is |
f1d0f506ee78
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
343 ## not better than in the best known integer feasible solution. It is not |
f1d0f506ee78
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
344 ## recommended that you change this parameter unless you have a detailed |
f1d0f506ee78
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
345 ## understanding of its purpose. |
5244 | 346 ## @end table |
347 ## @end table | |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
348 ## |
5244 | 349 ## Output values: |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
350 ## |
5244 | 351 ## @table @var |
352 ## @item xopt | |
353 ## The optimizer (the value of the decision variables at the optimum). | |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
354 ## |
5244 | 355 ## @item fopt |
356 ## The optimum value of the objective function. | |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
357 ## |
17180
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
358 ## @item errnum |
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
359 ## Error code. |
14366
b76f0740940e
doc: Periodic grammar check of documentation.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
360 ## |
5244 | 361 ## @table @asis |
17180
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
362 ## @item 0 |
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
363 ## No error. |
12642
f96b9b9f141b
doc: Periodic grammarcheck and spellcheck of documentation.
Rik <octave@nomad.inbox5.com>
parents:
11595
diff
changeset
|
364 ## |
17180
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
365 ## @item 1 (@w{@code{GLP_EBADB}}) |
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
366 ## Invalid basis. |
12642
f96b9b9f141b
doc: Periodic grammarcheck and spellcheck of documentation.
Rik <octave@nomad.inbox5.com>
parents:
11595
diff
changeset
|
367 ## |
17180
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
368 ## @item 2 (@w{@code{GLP_ESING}}) |
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
369 ## Singular matrix. |
12642
f96b9b9f141b
doc: Periodic grammarcheck and spellcheck of documentation.
Rik <octave@nomad.inbox5.com>
parents:
11595
diff
changeset
|
370 ## |
17180
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
371 ## @item 3 (@w{@code{GLP_ECOND}}) |
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
372 ## Ill-conditioned matrix. |
15007
8f0e3c5bfa5f
doc: Periodic grammarcheck of documentation
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
373 ## |
17180
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
374 ## @item 4 (@w{@code{GLP_EBOUND}}) |
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
375 ## Invalid bounds. |
5232 | 376 ## |
17180
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
377 ## @item 5 (@w{@code{GLP_EFAIL}}) |
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
378 ## Solver failed. |
12642
f96b9b9f141b
doc: Periodic grammarcheck and spellcheck of documentation.
Rik <octave@nomad.inbox5.com>
parents:
11595
diff
changeset
|
379 ## |
17180
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
380 ## @item 6 (@w{@code{GLP_EOBJLL}}) |
5244 | 381 ## Objective function lower limit reached. |
12642
f96b9b9f141b
doc: Periodic grammarcheck and spellcheck of documentation.
Rik <octave@nomad.inbox5.com>
parents:
11595
diff
changeset
|
382 ## |
17180
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
383 ## @item 7 (@w{@code{GLP_EOBJUL}}) |
5244 | 384 ## Objective function upper limit reached. |
12642
f96b9b9f141b
doc: Periodic grammarcheck and spellcheck of documentation.
Rik <octave@nomad.inbox5.com>
parents:
11595
diff
changeset
|
385 ## |
17180
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
386 ## @item 8 (@w{@code{GLP_EITLIM}}) |
5244 | 387 ## Iterations limit exhausted. |
12642
f96b9b9f141b
doc: Periodic grammarcheck and spellcheck of documentation.
Rik <octave@nomad.inbox5.com>
parents:
11595
diff
changeset
|
388 ## |
17180
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
389 ## @item 9 (@w{@code{GLP_ETMLIM}}) |
5244 | 390 ## Time limit exhausted. |
12642
f96b9b9f141b
doc: Periodic grammarcheck and spellcheck of documentation.
Rik <octave@nomad.inbox5.com>
parents:
11595
diff
changeset
|
391 ## |
17180
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
392 ## @item 10 (@w{@code{GLP_ENOPFS}}) |
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
393 ## No primal feasible solution. |
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
394 ## |
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
395 ## @item 11 (@w{@code{GLP_ENODFS}}) |
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
396 ## No dual feasible solution. |
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
397 ## |
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
398 ## @item 12 (@w{@code{GLP_EROOT}}) |
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
399 ## Root LP optimum not provided. |
12642
f96b9b9f141b
doc: Periodic grammarcheck and spellcheck of documentation.
Rik <octave@nomad.inbox5.com>
parents:
11595
diff
changeset
|
400 ## |
17180
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
401 ## @item 13 (@w{@code{GLP_ESTOP}}) |
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
402 ## Search terminated by application. |
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
403 ## |
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
404 ## @item 14 (@w{@code{GLP_EMIPGAP}}) |
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
405 ## Relative MIP gap tolerance reached. |
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
406 ## |
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
407 ## @item 15 (@w{@code{GLP_ENOFEAS}}) |
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
408 ## No primal/dual feasible solution. |
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
409 ## |
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
410 ## @item 16 (@w{@code{GLP_ENOCVG}}) |
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
411 ## No convergence. |
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
412 ## |
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
413 ## @item 17 (@w{@code{GLP_EINSTAB}}) |
5244 | 414 ## Numerical instability. |
12642
f96b9b9f141b
doc: Periodic grammarcheck and spellcheck of documentation.
Rik <octave@nomad.inbox5.com>
parents:
11595
diff
changeset
|
415 ## |
17180
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
416 ## @item 18 (@w{@code{GLP_EDATA}}) |
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
417 ## Invalid data. |
12642
f96b9b9f141b
doc: Periodic grammarcheck and spellcheck of documentation.
Rik <octave@nomad.inbox5.com>
parents:
11595
diff
changeset
|
418 ## |
17180
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
419 ## @item 19 (@w{@code{GLP_ERANGE}}) |
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
420 ## Result out of range. |
5244 | 421 ## @end table |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
422 ## |
5244 | 423 ## @item extra |
424 ## A data structure containing the following fields: | |
14366
b76f0740940e
doc: Periodic grammar check of documentation.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
425 ## |
5244 | 426 ## @table @code |
427 ## @item lambda | |
428 ## Dual variables. | |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
429 ## |
5244 | 430 ## @item redcosts |
431 ## Reduced Costs. | |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
432 ## |
5244 | 433 ## @item time |
434 ## Time (in seconds) used for solving LP/MIP problem. | |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
435 ## |
17180
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
436 ## @item status |
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
437 ## Status of the optimization. |
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
438 ## |
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
439 ## @table @asis |
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
440 ## @item 1 (@w{@code{GLP_UNDEF}}) |
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
441 ## Solution status is undefined. |
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
442 ## |
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
443 ## @item 2 (@w{@code{GLP_FEAS}}) |
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
444 ## Solution is feasible. |
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
445 ## |
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
446 ## @item 3 (@w{@code{GLP_INFEAS}}) |
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
447 ## Solution is infeasible. |
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
448 ## |
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
449 ## @item 4 (@w{@code{GLP_NOFEAS}}) |
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
450 ## Problem has no feasible solution. |
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
451 ## |
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
452 ## @item 5 (@w{@code{GLP_OPT}}) |
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
453 ## Solution is optimal. |
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
454 ## |
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
455 ## @item 6 (@w{@code{GLP_UNBND}}) |
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
456 ## Problem has no unbounded solution. |
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
457 ## @end table |
5244 | 458 ## @end table |
459 ## @end table | |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
460 ## |
5244 | 461 ## Example: |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
462 ## |
5244 | 463 ## @example |
464 ## @group | |
465 ## c = [10, 6, 4]'; | |
11471
994e2a93a8e2
Use uppercase 'A' to refer to matrix inputs in m-files.
Rik <octave@nomad.inbox5.com>
parents:
10821
diff
changeset
|
466 ## A = [ 1, 1, 1; |
5244 | 467 ## 10, 4, 5; |
468 ## 2, 2, 6]; | |
469 ## b = [100, 600, 300]'; | |
470 ## lb = [0, 0, 0]'; | |
471 ## ub = []; | |
472 ## ctype = "UUU"; | |
473 ## vartype = "CCC"; | |
474 ## s = -1; | |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
475 ## |
5244 | 476 ## param.msglev = 1; |
477 ## param.itlim = 100; | |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
478 ## |
9758
09da0bd91412
Periodic grammar check of Octave documentation files to ensure common format
Rik <rdrider0-list@yahoo.com>
parents:
9245
diff
changeset
|
479 ## [xmin, fmin, status, extra] = ... |
11471
994e2a93a8e2
Use uppercase 'A' to refer to matrix inputs in m-files.
Rik <octave@nomad.inbox5.com>
parents:
10821
diff
changeset
|
480 ## glpk (c, A, b, lb, ub, ctype, vartype, s, param); |
5244 | 481 ## @end group |
482 ## @end example | |
483 ## @end deftypefn | |
5232 | 484 |
17180
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
485 function [xopt, fmin, errnum, extra] = glpk (c, A, b, lb, ub, ctype, vartype, sense, param) |
5232 | 486 |
5233 | 487 ## If there is no input output the version and syntax |
28789
28de41192f3c
Eliminate unneeded verification of nargin, nargout in m-files.
Rik <rik@octave.org>
parents:
27978
diff
changeset
|
488 if (nargin < 3) |
6046 | 489 print_usage (); |
5233 | 490 endif |
5232 | 491 |
28807
f0588f913755
glpk.m: Check if input is finite (bug #58505).
Markus Mützel <markus.muetzel@gmx.de>
parents:
27978
diff
changeset
|
492 if (! isvector (c) || iscomplex (c) || ischar (c) || any (! isfinite (c))) |
f0588f913755
glpk.m: Check if input is finite (bug #58505).
Markus Mützel <markus.muetzel@gmx.de>
parents:
27978
diff
changeset
|
493 error ("glpk: C must be a real vector with finite values"); |
5233 | 494 endif |
495 nx = length (c); | |
496 ## Force column vector. | |
497 c = c(:); | |
5232 | 498 |
5237 | 499 ## 2) Matrix constraint |
5232 | 500 |
11471
994e2a93a8e2
Use uppercase 'A' to refer to matrix inputs in m-files.
Rik <octave@nomad.inbox5.com>
parents:
10821
diff
changeset
|
501 if (isempty (A)) |
10635
d1978e7364ad
Print name of function in error() string messages.
Rik <octave@nomad.inbox5.com>
parents:
10549
diff
changeset
|
502 error ("glpk: A cannot be an empty matrix"); |
5233 | 503 endif |
22224
20e0c0b8820c
Allow sequential quadratic programs with infeasible QPs (bug #36015).
Lachlan Andrew <lachlanbis@gmail.com>
parents:
21580
diff
changeset
|
504 if (! isreal (A)) |
20e0c0b8820c
Allow sequential quadratic programs with infeasible QPs (bug #36015).
Lachlan Andrew <lachlanbis@gmail.com>
parents:
21580
diff
changeset
|
505 error ("glpk: A must be real valued, not %s", typeinfo (A)); |
20e0c0b8820c
Allow sequential quadratic programs with infeasible QPs (bug #36015).
Lachlan Andrew <lachlanbis@gmail.com>
parents:
21580
diff
changeset
|
506 endif |
28807
f0588f913755
glpk.m: Check if input is finite (bug #58505).
Markus Mützel <markus.muetzel@gmx.de>
parents:
27978
diff
changeset
|
507 if (any (! isfinite (A(:)))) |
f0588f913755
glpk.m: Check if input is finite (bug #58505).
Markus Mützel <markus.muetzel@gmx.de>
parents:
27978
diff
changeset
|
508 error ("glpk: The values in A must be finite"); |
f0588f913755
glpk.m: Check if input is finite (bug #58505).
Markus Mützel <markus.muetzel@gmx.de>
parents:
27978
diff
changeset
|
509 endif |
f0588f913755
glpk.m: Check if input is finite (bug #58505).
Markus Mützel <markus.muetzel@gmx.de>
parents:
27978
diff
changeset
|
510 |
14868
5d3a684236b0
maint: Use Octave coding conventions for cuddling parentheses in scripts directory
Rik <octave@nomad.inbox5.com>
parents:
14366
diff
changeset
|
511 [nc, nxa] = size (A); |
22224
20e0c0b8820c
Allow sequential quadratic programs with infeasible QPs (bug #36015).
Lachlan Andrew <lachlanbis@gmail.com>
parents:
21580
diff
changeset
|
512 if (nxa != nx) |
28814
697562e2b09a
glpk.m: Correct English in error() messages.
Rik <rik@octave.org>
parents:
28812
diff
changeset
|
513 error ("glpk: A must be %d-by-%d, not %d-by-%d", |
22225
42456fc9bf6c
glpk.m: Style fixes for cset 20e0c0b8820c.
Rik <rik@octave.org>
parents:
22224
diff
changeset
|
514 nc, nx, rows (A), columns (A)); |
5233 | 515 endif |
516 | |
5237 | 517 ## 3) RHS |
5232 | 518 |
5233 | 519 if (isempty (b)) |
10635
d1978e7364ad
Print name of function in error() string messages.
Rik <octave@nomad.inbox5.com>
parents:
10549
diff
changeset
|
520 error ("glpk: B cannot be an empty vector"); |
5233 | 521 endif |
522 if (! isreal (b) || length (b) != nc) | |
28814
697562e2b09a
glpk.m: Correct English in error() messages.
Rik <rik@octave.org>
parents:
28812
diff
changeset
|
523 error ("glpk: B must be a real-valued %d-by-1 vector", nc); |
5233 | 524 endif |
28807
f0588f913755
glpk.m: Check if input is finite (bug #58505).
Markus Mützel <markus.muetzel@gmx.de>
parents:
27978
diff
changeset
|
525 if (any (! isfinite (b(:)))) |
f0588f913755
glpk.m: Check if input is finite (bug #58505).
Markus Mützel <markus.muetzel@gmx.de>
parents:
27978
diff
changeset
|
526 error ("glpk: The values in B must be finite"); |
f0588f913755
glpk.m: Check if input is finite (bug #58505).
Markus Mützel <markus.muetzel@gmx.de>
parents:
27978
diff
changeset
|
527 endif |
5233 | 528 |
5237 | 529 ## 4) Vector with the lower bound of each variable |
5232 | 530 |
5237 | 531 if (nargin > 3) |
5233 | 532 if (isempty (lb)) |
8036
854683691d7a
fix invalid memory read in glpk
Jaroslav Hajek <highegg@gmail.com>
parents:
7151
diff
changeset
|
533 lb = zeros (nx, 1); |
28807
f0588f913755
glpk.m: Check if input is finite (bug #58505).
Markus Mützel <markus.muetzel@gmx.de>
parents:
27978
diff
changeset
|
534 elseif (! isreal (lb) || all (size (lb) > 1) || length (lb) != nx |
28812
f864f78440e6
allow glpk bounds to be infinite (bug #58505)
John W. Eaton <jwe@octave.org>
parents:
28807
diff
changeset
|
535 || any (isnan (lb))) |
28814
697562e2b09a
glpk.m: Correct English in error() messages.
Rik <rik@octave.org>
parents:
28812
diff
changeset
|
536 error ("glpk: LB must be a real-valued %d-by-1 column vector", nx); |
5233 | 537 endif |
538 else | |
5237 | 539 lb = zeros (nx, 1); |
7151 | 540 endif |
5233 | 541 |
5237 | 542 ## 5) Vector with the upper bound of each variable |
5232 | 543 |
5237 | 544 if (nargin > 4) |
5233 | 545 if (isempty (ub)) |
10541
e9d1a974a517
Eliminate repmat (Inf, x , y) and simply use Inf (x,y)
Rik <code@nomad.inbox5.com>
parents:
9758
diff
changeset
|
546 ub = Inf (nx, 1); |
28807
f0588f913755
glpk.m: Check if input is finite (bug #58505).
Markus Mützel <markus.muetzel@gmx.de>
parents:
27978
diff
changeset
|
547 elseif (! isreal (ub) || all (size (ub) > 1) || length (ub) != nx |
28812
f864f78440e6
allow glpk bounds to be infinite (bug #58505)
John W. Eaton <jwe@octave.org>
parents:
28807
diff
changeset
|
548 || any (isnan (ub))) |
28814
697562e2b09a
glpk.m: Correct English in error() messages.
Rik <rik@octave.org>
parents:
28812
diff
changeset
|
549 error ("glpk: UB must be a real-valued %d-by-1 column vector", nx); |
5233 | 550 endif |
551 else | |
10541
e9d1a974a517
Eliminate repmat (Inf, x , y) and simply use Inf (x,y)
Rik <code@nomad.inbox5.com>
parents:
9758
diff
changeset
|
552 ub = Inf (nx, 1); |
7151 | 553 endif |
5232 | 554 |
5237 | 555 ## 6) Sense of each constraint |
5232 | 556 |
5237 | 557 if (nargin > 5) |
558 if (isempty (ctype)) | |
559 ctype = repmat ("S", nc, 1); | |
560 elseif (! ischar (ctype) || all (size (ctype) > 1) || length (ctype) != nc) | |
28814
697562e2b09a
glpk.m: Correct English in error() messages.
Rik <rik@octave.org>
parents:
28812
diff
changeset
|
561 error ("glpk: CTYPE must be a char vector of length %d", nc); |
5237 | 562 elseif (! all (ctype == "F" | ctype == "U" | ctype == "S" |
10549 | 563 | ctype == "L" | ctype == "D")) |
10635
d1978e7364ad
Print name of function in error() string messages.
Rik <octave@nomad.inbox5.com>
parents:
10549
diff
changeset
|
564 error ("glpk: CTYPE must contain only F, U, S, L, or D"); |
5237 | 565 endif |
566 else | |
567 ctype = repmat ("S", nc, 1); | |
7151 | 568 endif |
5237 | 569 |
570 ## 7) Vector with the type of variables | |
571 | |
572 if (nargin > 6) | |
5289 | 573 if (isempty (vartype)) |
5233 | 574 vartype = repmat ("C", nx, 1); |
575 elseif (! ischar (vartype) || all (size (vartype) > 1) | |
10549 | 576 || length (vartype) != nx) |
28814
697562e2b09a
glpk.m: Correct English in error() messages.
Rik <rik@octave.org>
parents:
28812
diff
changeset
|
577 error ("glpk: VARTYPE must be a char vector of length %d", nx); |
5233 | 578 elseif (! all (vartype == "C" | vartype == "I")) |
10635
d1978e7364ad
Print name of function in error() string messages.
Rik <octave@nomad.inbox5.com>
parents:
10549
diff
changeset
|
579 error ("glpk: VARTYPE must contain only C or I"); |
5233 | 580 endif |
581 else | |
582 ## As default we consider continuous vars | |
583 vartype = repmat ("C", nx, 1); | |
584 endif | |
5232 | 585 |
5289 | 586 ## 8) Sense of optimization |
587 | |
588 if (nargin > 7) | |
589 if (isempty (sense)) | |
590 sense = 1; | |
28807
f0588f913755
glpk.m: Check if input is finite (bug #58505).
Markus Mützel <markus.muetzel@gmx.de>
parents:
27978
diff
changeset
|
591 elseif (ischar (sense) || all (size (sense) > 1) || ! isreal (sense) |
f0588f913755
glpk.m: Check if input is finite (bug #58505).
Markus Mützel <markus.muetzel@gmx.de>
parents:
27978
diff
changeset
|
592 || any (! isfinite (sense))) |
10635
d1978e7364ad
Print name of function in error() string messages.
Rik <octave@nomad.inbox5.com>
parents:
10549
diff
changeset
|
593 error ("glpk: SENSE must be an integer value"); |
5289 | 594 elseif (sense >= 0) |
595 sense = 1; | |
596 else | |
597 sense = -1; | |
598 endif | |
599 else | |
600 sense = 1; | |
601 endif | |
602 | |
603 ## 9) Parameters vector | |
5233 | 604 |
605 if (nargin > 8) | |
606 if (! isstruct (param)) | |
10635
d1978e7364ad
Print name of function in error() string messages.
Rik <octave@nomad.inbox5.com>
parents:
10549
diff
changeset
|
607 error ("glpk: PARAM must be a structure"); |
5233 | 608 endif |
609 else | |
610 param = struct (); | |
611 endif | |
5232 | 612 |
17180
54e251e699bb
Use the new GLPK API (bug #39038).
Sébastien Villemot <sebastien@debian.org>
parents:
15007
diff
changeset
|
613 [xopt, fmin, errnum, extra] = ... |
11471
994e2a93a8e2
Use uppercase 'A' to refer to matrix inputs in m-files.
Rik <octave@nomad.inbox5.com>
parents:
10821
diff
changeset
|
614 __glpk__ (c, A, b, lb, ub, ctype, vartype, sense, param); |
5232 | 615 |
616 endfunction | |
17338
1c89599167a6
maint: End m-files with 1 blank line.
Rik <rik@octave.org>
parents:
17290
diff
changeset
|
617 |
21030
e204d44f5069
glpk.m: Remove useless return statements after error and print_usage. Merged
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20852
diff
changeset
|
618 |
21130
9d7619605e5e
* glpk.m: Make tests conditional on HAVE_GLPK.
John W. Eaton <jwe@octave.org>
parents:
21030
diff
changeset
|
619 %!testif HAVE_GLPK |
21030
e204d44f5069
glpk.m: Remove useless return statements after error and print_usage. Merged
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20852
diff
changeset
|
620 %! sense = -1; |
e204d44f5069
glpk.m: Remove useless return statements after error and print_usage. Merged
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20852
diff
changeset
|
621 %! c = [10, 6, 4]'; |
e204d44f5069
glpk.m: Remove useless return statements after error and print_usage. Merged
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20852
diff
changeset
|
622 %! A = [1, 1, 1; 10, 4, 5; 2, 2, 6]; |
e204d44f5069
glpk.m: Remove useless return statements after error and print_usage. Merged
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20852
diff
changeset
|
623 %! b = [100, 600, 300]'; |
e204d44f5069
glpk.m: Remove useless return statements after error and print_usage. Merged
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20852
diff
changeset
|
624 %! ctype = ['U', 'U', 'U']'; |
e204d44f5069
glpk.m: Remove useless return statements after error and print_usage. Merged
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20852
diff
changeset
|
625 %! lb = [0, 0, 0]'; |
e204d44f5069
glpk.m: Remove useless return statements after error and print_usage. Merged
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20852
diff
changeset
|
626 %! ub = []; |
e204d44f5069
glpk.m: Remove useless return statements after error and print_usage. Merged
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20852
diff
changeset
|
627 %! vartype = ['C', 'C', 'C']'; |
e204d44f5069
glpk.m: Remove useless return statements after error and print_usage. Merged
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20852
diff
changeset
|
628 %! param.msglev = 0; |
e204d44f5069
glpk.m: Remove useless return statements after error and print_usage. Merged
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20852
diff
changeset
|
629 %! param.lpsolver = 1; |
e204d44f5069
glpk.m: Remove useless return statements after error and print_usage. Merged
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20852
diff
changeset
|
630 %! [xmin, fmin, errnum, extra] = glpk (c, A, b, lb, ub, ctype, vartype, ... |
e204d44f5069
glpk.m: Remove useless return statements after error and print_usage. Merged
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20852
diff
changeset
|
631 %! sense, param); |
21580
ecce63c99c3f
maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents:
21130
diff
changeset
|
632 %! assert (fmin, c' * xmin); |
21030
e204d44f5069
glpk.m: Remove useless return statements after error and print_usage. Merged
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20852
diff
changeset
|
633 %! for i = 1:3 |
21580
ecce63c99c3f
maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents:
21130
diff
changeset
|
634 %! assert (A(i,:) * xmin <= b(i)); |
21030
e204d44f5069
glpk.m: Remove useless return statements after error and print_usage. Merged
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20852
diff
changeset
|
635 %! endfor |
e204d44f5069
glpk.m: Remove useless return statements after error and print_usage. Merged
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20852
diff
changeset
|
636 |
21130
9d7619605e5e
* glpk.m: Make tests conditional on HAVE_GLPK.
John W. Eaton <jwe@octave.org>
parents:
21030
diff
changeset
|
637 %!testif HAVE_GLPK |
21030
e204d44f5069
glpk.m: Remove useless return statements after error and print_usage. Merged
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20852
diff
changeset
|
638 %! sense = 1; |
e204d44f5069
glpk.m: Remove useless return statements after error and print_usage. Merged
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20852
diff
changeset
|
639 %! c = [-1, -1]'; |
e204d44f5069
glpk.m: Remove useless return statements after error and print_usage. Merged
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20852
diff
changeset
|
640 %! A = [-2, 5; 2, -2]; |
e204d44f5069
glpk.m: Remove useless return statements after error and print_usage. Merged
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20852
diff
changeset
|
641 %! b = [5, 1]'; |
e204d44f5069
glpk.m: Remove useless return statements after error and print_usage. Merged
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20852
diff
changeset
|
642 %! ctype = ['U', 'U']'; |
e204d44f5069
glpk.m: Remove useless return statements after error and print_usage. Merged
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20852
diff
changeset
|
643 %! lb = [0, 0]'; |
e204d44f5069
glpk.m: Remove useless return statements after error and print_usage. Merged
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20852
diff
changeset
|
644 %! ub = []; |
e204d44f5069
glpk.m: Remove useless return statements after error and print_usage. Merged
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20852
diff
changeset
|
645 %! vartype = ['I', 'I']'; |
e204d44f5069
glpk.m: Remove useless return statements after error and print_usage. Merged
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20852
diff
changeset
|
646 %! param.msglev = 0; |
e204d44f5069
glpk.m: Remove useless return statements after error and print_usage. Merged
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20852
diff
changeset
|
647 %! [xmin, fmin, errnum, extra] = glpk (c, A, b, lb, ub, ctype, vartype, ... |
e204d44f5069
glpk.m: Remove useless return statements after error and print_usage. Merged
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20852
diff
changeset
|
648 %! sense, param); |
21580
ecce63c99c3f
maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents:
21130
diff
changeset
|
649 %! assert (fmin, c' * xmin); |
21030
e204d44f5069
glpk.m: Remove useless return statements after error and print_usage. Merged
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20852
diff
changeset
|
650 %! for i = 1:2 |
21580
ecce63c99c3f
maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents:
21130
diff
changeset
|
651 %! assert (A(i,:) * xmin <= b(i)); |
21030
e204d44f5069
glpk.m: Remove useless return statements after error and print_usage. Merged
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20852
diff
changeset
|
652 %! endfor |
e204d44f5069
glpk.m: Remove useless return statements after error and print_usage. Merged
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20852
diff
changeset
|
653 |
e204d44f5069
glpk.m: Remove useless return statements after error and print_usage. Merged
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20852
diff
changeset
|
654 |
21130
9d7619605e5e
* glpk.m: Make tests conditional on HAVE_GLPK.
John W. Eaton <jwe@octave.org>
parents:
21030
diff
changeset
|
655 %!testif HAVE_GLPK |
21030
e204d44f5069
glpk.m: Remove useless return statements after error and print_usage. Merged
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20852
diff
changeset
|
656 %! sense = 1; |
e204d44f5069
glpk.m: Remove useless return statements after error and print_usage. Merged
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20852
diff
changeset
|
657 %! c = [0, 0, 0, -1, -1]'; |
e204d44f5069
glpk.m: Remove useless return statements after error and print_usage. Merged
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20852
diff
changeset
|
658 %! A = [-2, 0, 0, 1, 0; 0, 1, 0, 0, 2; 0, 0, 1, 3, 2]; |
e204d44f5069
glpk.m: Remove useless return statements after error and print_usage. Merged
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20852
diff
changeset
|
659 %! b = [4, 12, 18]'; |
e204d44f5069
glpk.m: Remove useless return statements after error and print_usage. Merged
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20852
diff
changeset
|
660 %! ctype = ['S', 'S', 'S']'; |
e204d44f5069
glpk.m: Remove useless return statements after error and print_usage. Merged
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20852
diff
changeset
|
661 %! lb = [0, 0, 0, 0, 0]'; |
e204d44f5069
glpk.m: Remove useless return statements after error and print_usage. Merged
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20852
diff
changeset
|
662 %! ub = []; |
e204d44f5069
glpk.m: Remove useless return statements after error and print_usage. Merged
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20852
diff
changeset
|
663 %! vartype = ['C', 'C', 'C', 'C', 'C']'; |
e204d44f5069
glpk.m: Remove useless return statements after error and print_usage. Merged
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20852
diff
changeset
|
664 %! param.msglev = 0; |
e204d44f5069
glpk.m: Remove useless return statements after error and print_usage. Merged
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20852
diff
changeset
|
665 %! [xmin, fmin, errnum, extra] = glpk (c, A, b, lb, ub, ctype, vartype, ... |
e204d44f5069
glpk.m: Remove useless return statements after error and print_usage. Merged
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20852
diff
changeset
|
666 %! sense, param); |
21580
ecce63c99c3f
maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents:
21130
diff
changeset
|
667 %! assert (fmin, c' * xmin); |
ecce63c99c3f
maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents:
21130
diff
changeset
|
668 %! assert (A * xmin, b); |
28807
f0588f913755
glpk.m: Check if input is finite (bug #58505).
Markus Mützel <markus.muetzel@gmx.de>
parents:
27978
diff
changeset
|
669 |
28912
0de38a6ef693
maint: Use Octave convention of space after function name in scripts dir.
Rik <rik@octave.org>
parents:
28815
diff
changeset
|
670 %!error <C .* finite values> glpk (NaN, 2, 3) |
0de38a6ef693
maint: Use Octave convention of space after function name in scripts dir.
Rik <rik@octave.org>
parents:
28815
diff
changeset
|
671 %!error <A must be finite> glpk (1, NaN, 3) |
0de38a6ef693
maint: Use Octave convention of space after function name in scripts dir.
Rik <rik@octave.org>
parents:
28815
diff
changeset
|
672 %!error <B must be finite> glpk (1, 2, NaN) |
0de38a6ef693
maint: Use Octave convention of space after function name in scripts dir.
Rik <rik@octave.org>
parents:
28815
diff
changeset
|
673 %!error <LB must be a real-valued> glpk (1, 2, 3, NaN) |
0de38a6ef693
maint: Use Octave convention of space after function name in scripts dir.
Rik <rik@octave.org>
parents:
28815
diff
changeset
|
674 %!error <UB must be a real-valued> glpk (1, 2, 3, 4, NaN) |
0de38a6ef693
maint: Use Octave convention of space after function name in scripts dir.
Rik <rik@octave.org>
parents:
28815
diff
changeset
|
675 %!error <SENSE must be .* integer> glpk (1, 2, 3, 4, 5, "F", "C", NaN) |