Mercurial > hg > octave-thorsten
annotate scripts/deprecated/glpkmex.m @ 12304:c16ce72e0a22 release-3-4-x
Deprecate glpkmex function and remove from documentation.
author | Rik <octave@nomad.inbox5.com> |
---|---|
date | Sun, 30 Jan 2011 07:52:36 -0800 |
parents | scripts/optimization/glpkmex.m@39bf9ee145a8 |
children |
rev | line source |
---|---|
11523 | 1 ## Copyright (C) 2005-2011 Nicolo' Giorgetti |
5237 | 2 ## |
3 ## This file is part of Octave. | |
4 ## | |
5 ## Octave is free software; you can redistribute it and/or modify it | |
6 ## under the terms of the GNU General Public License as published by | |
7016 | 7 ## the Free Software Foundation; either version 3 of the License, or (at |
8 ## your option) any later version. | |
5237 | 9 ## |
10 ## Octave is distributed in the hope that it will be useful, but | |
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 ## General Public License for more details. | |
14 ## | |
15 ## You should have received a copy of the GNU General Public License | |
7016 | 16 ## along with Octave; see the file COPYING. If not, see |
17 ## <http://www.gnu.org/licenses/>. | |
5237 | 18 |
5244 | 19 ## -*- texinfo -*- |
11471
994e2a93a8e2
Use uppercase 'A' to refer to matrix inputs in m-files.
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
20 ## @deftypefn {Function File} {[@var{xopt}, @var{fmin}, @var{status}, @var{extra}] =} glpkmex (@var{sense}, @var{c}, @var{A}, @var{b}, @var{ctype}, @var{lb}, @var{ub}, @var{vartype}, @var{param}, @var{lpsolver}, @var{save_pb}) |
9051
1bf0ce0930be
Grammar check TexInfo in all .m files
Rik <rdrider0-list@yahoo.com>
parents:
7017
diff
changeset
|
21 ## This function is provided for compatibility with the old @sc{matlab} |
10793
be55736a0783
Grammarcheck the documentation from m-files.
Rik <octave@nomad.inbox5.com>
parents:
9245
diff
changeset
|
22 ## interface to the GNU @sc{glpk} library. For Octave code, you should use |
5244 | 23 ## the @code{glpk} function instead. |
12289
39bf9ee145a8
Add glpkmex function to documentation.
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
24 ## @seealso{glpk} |
5375 | 25 ## @end deftypefn |
5237 | 26 |
27 function [xopt, fopt, status, extra] = glpkmex (varargin) | |
28 | |
12304
c16ce72e0a22
Deprecate glpkmex function and remove from documentation.
Rik <octave@nomad.inbox5.com>
parents:
12289
diff
changeset
|
29 persistent warned = false; |
c16ce72e0a22
Deprecate glpkmex function and remove from documentation.
Rik <octave@nomad.inbox5.com>
parents:
12289
diff
changeset
|
30 if (! warned) |
c16ce72e0a22
Deprecate glpkmex function and remove from documentation.
Rik <octave@nomad.inbox5.com>
parents:
12289
diff
changeset
|
31 warned = true; |
c16ce72e0a22
Deprecate glpkmex function and remove from documentation.
Rik <octave@nomad.inbox5.com>
parents:
12289
diff
changeset
|
32 warning ("Octave:deprecated-function", |
c16ce72e0a22
Deprecate glpkmex function and remove from documentation.
Rik <octave@nomad.inbox5.com>
parents:
12289
diff
changeset
|
33 "glpkmex is obsolete and will be removed from a future version of Octave; please use glpk instead"); |
c16ce72e0a22
Deprecate glpkmex function and remove from documentation.
Rik <octave@nomad.inbox5.com>
parents:
12289
diff
changeset
|
34 endif |
c16ce72e0a22
Deprecate glpkmex function and remove from documentation.
Rik <octave@nomad.inbox5.com>
parents:
12289
diff
changeset
|
35 |
5237 | 36 ## If there is no input output the version and syntax |
37 if (nargin < 4 || nargin > 11) | |
6046 | 38 print_usage (); |
5237 | 39 return; |
40 endif | |
41 | |
42 ## reorder args: | |
43 ## | |
44 ## glpkmex glpk | |
45 ## | |
46 ## 1 sense c | |
47 ## 2 c a | |
48 ## 3 a b | |
49 ## 4 b lb | |
50 ## 5 ctype ub | |
51 ## 6 lb ctype | |
52 ## 7 ub vartype | |
53 ## 8 vartype sense | |
54 ## 9 param param | |
55 ## 10 lpsolver | |
56 ## 11 savepb | |
57 | |
58 sense = varargin{1}; | |
59 c = varargin{2}; | |
60 a = varargin{3}; | |
61 b = varargin{4}; | |
62 | |
63 nx = length (c); | |
64 | |
65 if (nargin > 4) | |
66 ctype = varargin{5}; | |
67 else | |
68 ctype = repmat ("U", nx, 1); | |
69 endif | |
70 | |
71 if (nargin > 5) | |
72 lb = varargin{6}; | |
73 else | |
74 lb = repmat (-Inf, nx, 1); | |
75 endif | |
76 | |
77 if (nargin > 6) | |
78 ub = varargin{7}; | |
79 else | |
80 ub = repmat (Inf, nx, 1); | |
81 endif | |
82 | |
83 if (nargin > 7) | |
84 vartype = varargin{8}; | |
85 else | |
86 vartype = repmat ("C", nx, 1); | |
87 endif | |
88 | |
89 if (nargin > 8) | |
90 param = varargin{9}; | |
91 else | |
92 param = struct (); | |
93 endif | |
94 | |
95 if (nargin > 9 && ! isfield (param, "lpsolver")) | |
96 param.lpsolver = varargin{10}; | |
97 endif | |
98 | |
99 if (nargin > 10 && ! isfield (param, "save")) | |
5241 | 100 param.save = varargin{11}; |
5237 | 101 endif |
102 | |
103 if (nargout == 0) | |
104 glpk (c, a, b, lb, ub, ctype, vartype, sense, param); | |
105 elseif (nargout == 1) | |
106 xopt = glpk (c, a, b, lb, ub, ctype, vartype, sense, param); | |
107 elseif (nargout == 2) | |
108 [xopt, fopt] = glpk (c, a, b, lb, ub, ctype, vartype, sense, param); | |
109 elseif (nargout == 3) | |
110 [xopt, fopt, status] = ... | |
111 glpk (c, a, b, lb, ub, ctype, vartype, sense, param); | |
112 else | |
113 [xopt, fopt, status, extra] = ... | |
114 glpk (c, a, b, lb, ub, ctype, vartype, sense, param); | |
115 endif | |
116 | |
117 endfunction |