annotate main/optim/inst/optim_problems.m @ 9930:d30cfca46e8a octave-forge

optim: upgrade license to GPLv3+ and mention on DESCRIPTION the other package licenses
author carandraug
date Fri, 30 Mar 2012 15:14:48 +0000
parents 55c73f24f0ee
children fba8cdd5f9ad
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7231
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1 %% Copyright (C) 2007 Paul Kienzle (sort-based lookup in ODE solver)
8822
55c73f24f0ee Updated Thomas Treichl e-mail address
carandraug
parents: 7411
diff changeset
2 %% Copyright (C) 2009 Thomas Treichl <thomas.treichl@gmx.net>
9930
d30cfca46e8a optim: upgrade license to GPLv3+ and mention on DESCRIPTION the other package licenses
carandraug
parents: 8822
diff changeset
3 %% Copyright (C) 2010 Olaf Till <olaf.till@uni-jena.de>
7231
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
4 %%
9930
d30cfca46e8a optim: upgrade license to GPLv3+ and mention on DESCRIPTION the other package licenses
carandraug
parents: 8822
diff changeset
5 %% This program is free software; you can redistribute it and/or modify it under
d30cfca46e8a optim: upgrade license to GPLv3+ and mention on DESCRIPTION the other package licenses
carandraug
parents: 8822
diff changeset
6 %% the terms of the GNU General Public License as published by the Free Software
d30cfca46e8a optim: upgrade license to GPLv3+ and mention on DESCRIPTION the other package licenses
carandraug
parents: 8822
diff changeset
7 %% Foundation; either version 3 of the License, or (at your option) any later
d30cfca46e8a optim: upgrade license to GPLv3+ and mention on DESCRIPTION the other package licenses
carandraug
parents: 8822
diff changeset
8 %% version.
7231
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
9 %%
9930
d30cfca46e8a optim: upgrade license to GPLv3+ and mention on DESCRIPTION the other package licenses
carandraug
parents: 8822
diff changeset
10 %% This program is distributed in the hope that it will be useful, but WITHOUT
d30cfca46e8a optim: upgrade license to GPLv3+ and mention on DESCRIPTION the other package licenses
carandraug
parents: 8822
diff changeset
11 %% ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
d30cfca46e8a optim: upgrade license to GPLv3+ and mention on DESCRIPTION the other package licenses
carandraug
parents: 8822
diff changeset
12 %% FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
d30cfca46e8a optim: upgrade license to GPLv3+ and mention on DESCRIPTION the other package licenses
carandraug
parents: 8822
diff changeset
13 %% details.
7231
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
14 %%
9930
d30cfca46e8a optim: upgrade license to GPLv3+ and mention on DESCRIPTION the other package licenses
carandraug
parents: 8822
diff changeset
15 %% You should have received a copy of the GNU General Public License along with
d30cfca46e8a optim: upgrade license to GPLv3+ and mention on DESCRIPTION the other package licenses
carandraug
parents: 8822
diff changeset
16 %% this program; if not, see <http://www.gnu.org/licenses/>.
d30cfca46e8a optim: upgrade license to GPLv3+ and mention on DESCRIPTION the other package licenses
carandraug
parents: 8822
diff changeset
17
d30cfca46e8a optim: upgrade license to GPLv3+ and mention on DESCRIPTION the other package licenses
carandraug
parents: 8822
diff changeset
18 %% Problems for testing optimizers. Documentation is in the code.
7231
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
19
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
20 function ret = optim_problems ()
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
21
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
22 %% As little external code as possible is called. This leads to some
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
23 %% duplication of external code. The advantages are that thus these
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
24 %% problems do not change with evolving external code, and that
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
25 %% optimization results in Octave can be compared with those in Matlab
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
26 %% without influence of differences in external code (e.g. ODE
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
27 %% solvers). Even calling 'interp1 (..., ..., ..., 'linear')' is
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
28 %% avoided by using an internal subfunction, although this is possibly
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
29 %% too cautious.
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
30 %%
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
31 %% For cross-program comparison of optimizers, the code of these
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
32 %% problems is intended to be Matlab compatible.
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
33 %%
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
34 %% External data may be loaded, which should be supplied in the
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
35 %% 'private/' subdirectory. Use the variable 'ddir', which contains
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
36 %% the path to this directory.
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
37
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
38 %% Note: The difficulty of problems with dynamic models often
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
39 %% decisively depends on the the accuracy of the used ODE(DAE)-solver.
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
40
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
41 %% Description of the returned structure
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
42 %%
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
43 %% According to 3 classes of problems, there are (or should be) three
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
44 %% fields: 'curve' (curve fitting), 'general' (general optimization),
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
45 %% and 'zero' (zero finding). The subfields are labels for the
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
46 %% particular problems.
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
47 %%
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
48 %% Under the label fields, there are subfields mostly identical
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
49 %% between the 3 classes of problems (some may contain empty values):
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
50 %%
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
51 %% .f: handle of an internally defined objective function (argument:
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
52 %% column vector of parameters), meant for minimization, or to a
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
53 %% 'model function' (arguments: independents, column vector of
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
54 %% parameters) in the case of curve fitting, where .f should return a
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
55 %% matrix of equal dimensions as .data.y below.
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
56 %%
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
57 %% .dfdp: handle of internally defined function for jacobian of
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
58 %% objective function or 'model function', respectively.
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
59 %%
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
60 %% .init_p: initial parameters, column vector
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
61 %%
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
62 %% possibly .init_p_b: two column matrix of ranges to choose initial
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
63 %% parameters from
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
64 %%
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
65 %% possibly .init_p_f: handle of internally defined function which
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
66 %% returns a column vector of initial parameters unique to the index
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
67 %% given as function argument; given '0' as function argument,
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
68 %% .init_p_f returns the maximum index
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
69 %%
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
70 %% .result.p: parameters of best known result
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
71 %%
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
72 %% possibly .result.obj: value of objective function for .result.p (or
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
73 %% sum of squared residuals in curve fitting).
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
74 %%
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
75 %% .data.x: matrix of independents (curve fitting)
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
76 %%
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
77 %% .data.y: matrix of observations, dimensions may be independent of
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
78 %% .data.x (curve fitting)
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
79 %%
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
80 %% .data.wt: matrix of weights, same dimensions as .data.y (curve
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
81 %% fitting)
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
82 %%
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
83 %% .data.cov: covariance matrix of .data.y(:) (not necessarily a
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
84 %% diagonal matrix, which could be expressed in .data.wt)
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
85 %%
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
86 %% .strict_inequc, .non_strict_inequc, .equc: 'strict' inequality
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
87 %% constraints (<, >), 'non-strict' inequality constraints (<=, >=),
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
88 %% and equality constraints, respectively. Subfields are: .bounds
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
89 %% (except in equality constraints): two-column matrix of ranges;
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
90 %% .linear: cell-array {m, v}, meaning linear constraints m.' *
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
91 %% parameters + v >|>=|== 0; .general: handle of internally defined
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
92 %% function h with h (p) >|>=|== 0; possibly .general_dcdp: handle of
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
93 %% internally defined function (argument: parameters) returning the
7240
e95b49939947 - INDEX: added optim_problems,
i7tiol
parents: 7231
diff changeset
94 %% jacobian of the constraints given in .general. For the sake of
e95b49939947 - INDEX: added optim_problems,
i7tiol
parents: 7231
diff changeset
95 %% optimizers which can exploit this, the function in subfield
e95b49939947 - INDEX: added optim_problems,
i7tiol
parents: 7231
diff changeset
96 %% .general may accept a logical index vector as an optional second
e95b49939947 - INDEX: added optim_problems,
i7tiol
parents: 7231
diff changeset
97 %% argument, returning only the indexed constraint values.
7231
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
98
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
99
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
100 %% Please keep the following list of problems current.
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
101 %%
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
102 %% .curve.p_1, .curve.p_2, .curve.p_3_d2: from 'Comparison of gradient
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
103 %% methods for the solution of nonlinear parameter estimation
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
104 %% problems' (1970), Yonathan Bard, Siam Journal on Numerical Analysis
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
105 %% 7(1), 157--186. The numbering of problems is the same as in the
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
106 %% article. Since Bard used strict bounds, testing optimizers which
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
107 %% used penalization for bounds, the bounds are changed here to allow
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
108 %% testing with non-strict bounds (<= or >=). .curve.p_3_d2 involves
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
109 %% dynamic modeling. These are not necessarily difficult problems.
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
110 %%
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
111 %% .curve.p_3_d2_noweights: problem .curve.p_3_d2 equivalently
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
112 %% re-formulated without weights.
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
113 %%
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
114 %% .curve.p_r: A seemingly more difficult 'real life' problem with
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
115 %% dynamic modeling. To assess optimizers, .init_p_f should be used
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
116 %% with 1:64. There should be two groups of results, indicating the
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
117 %% presence of two local minima. Olaf Till <olaf.till@uni-jena.de>
7240
e95b49939947 - INDEX: added optim_problems,
i7tiol
parents: 7231
diff changeset
118 %%
e95b49939947 - INDEX: added optim_problems,
i7tiol
parents: 7231
diff changeset
119 %% .....schittkowski_...: Klaus Schittkowski: 'More test examples for
e95b49939947 - INDEX: added optim_problems,
i7tiol
parents: 7231
diff changeset
120 %% nonlinear programming codes.' Lecture Notes in Economics and
e95b49939947 - INDEX: added optim_problems,
i7tiol
parents: 7231
diff changeset
121 %% Mathematical Systems 282, Berlin 1987. The published problems are
e95b49939947 - INDEX: added optim_problems,
i7tiol
parents: 7231
diff changeset
122 %% numbered from 201 to 395 and may appear here under the fields
e95b49939947 - INDEX: added optim_problems,
i7tiol
parents: 7231
diff changeset
123 %% .curve, .general, or .zero.
e95b49939947 - INDEX: added optim_problems,
i7tiol
parents: 7231
diff changeset
124 %%
7411
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
125 %% .general.schittkowski_281: 10 parameters, unconstrained.
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
126 %%
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
127 %% .general.schittkowski_289: 30 parameters, unconstrained.
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
128 %%
7248
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
129 %% .general.schittkowski_327 and
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
130 %%
7240
e95b49939947 - INDEX: added optim_problems,
i7tiol
parents: 7231
diff changeset
131 %% .curve.schittkowski_327: Two parameters, one general inequality
e95b49939947 - INDEX: added optim_problems,
i7tiol
parents: 7231
diff changeset
132 %% constraint, two bounds. The best solution given in the publication
e95b49939947 - INDEX: added optim_problems,
i7tiol
parents: 7231
diff changeset
133 %% seems not very good (it probably has been achieved with general
e95b49939947 - INDEX: added optim_problems,
i7tiol
parents: 7231
diff changeset
134 %% minimization, not curve fitting) and has been replaced here by a
7248
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
135 %% better (leasqr).
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
136 %%
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
137 %% .curve.schittkowski_372 and
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
138 %%
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
139 %% .general.schittkowski_372: 9 parameters, 12 general inequality
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
140 %% constraints, 6 bounds. Infeasible initial parameters
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
141 %% (.curve.schittkowski_372.init_p_f(1) provides a set of more or less
7411
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
142 %% feasible parameters). leasqr sticks at the (feasible) initial
7248
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
143 %% values. sqp has no problems.
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
144 %%
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
145 %% .curve.schittkowski_373: 9 parameters, 6 equality constraints.
7411
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
146 %% Infeasible initial parameters (.curve.schittkowski_373.init_p_f(1)
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
147 %% provides a set of more or less feasible parameters). leasqr sticks
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
148 %% at the (feasible) initial values. sqp has no problems.
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
149 %%
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
150 %% .general.schittkowski_391: 30 parameters, unconstrained. The best
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
151 %% solution given in the publication seems not very good, obviously
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
152 %% the used routine had not managed to get very far from the starting
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
153 %% parameters; it has been replaced here by a better (Octaves
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
154 %% fminunc). The result still varies widely (without much changes in
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
155 %% objective function) with changes of starting values. Maybe not a
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
156 %% very good test problem, no well defined minimum ...
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
157
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
158 %% needed for some anonymous functions
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
159 if (exist ('ifelse') ~= 5)
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
160 ifelse = @ scalar_ifelse;
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
161 end
7248
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
162
7231
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
163 if (~exist ('OCTAVE_VERSION'))
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
164 NA = NaN;
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
165 end
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
166
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
167 %% determine the directory of this functions file
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
168 fdir = fileparts (mfilename ('fullpath'));
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
169 %% data directory
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
170 ddir = sprintf ('%s%sprivate%s', fdir, filesep, filesep);
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
171
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
172 ret.curve.p_1.dfdp = [];
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
173 ret.curve.p_1.init_p = [1; 1; 1];
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
174 ret.curve.p_1.data.x = cat (2, ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
175 (1:15).', ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
176 (15:-1:1).', ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
177 [(1:8).'; (7:-1:1).']);
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
178 ret.curve.p_1.data.y = [.14; .18; .22; .25; .29; .32; .35; .39; ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
179 .37; .58; .73; .96; 1.34; 2.10; 4.39];
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
180 ret.curve.p_1.data.wt = [];
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
181 ret.curve.p_1.data.cov = [];
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
182 ret.curve.p_1.result.p = [.08241040; 1.133033; 2.343697];
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
183 ret.curve.p_1.strict_inequc.bounds = [0, 100; 0, 100; 0, 100];
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
184 ret.curve.p_1.strict_inequc.linear = [];
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
185 ret.curve.p_1.strict_inequc.general = [];
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
186 ret.curve.p_1.non_strict_inequc.bounds = ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
187 [eps, 100; eps, 100; eps, 100];
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
188 ret.curve.p_1.non_strict_inequc.linear = [];
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
189 ret.curve.p_1.non_strict_inequc.general = [];
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
190 ret.curve.p_1.equc.linear = [];
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
191 ret.curve.p_1.equc.general = [];
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
192 ret.curve.p_1.f = @ f_1;
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
193
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
194 ret.curve.p_2.dfdp = [];
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
195 ret.curve.p_2.init_p = [0; 0; 0; 0; 0];
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
196 ret.curve.p_2.data.x = [.871, .643, .550; ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
197 .228, .669, .854; ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
198 .528, .229, .170; ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
199 .110, .354, .337; ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
200 .911, .056, .493; ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
201 .476, .154, .918; ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
202 .655, .421, .077; ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
203 .649, .140, .199; ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
204 .995, .045, NA; ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
205 .130, .016, .195; ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
206 .823, .690, .690; ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
207 .768, .992, .389; ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
208 .203, .740, .120; ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
209 .302, .519, .221; ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
210 .991, .450, .249; ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
211 .224, .030, .502; ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
212 .428, .127, .772; ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
213 .552, .494, .110; ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
214 .461, .824, .714; ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
215 .799, .494, .295];
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
216 ret.curve.p_2.data.y = zeros (20, 3);
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
217 ret.curve.p_2.data.wt = [];
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
218 ret.curve.p_2.data.cov = [];
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
219 ret.curve.p_2.data.misc = [4.36, 5.21, 5.35; ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
220 4.99, 3.30, 3.10; ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
221 1.67, NA, 2.75; ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
222 2.17, 1.48, 1.49; ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
223 2.98, 4.69, 4.23; ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
224 4.46, 3.87, 3.15; ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
225 1.79, 3.18, 3.57; ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
226 1.71, 3.13, 3.07; ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
227 3.07, 5.01, 4.58; ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
228 0.94, 0.93, 0.74; ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
229 4.97, 5.37, 5.35; ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
230 4.32, 4.85, 5.46; ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
231 2.17, 1.78, 2.43; ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
232 2.22, 2.18, 2.44; ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
233 2.88, 4.90, 5.11; ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
234 2.29, 1.94, 1.46; ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
235 3.76, 3.39, 2.71; ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
236 1.99, 2.93, 3.31; ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
237 4.95, 4.08, 4.19; ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
238 2.96, 4.26, 4.48];
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
239 ret.curve.p_2.result.p = [.9925145; 2.005293; 3.999732; ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
240 2.680371; .4977683]; % from maximum
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
241 % likelyhood optimization
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
242 ret.curve.p_2.strict_inequc.bounds = [];
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
243 ret.curve.p_2.strict_inequc.linear = [];
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
244 ret.curve.p_2.strict_inequc.general = [];
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
245 ret.curve.p_2.non_strict_inequc.bounds = [];
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
246 ret.curve.p_2.non_strict_inequc.linear = [];
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
247 ret.curve.p_2.non_strict_inequc.general = [];
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
248 ret.curve.p_2.equc.linear = [];
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
249 ret.curve.p_2.equc.general = [];
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
250 ret.curve.p_2.f = @ (x, p) f_2 (x, p, ret.curve.p_2.data.misc);
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
251
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
252
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
253
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
254 ret.curve.p_3_d2.dfdp = [];
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
255 ret.curve.p_3_d2.init_p = [.01; .01; .001; .001; .02; .001];
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
256 ret.curve.p_3_d2.data.x = [0; 12.5; 25; 37.5; 50; ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
257 62.5; 75; 87.5; 100];
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
258 ret.curve.p_3_d2.data.y=[1 1 0 0 0 ; ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
259 .945757 .961201 .494861 .154976 .111485; ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
260 .926486 .928762 .690492 .314501 .236263; ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
261 .917668 .915966 .751806 .709300 .311747; ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
262 .928987 .917542 .771559 1.19224 .333096; ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
263 .927782 .920075 .780903 1.68815 .340324; ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
264 .925304 .912330 .790539 2.19539 .356787; ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
265 .925083 .917684 .783933 2.74211 .358283; ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
266 .917277 .907529 .779259 3.20025 .361969];
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
267 ret.curve.p_3_d2.data.y(:, 3) = ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
268 ret.curve.p_3_d2.data.y(:, 3) / 10;
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
269 ret.curve.p_3_d2.data.y(:, 4:5) = ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
270 ret.curve.p_3_d2.data.y(:, 4:5) / 1000;
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
271 ret.curve.p_3_d2.data.wt = repmat ([.1, .1, 1, 10, 100], 9, 1);
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
272 ret.curve.p_3_d2.data.cov = [];
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
273 ret.curve.p_3_d2.result.p = [.6358247e-2; ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
274 .6774551e-1; ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
275 .5914274e-4; ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
276 .4944010e-3; ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
277 .1018828; ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
278 .4210526e-3];
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
279 ret.curve.p_3_d2.strict_inequc.bounds = [0, 1; ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
280 0, 1; ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
281 0, .1; ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
282 0, .1; ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
283 0, 2; ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
284 0, .1];
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
285 ret.curve.p_3_d2.strict_inequc.linear = [];
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
286 ret.curve.p_3_d2.strict_inequc.general = [];
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
287 ret.curve.p_3_d2.non_strict_inequc.bounds = [eps, 1; ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
288 eps, 1; ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
289 eps, .1; ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
290 eps, .1; ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
291 eps, 2; ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
292 eps, .1];
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
293 ret.curve.p_3_d2.non_strict_inequc.linear = [];
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
294 ret.curve.p_3_d2.non_strict_inequc.general = [];
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
295 ret.curve.p_3_d2.equc.linear = [];
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
296 ret.curve.p_3_d2.equc.general = [];
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
297 ret.curve.p_3_d2.f = @ f_3;
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
298
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
299 ret.curve.p_3_d2_noweights = ret.curve.p_3_d2;
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
300 ret.curve.p_3_d2_noweights.data.wt = [];
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
301 ret.curve.p_3_d2_noweights.data.y(:, 1:2) = ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
302 ret.curve.p_3_d2_noweights.data.y(:, 1:2) * .1;
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
303 ret.curve.p_3_d2_noweights.data.y(:, 4) = ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
304 ret.curve.p_3_d2_noweights.data.y(:, 4) * 10;
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
305 ret.curve.p_3_d2_noweights.data.y(:, 5) = ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
306 ret.curve.p_3_d2_noweights.data.y(:, 5) * 100;
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
307 ret.curve.p_3_d2_noweights.f = @ f_3_noweights;
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
308
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
309 ret.curve.p_r.dfdp = [];
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
310 ret.curve.p_r.init_p = [.3; .03; .003; .7; 1000; .0205];
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
311 ret.curve.p_r.init_p_b = [.3, .5; ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
312 .03, .05; ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
313 .003, .005; ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
314 .7, .9; ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
315 1000, 1300; ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
316 .0205, .023];
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
317 ret.curve.p_r.init_p_f = @ (id) pc2 (ret.curve.p_r.init_p_b, id);
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
318 hook.ns = [84; 84; 85; 86; 84; 84; 84; 84];
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
319 xb = [0.2, 0.8640; ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
320 0.2, 0.5320; ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
321 0.2, 0.4856; ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
322 0.2, 0.4210; ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
323 0.2, 0.3328; ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
324 0.2, 0.2996; ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
325 0.2, 0.2664; ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
326 0.2, 0.2498];
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
327 ns = cat (1, 0, cumsum (hook.ns));
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
328 x = zeros (ns(end), 1);
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
329 for id = 1:8
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
330 x(ns(id) + 1 : ns(id + 1)) = ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
331 linspace (xb(id, 1), xb(id, 2), hook.ns(id)).';
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
332 end
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
333 hook.t = x;
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
334 ret.curve.p_r.data.x = x;
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
335 ret.curve.p_r.data.y = ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
336 load (sprintf ('%soptim_problems_p_r_y.data', ddir));
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
337 ret.curve.p_r.data.wt = [];
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
338 ret.curve.p_r.data.cov = [];
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
339 ret.curve.p_r.result.p = [4.742909e-01; ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
340 3.837951e-02; ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
341 3.652570e-03; ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
342 7.725986e-01; ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
343 1.180967e+03; ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
344 2.107000e-02];
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
345 ret.curve.p_r.result.obj = 0.2043396;
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
346 ret.curve.p_r.strict_inequc.bounds = [];
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
347 ret.curve.p_r.strict_inequc.linear = [];
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
348 ret.curve.p_r.strict_inequc.general = [];
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
349 ret.curve.p_r.non_strict_inequc.bounds = [];
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
350 ret.curve.p_r.non_strict_inequc.linear = [];
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
351 ret.curve.p_r.non_strict_inequc.general = [];
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
352 ret.curve.p_r.equc.linear = [];
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
353 ret.curve.p_r.equc.general = [];
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
354 hook.mc = [2.0019999999999999e-01, 1.9939999999999999e-01, ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
355 1.9939999999999999e-01, 1.9780000000000000e-01, ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
356 2.0080000000000001e-01, 1.9960000000000000e-01, ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
357 1.9960000000000000e-01, 1.9980000000000001e-01; ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
358 ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
359 2.0060000000000000e-01, 2.0160000000000000e-01, ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
360 2.0200000000000001e-01, 2.0200000000000001e-01, ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
361 2.0180000000000001e-01, 2.0899999999999999e-01, ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
362 2.0860000000000001e-01, 2.0820000000000000e-01; ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
363 ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
364 2.1999144799999999e-02, 2.1998803099999999e-02, ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
365 2.2000449599999999e-02, 2.2000024399999998e-02, ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
366 2.1998160999999999e-02, 2.1999289000000002e-02, ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
367 2.1998038800000001e-02, 2.2000270999999998e-02; ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
368 ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
369 -6.8806551999999986e-03, -1.3768898999999999e-02, ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
370 -1.6065479000000001e-02, -2.0657919600000001e-02, ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
371 -3.4479971099999999e-02, -4.5934394099999998e-02, ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
372 -6.9011619100000005e-02, -9.1971348400000000e-02; ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
373 ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
374 2.3383865100000002e-02, 2.4768462500000001e-02, ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
375 2.5231915899999999e-02, 2.6155515300000001e-02, ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
376 2.8933514200000000e-02, 3.1235568599999999e-02, ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
377 3.5874086299999997e-02, 4.0490560699999997e-02; ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
378 ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
379 -1.8240616806039459e+05, -1.6895474269973661e+03, ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
380 -8.1072652464694931e+02, -7.0113302985566395e+02, ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
381 1.0929964862867249e+04, 3.5665776039585688e+02, ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
382 5.7400262910547769e+02, 9.1737316974342252e+02; ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
383 ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
384 1.0965398741890911e+05, 1.0131334821116490e+03, ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
385 4.8504892529762208e+02, 4.1801020186158411e+02, ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
386 -6.6178457662355086e+03, -2.2103886018172699e+02, ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
387 -3.5529578864017282e+02, -5.6690686490678263e+02; ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
388 ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
389 -2.1972917026209168e+04, -2.0250659086265861e+02, ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
390 -9.6733175964156985e+01, -8.3069683020988421e+01, ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
391 1.3356173243752210e+03, 4.5610806266307627e+01, ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
392 7.3229009073208331e+01, 1.1667126232349770e+02; ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
393 ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
394 1.4676952576063929e+03, 1.3514357622838521e+01, ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
395 6.4524906786197480e+00, 5.5245948033669476e+00, ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
396 -8.9827382090060922e+01, -3.1118708128841241e+00, ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
397 -5.0039950796246986e+00, -7.9749636293721071e+00];
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
398 ret.curve.p_r.f = @ (x, p) f_r (x, p, hook);
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
399
7411
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
400 ret.general.schittkowski_281.dfdp = ...
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
401 @ (p) schittkowski_281_dfdp (p);
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
402 ret.general.schittkowski_281.init_p = zeros (10, 1);
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
403 ret.general.schittkowski_281.result.p = ones (10, 1); % 'theoretically'
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
404 ret.general.schittkowski_281.result.obj = 0; % 'theoretically'
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
405 ret.general.schittkowski_281.strict_inequc.bounds = [];
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
406 ret.general.schittkowski_281.strict_inequc.linear = [];
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
407 ret.general.schittkowski_281.strict_inequc.general = [];
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
408 ret.general.schittkowski_281.non_strict_inequc.bounds = [];
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
409 ret.general.schittkowski_281.non_strict_inequc.linear = [];
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
410 ret.general.schittkowski_281.non_strict_inequc.general = [];
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
411 ret.general.schittkowski_281.equc.linear = [];
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
412 ret.general.schittkowski_281.equc.general = [];
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
413 ret.general.schittkowski_281.f = ...
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
414 @ (p) (sum (((1:10).') .^ 3 .* (p - 1) .^ 2)) ^ (1 / 3);
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
415
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
416 ret.general.schittkowski_289.dfdp = ...
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
417 @ (p) exp (- sum (p .^ 2) / 60) / 30 * p;
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
418 ret.general.schittkowski_289.init_p = [-1.03; 1.07; -1.10; 1.13; ...
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
419 -1.17; 1.20; -1.23; 1.27; ...
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
420 -1.30; 1.33; -1.37; 1.40; ...
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
421 -1.43; 1.47; -1.50; 1.53; ...
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
422 -1.57; 1.60; -1.63; 1.67; ...
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
423 -1.70; 1.73; -1.77; 1.80; ...
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
424 -1.83; 1.87; -1.90; 1.93; ...
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
425 -1.97; 2.00];
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
426 ret.general.schittkowski_289.result.p = zeros (30, 1); % 'theoretically'
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
427 ret.general.schittkowski_289.result.obj = 0; % 'theoretically'
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
428 ret.general.schittkowski_289.strict_inequc.bounds = [];
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
429 ret.general.schittkowski_289.strict_inequc.linear = [];
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
430 ret.general.schittkowski_289.strict_inequc.general = [];
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
431 ret.general.schittkowski_289.non_strict_inequc.bounds = [];
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
432 ret.general.schittkowski_289.non_strict_inequc.linear = [];
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
433 ret.general.schittkowski_289.non_strict_inequc.general = [];
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
434 ret.general.schittkowski_289.equc.linear = [];
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
435 ret.general.schittkowski_289.equc.general = [];
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
436 ret.general.schittkowski_289.f = @ (p) 1 - exp (- sum (p .^ 2) / 60);
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
437
7240
e95b49939947 - INDEX: added optim_problems,
i7tiol
parents: 7231
diff changeset
438 ret.curve.schittkowski_327.dfdp = ...
e95b49939947 - INDEX: added optim_problems,
i7tiol
parents: 7231
diff changeset
439 @ (x, p) [1 + exp(-p(2) * (x - 8)), ...
e95b49939947 - INDEX: added optim_problems,
i7tiol
parents: 7231
diff changeset
440 (p(1) + .49) * (8 - x) .* exp (-p(2) * (x - 8))];
e95b49939947 - INDEX: added optim_problems,
i7tiol
parents: 7231
diff changeset
441 ret.curve.schittkowski_327.init_p = [.42; 5];
e95b49939947 - INDEX: added optim_problems,
i7tiol
parents: 7231
diff changeset
442 ret.curve.schittkowski_327.data.x = ...
e95b49939947 - INDEX: added optim_problems,
i7tiol
parents: 7231
diff changeset
443 [8; 8; 10; 10; 10; 10; 12; 12; 12; 12; 14; 14; 14; 16; 16; 16; ...
e95b49939947 - INDEX: added optim_problems,
i7tiol
parents: 7231
diff changeset
444 18; 18; 20; 20; 20; 22; 22; 22; 24; 24; 24; 26; 26; 26; 28; ...
e95b49939947 - INDEX: added optim_problems,
i7tiol
parents: 7231
diff changeset
445 28; 30; 30; 30; 32; 32; 34; 36; 36; 38; 38; 40; 42];
e95b49939947 - INDEX: added optim_problems,
i7tiol
parents: 7231
diff changeset
446 ret.curve.schittkowski_327.data.y= ...
7411
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
447 [.49; .49; .48; .47; .48; .47; .46; .46; .45; .43; .45; .43; ...
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
448 .43; .44; .43; .43; .46; .45; .42; .42; .43; .41; .41; .40; ...
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
449 .42; .40; .40; .41; .40; .41; .41; .40; .40; .40; .38; .41; ...
7240
e95b49939947 - INDEX: added optim_problems,
i7tiol
parents: 7231
diff changeset
450 .40; .40; .41; .38; .40; .40; .39; .39];
e95b49939947 - INDEX: added optim_problems,
i7tiol
parents: 7231
diff changeset
451 ret.curve.schittkowski_327.data.wt = [];
e95b49939947 - INDEX: added optim_problems,
i7tiol
parents: 7231
diff changeset
452 ret.curve.schittkowski_327.data.cov = [];
e95b49939947 - INDEX: added optim_problems,
i7tiol
parents: 7231
diff changeset
453 %% This result was given by Schittkowski. No constraint is active
e95b49939947 - INDEX: added optim_problems,
i7tiol
parents: 7231
diff changeset
454 %% here. The second parameter is unchanged from initial value.
e95b49939947 - INDEX: added optim_problems,
i7tiol
parents: 7231
diff changeset
455 %%
e95b49939947 - INDEX: added optim_problems,
i7tiol
parents: 7231
diff changeset
456 %% ret.curve.schittkowski_327.result.p = [.4219; 5];
e95b49939947 - INDEX: added optim_problems,
i7tiol
parents: 7231
diff changeset
457 %% ret.curve.schittkowski_327.result.obj = .0307986;
e95b49939947 - INDEX: added optim_problems,
i7tiol
parents: 7231
diff changeset
458 %%
e95b49939947 - INDEX: added optim_problems,
i7tiol
parents: 7231
diff changeset
459 %% This is the result of leasqr of Octave Forge. The general
e95b49939947 - INDEX: added optim_problems,
i7tiol
parents: 7231
diff changeset
460 %% constraint is active here. Both parameters are different from
e95b49939947 - INDEX: added optim_problems,
i7tiol
parents: 7231
diff changeset
461 %% initial value. The value of the objective function is better.
e95b49939947 - INDEX: added optim_problems,
i7tiol
parents: 7231
diff changeset
462 %%
e95b49939947 - INDEX: added optim_problems,
i7tiol
parents: 7231
diff changeset
463 ret.curve.schittkowski_327.result.p = [.4199227; 1.2842958];
e95b49939947 - INDEX: added optim_problems,
i7tiol
parents: 7231
diff changeset
464 ret.curve.schittkowski_327.result.obj = .0284597;
e95b49939947 - INDEX: added optim_problems,
i7tiol
parents: 7231
diff changeset
465 ret.curve.schittkowski_327.strict_inequc.bounds = [];
e95b49939947 - INDEX: added optim_problems,
i7tiol
parents: 7231
diff changeset
466 ret.curve.schittkowski_327.strict_inequc.linear = [];
e95b49939947 - INDEX: added optim_problems,
i7tiol
parents: 7231
diff changeset
467 ret.curve.schittkowski_327.strict_inequc.general = [];
e95b49939947 - INDEX: added optim_problems,
i7tiol
parents: 7231
diff changeset
468 ret.curve.schittkowski_327.non_strict_inequc.bounds = [.4, Inf; ...
e95b49939947 - INDEX: added optim_problems,
i7tiol
parents: 7231
diff changeset
469 .4, Inf];
e95b49939947 - INDEX: added optim_problems,
i7tiol
parents: 7231
diff changeset
470 ret.curve.schittkowski_327.non_strict_inequc.linear = [];
e95b49939947 - INDEX: added optim_problems,
i7tiol
parents: 7231
diff changeset
471 ret.curve.schittkowski_327.non_strict_inequc.general = ...
e95b49939947 - INDEX: added optim_problems,
i7tiol
parents: 7231
diff changeset
472 @ (p, varargin) apply_idx_if_given ...
e95b49939947 - INDEX: added optim_problems,
i7tiol
parents: 7231
diff changeset
473 (-.09 - p(1) * p(2) + .49 * p(2), varargin{:});
e95b49939947 - INDEX: added optim_problems,
i7tiol
parents: 7231
diff changeset
474 ret.curve.schittkowski_327.equc.linear = [];
e95b49939947 - INDEX: added optim_problems,
i7tiol
parents: 7231
diff changeset
475 ret.curve.schittkowski_327.equc.general = [];
e95b49939947 - INDEX: added optim_problems,
i7tiol
parents: 7231
diff changeset
476 ret.curve.schittkowski_327.f = ...
e95b49939947 - INDEX: added optim_problems,
i7tiol
parents: 7231
diff changeset
477 @ (x, p) p(1) + (.49 - p(1)) * exp (-p(2) * (x - 8));
e95b49939947 - INDEX: added optim_problems,
i7tiol
parents: 7231
diff changeset
478
7248
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
479 ret.general.schittkowski_327.init_p = [.42; 5];
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
480 ret.general.schittkowski_327.data.x = ...
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
481 [8; 8; 10; 10; 10; 10; 12; 12; 12; 12; 14; 14; 14; 16; 16; 16; ...
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
482 18; 18; 20; 20; 20; 22; 22; 22; 24; 24; 24; 26; 26; 26; 28; ...
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
483 28; 30; 30; 30; 32; 32; 34; 36; 36; 38; 38; 40; 42];
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
484 ret.general.schittkowski_327.data.y= ...
7411
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
485 [.49; .49; .48; .47; .48; .47; .46; .46; .45; .43; .45; .43; ...
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
486 .43; .44; .43; .43; .46; .45; .42; .42; .43; .41; .41; .40; ...
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
487 .42; .40; .40; .41; .40; .41; .41; .40; .40; .40; .38; .41; ...
7248
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
488 .40; .40; .41; .38; .40; .40; .39; .39];
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
489 x = ret.general.schittkowski_327.data.x;
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
490 y = ret.general.schittkowski_327.data.y;
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
491 ret.general.schittkowski_327.dfdp = ...
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
492 @ (p) cat (2, ...
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
493 2 * sum ((exp (-p(2 * x - 8)) - 1) * ...
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
494 (y + (p(1) - .49) * ...
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
495 exp (-p(2) * (x - 8)) - p1)), ...
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
496 2 * (p(1) - .49) * ...
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
497 sum ((8 - x) * exp (-p(2 * x - 8)) * ...
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
498 (y + (p(1) - .49) * ...
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
499 exp (-p(2) * (x - 8)) - p1)));
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
500 %% This result was given by Schittkowski. No constraint is active
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
501 %% here. The second parameter is unchanged from initial value.
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
502 %%
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
503 %% ret.general.schittkowski_327.result.p = [.4219; 5];
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
504 %% ret.general.schittkowski_327.result.obj = .0307986;
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
505 %%
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
506 %% This is the result of leasqr of Octave Forge. The general
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
507 %% constraint is active here. Both parameters are different from
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
508 %% initial value. The value of the objective function is better. sqp
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
509 %% gives a similar result.
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
510 ret.general.schittkowski_327.result.p = [.4199227; 1.2842958];
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
511 ret.general.schittkowski_327.result.obj = .0284597;
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
512 ret.general.schittkowski_327.strict_inequc.bounds = [];
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
513 ret.general.schittkowski_327.strict_inequc.linear = [];
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
514 ret.general.schittkowski_327.strict_inequc.general = [];
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
515 ret.general.schittkowski_327.non_strict_inequc.bounds = [.4, Inf; ...
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
516 .4, Inf];
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
517 ret.general.schittkowski_327.non_strict_inequc.linear = [];
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
518 ret.general.schittkowski_327.non_strict_inequc.general = ...
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
519 @ (p, varargin) apply_idx_if_given ...
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
520 (-.09 - p(1) * p(2) + .49 * p(2), varargin{:});
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
521 ret.general.schittkowski_327.equc.linear = [];
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
522 ret.general.schittkowski_327.equc.general = [];
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
523 ret.general.schittkowski_327.f = ...
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
524 @ (p) sumsq (y - p(1) - (.49 - p(1)) * exp (-p(2) * (x - 8)));
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
525
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
526 ret.curve.schittkowski_372.dfdp = ...
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
527 @ (x, p) cat (2, zeros (6, 3), eye (6));
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
528 %% given by Schittkowski, not feasible
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
529 ret.curve.schittkowski_372.init_p = [300; -100; -.1997; -127; ...
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
530 -151; 379; 421; 460; 426];
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
531 %% computed with sqp and a constant objective function, (almost)
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
532 %% feasible
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
533 ret.curve.schittkowski_372.init_p_f = @ (id) ...
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
534 ifelse (id == 0, 1, [2.951277e+02; ...
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
535 -1.058720e+02; ...
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
536 -9.535824e-02; ...
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
537 2.421108e+00; ...
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
538 3.191822e+00; ...
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
539 3.790000e+02; ...
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
540 4.210000e+02; ...
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
541 4.600000e+02; ...
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
542 4.260000e+02]);
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
543 ret.curve.schittkowski_372.data.x = (1:6).'; % any different numbers
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
544 ret.curve.schittkowski_372.data.y= zeros (6, 1);
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
545 ret.curve.schittkowski_372.data.wt = [];
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
546 ret.curve.schittkowski_372.data.cov = [];
7411
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
547 %% recomputed with sqp (i.e. not with curve fitting)
7248
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
548 ret.curve.schittkowski_372.result.p = [5.2330557804078126e+02; ...
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
549 -1.5694790476454301e+02; ...
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
550 -1.9966450018535931e-01; ...
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
551 2.9607990282984435e+01; ...
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
552 8.6615541706550545e+01; ...
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
553 4.7326722338555498e+01; ...
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
554 2.6235616534580515e+01; ...
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
555 2.2915996663200740e+01; ...
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
556 3.9470733973874445e+01];
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
557 ret.curve.schittkowski_372.result.obj = 13390.1;
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
558 ret.curve.schittkowski_372.strict_inequc.bounds = [];
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
559 ret.curve.schittkowski_372.strict_inequc.linear = [];
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
560 ret.curve.schittkowski_372.strict_inequc.general = [];
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
561 ret.curve.schittkowski_372.non_strict_inequc.bounds = [-Inf, Inf; ...
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
562 -Inf, Inf; ...
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
563 -Inf, Inf; ...
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
564 0, Inf; ...
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
565 0, Inf; ...
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
566 0, Inf; ...
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
567 0, Inf; ...
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
568 0, Inf; ...
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
569 0, Inf];
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
570 ret.curve.schittkowski_372.non_strict_inequc.linear = [];
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
571 ret.curve.schittkowski_372.non_strict_inequc.general = ...
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
572 @ (p, varargin) apply_idx_if_given ...
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
573 (cat (1, p(1) + p(2) * exp (-5 * p(3)) + p(4) - 127, ...
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
574 p(1) + p(2) * exp (-3 * p(3)) + p(5) - 151, ...
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
575 p(1) + p(2) * exp (-p(3)) + p(6) - 379, ...
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
576 p(1) + p(2) * exp (p(3)) + p(7) - 421, ...
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
577 p(1) + p(2) * exp (3 * p(3)) + p(8) - 460, ...
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
578 p(1) + p(2) * exp (5 * p(3)) + p(9) - 426, ...
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
579 -p(1) - p(2) * exp (-5 * p(3)) + p(4) + 127, ...
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
580 -p(1) - p(2) * exp (-3 * p(3)) + p(5) + 151, ...
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
581 -p(1) - p(2) * exp (-p(3)) + p(6) + 379, ...
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
582 -p(1) - p(2) * exp (p(3)) + p(7) + 421, ...
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
583 -p(1) - p(2) * exp (3 * p(3)) + p(8) + 460, ...
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
584 -p(1) - p(2) * exp (5 * p(3)) + p(9) + 426), ...
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
585 varargin{:});
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
586 ret.curve.schittkowski_372.equc.linear = [];
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
587 ret.curve.schittkowski_372.equc.general = [];
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
588 ret.curve.schittkowski_372.f = @ (x, p) p(4:9);
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
589
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
590 ret.curve.schittkowski_373.dfdp = ...
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
591 @ (x, p) cat (2, zeros (6, 3), eye (6));
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
592 %% not feasible
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
593 ret.curve.schittkowski_373.init_p = [300; -100; -.1997; -127; ...
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
594 -151; 379; 421; 460; 426];
7411
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
595 %% feasible
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
596 ret.curve.schittkowski_373.init_p_f = @ (id) ...
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
597 ifelse (id == 0, 1, [2.5722721227695763e+02; ...
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
598 -1.5126681606092043e+02; ...
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
599 8.3101871447778766e-02; ...
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
600 -3.0390506000425454e+01; ...
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
601 1.1661334225083069e+01; ...
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
602 2.6097719374430665e+02; ...
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
603 3.2814725183082305e+02; ...
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
604 3.9686840023267564e+02; ...
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
605 3.9796353824451995e+02]);
7248
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
606 ret.curve.schittkowski_373.data.x = (1:6).'; % any different numbers
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
607 ret.curve.schittkowski_373.data.y= zeros (6, 1);
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
608 ret.curve.schittkowski_373.data.wt = [];
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
609 ret.curve.schittkowski_373.data.cov = [];
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
610 ret.curve.schittkowski_373.result.p = [523.31; ...
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
611 -156.95; ...
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
612 -.2; ...
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
613 29.61; ...
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
614 -86.62; ...
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
615 47.33; ...
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
616 26.24; ...
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
617 22.92; ...
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
618 -39.47];
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
619 ret.curve.schittkowski_373.result.obj = 13390.1;
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
620 ret.curve.schittkowski_373.strict_inequc.bounds = [];
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
621 ret.curve.schittkowski_373.strict_inequc.linear = [];
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
622 ret.curve.schittkowski_373.strict_inequc.general = [];
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
623 ret.curve.schittkowski_373.non_strict_inequc.bounds = [];
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
624 ret.curve.schittkowski_373.non_strict_inequc.linear = [];
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
625 ret.curve.schittkowski_373.non_strict_inequc.general = [];
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
626 ret.curve.schittkowski_373.equc.linear = [];
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
627 ret.curve.schittkowski_373.equc.general = ...
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
628 @ (p, varargin) apply_idx_if_given ...
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
629 (cat (1, p(1) + p(2) * exp (-5 * p(3)) + p(4) - 127, ...
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
630 p(1) + p(2) * exp (-3 * p(3)) + p(5) - 151, ...
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
631 p(1) + p(2) * exp (-p(3)) + p(6) - 379, ...
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
632 p(1) + p(2) * exp (p(3)) + p(7) - 421, ...
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
633 p(1) + p(2) * exp (3 * p(3)) + p(8) - 460, ...
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
634 p(1) + p(2) * exp (5 * p(3)) + p(9) - 426), ...
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
635 varargin{:});
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
636 ret.curve.schittkowski_373.f = @ (x, p) p(4:9);
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
637
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
638 ret.general.schittkowski_372.dfdp = ...
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
639 @ (p) cat (2, zeros (1, 3), 2 * p(4:9));
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
640 %% not feasible
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
641 ret.general.schittkowski_372.init_p = [300; -100; -.1997; -127; ...
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
642 -151; 379; 421; 460; 426];
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
643 %% recomputed with sqp
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
644 ret.general.schittkowski_372.result.p = [5.2330557804078126e+02; ...
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
645 -1.5694790476454301e+02; ...
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
646 -1.9966450018535931e-01; ...
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
647 2.9607990282984435e+01; ...
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
648 8.6615541706550545e+01; ...
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
649 4.7326722338555498e+01; ...
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
650 2.6235616534580515e+01; ...
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
651 2.2915996663200740e+01; ...
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
652 3.9470733973874445e+01];
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
653 ret.general.schittkowski_372.result.obj = 13390.1;
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
654 ret.general.schittkowski_372.strict_inequc.bounds = [];
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
655 ret.general.schittkowski_372.strict_inequc.linear = [];
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
656 ret.general.schittkowski_372.strict_inequc.general = [];
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
657 ret.general.schittkowski_372.non_strict_inequc.bounds = [-Inf, Inf; ...
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
658 -Inf, Inf; ...
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
659 -Inf, Inf; ...
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
660 0, Inf; ...
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
661 0, Inf; ...
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
662 0, Inf; ...
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
663 0, Inf; ...
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
664 0, Inf; ...
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
665 0, Inf];
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
666 ret.general.schittkowski_372.non_strict_inequc.linear = [];
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
667 ret.general.schittkowski_372.non_strict_inequc.general = ...
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
668 @ (p, varargin) apply_idx_if_given ...
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
669 (cat (1, p(1) + p(2) * exp (-5 * p(3)) + p(4) - 127, ...
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
670 p(1) + p(2) * exp (-3 * p(3)) + p(5) - 151, ...
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
671 p(1) + p(2) * exp (-p(3)) + p(6) - 379, ...
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
672 p(1) + p(2) * exp (p(3)) + p(7) - 421, ...
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
673 p(1) + p(2) * exp (3 * p(3)) + p(8) - 460, ...
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
674 p(1) + p(2) * exp (5 * p(3)) + p(9) - 426, ...
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
675 -p(1) - p(2) * exp (-5 * p(3)) + p(4) + 127, ...
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
676 -p(1) - p(2) * exp (-3 * p(3)) + p(5) + 151, ...
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
677 -p(1) - p(2) * exp (-p(3)) + p(6) + 379, ...
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
678 -p(1) - p(2) * exp (p(3)) + p(7) + 421, ...
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
679 -p(1) - p(2) * exp (3 * p(3)) + p(8) + 460, ...
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
680 -p(1) - p(2) * exp (5 * p(3)) + p(9) + 426), ...
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
681 varargin{:});
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
682 ret.general.schittkowski_372.equc.linear = [];
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
683 ret.general.schittkowski_372.equc.general = [];
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
684 ret.general.schittkowski_372.f = @ (p) sumsq (p(4:9));
6f03b0449b74 optim_problems: added Schittkowski no. 327, 372, 373 (general constraints).
i7tiol
parents: 7240
diff changeset
685
7411
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
686 ret.general.schittkowski_391.dfdp = [];
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
687 ret.general.schittkowski_391.init_p = ...
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
688 -2.8742711 * alpha_391 (zeros (30, 1), 1:30);
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
689 %% computed with fminunc (Octave)
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
690 ret.general.schittkowski_391.result.p = [-1.1986682e+18; ...
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
691 -1.1474574e+07; ...
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
692 -1.3715802e+07; ...
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
693 -1.0772255e+07; ...
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
694 -1.0634232e+07; ...
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
695 -1.0622915e+07; ...
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
696 -8.8775399e+06; ...
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
697 -8.8201496e+06; ...
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
698 -9.7729975e+06; ...
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
699 -1.0431808e+07; ...
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
700 -1.0415089e+07; ...
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
701 -1.0350400e+07; ...
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
702 -1.0325094e+07; ...
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
703 -1.0278561e+07; ...
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
704 -1.0275751e+07; ...
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
705 -1.0276546e+07; ...
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
706 -1.0292584e+07; ...
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
707 -1.0289350e+07; ...
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
708 -1.0192566e+07; ...
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
709 -1.0058577e+07; ...
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
710 -1.0096341e+07; ...
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
711 -1.0242386e+07; ...
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
712 -1.0615831e+07; ...
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
713 -1.1142096e+07; ...
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
714 -1.1617283e+07; ...
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
715 -1.2005738e+07; ...
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
716 -1.2282117e+07; ...
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
717 -1.2301260e+07; ...
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
718 -1.2051365e+07; ...
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
719 -1.1704693e+07];
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
720 ret.general.schittkowski_391.result.obj = -5.1615468e+20;
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
721 ret.general.schittkowski_391.strict_inequc.bounds = [];
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
722 ret.general.schittkowski_391.strict_inequc.linear = [];
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
723 ret.general.schittkowski_391.strict_inequc.general = [];
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
724 ret.general.schittkowski_391.non_strict_inequc.bounds = [];
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
725 ret.general.schittkowski_391.non_strict_inequc.linear = [];
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
726 ret.general.schittkowski_391.non_strict_inequc.general = [];
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
727 ret.general.schittkowski_391.equc.linear = [];
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
728 ret.general.schittkowski_391.equc.general = [];
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
729 ret.general.schittkowski_391.f = @ (p) sum (alpha_391 (p, 1:30));
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
730
7231
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
731 function ret = f_1 (x, p)
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
732
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
733 ret = p(1) + x(:, 1) ./ (p(2) * x(:, 2) + p(3) * x(:, 3));
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
734
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
735 function ret = f_2 (x, p, y)
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
736
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
737 y(3, 2) = p(4);
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
738 x(9, 3) = p(5);
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
739 p = p(:);
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
740 mp = cat (2, p([1, 2, 3]), p([3, 1, 2]), p([3, 2, 1]));
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
741 ret = x * mp - y;
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
742
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
743 function ret = f_3 (x, p)
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
744
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
745 ret = fixed_step_rk4 (x.', [1, 1, 0, 0, 0], 1, ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
746 @ (x, t) f_3_xdot (x, t, p));
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
747 ret = ret.';
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
748
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
749 function ret = f_3_noweights (x, p)
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
750
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
751 ret = fixed_step_rk4 (x.', [.1, .1, 0, 0, 0], .2, ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
752 @ (x, t) f_3_xdot_noweights (x, t, p));
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
753 ret = ret.';
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
754
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
755 function ret = f_3_xdot (x, t, p)
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
756
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
757 ret = zeros (5, 1);
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
758 tp = p(2) * x(3) - p(1) * x(1) * x(2);
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
759 ret(1) = tp;
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
760 ret(2) = tp - p(4) * x(2) * x(3) + p(5) * x(5) - p(6) * x(2) * x(4);
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
761 ret(3) = - tp - p(3) * x(3) - p(4) * x(2) * x(3);
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
762 ret(4) = p(3) * x(3) + p(5) * x(5) - p(6) * x(2) * x(4);
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
763 ret(5) = p(4) * x(2) * x(3) - p(5) * x(5) + p(6) * x(2) * x(4);
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
764
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
765 function ret = f_3_xdot_noweights (x, t, p)
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
766
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
767 x(1:2) = x(1:2) / .1;
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
768 x(4) = x(4) / 10;
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
769 x(5) = x(5) / 100;
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
770 ret = f_3_xdot (x, t, p);
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
771 ret(1:2) = ret(1:2) * .1;
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
772 ret(4) = ret(4) * 10;
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
773 ret(5) = ret(5) * 100;
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
774
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
775 function ret = f_r (x, p, hook)
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
776
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
777 n = size (hook.mc, 2);
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
778 ns = cat (1, 0, cumsum (hook.ns));
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
779 xdhook.p = p;
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
780 ret = zeros (1, ns(end));
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
781 %% temporary variables
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
782 dls = p(3) ^ 2;
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
783 dmhp = p(5) * dls / p(4);
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
784 mhp = dmhp / 2;
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
785 %%
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
786 for id = 1:n
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
787 xdhook.c = hook.mc(:, id);
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
788 l = xdhook.c(3);
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
789 x0 = mhp - sqrt (max (0, mhp ^ 2 + dls + (p(6) - l) * dmhp));
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
790 ids = ns(id) + 1;
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
791 ide = ns(id + 1);
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
792
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
793 tp = odeset ();
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
794 %% necessary in Matlab (7.1)
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
795 tp.OutputSave = [];
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
796 tp.Refine = 0;
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
797 %%
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
798 tp.RelTol = 1e-7;
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
799 tp.AbsTol = 1e-7;
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
800 [cx, Xcx] = essential_ode23 (@ (t, X) f_r_xdot (X, t, xdhook), ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
801 x([ids, ide]).', x0, tp);
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
802 X = lin_interp (cx.', Xcx.', x(ids:ide).');
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
803
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
804 X = X.';
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
805 [discarded, lr] = ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
806 f_r_xdot (X, hook.t(ids:ide), xdhook);
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
807 ret(ids:ide) = max (0, lr - p(6) - X) * p(5);
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
808 end
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
809 ret = ret.';
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
810
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
811 function [ret, l] = f_r_xdot (x, t, hook)
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
812
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
813 %% keep this working with non-scalar x and t
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
814
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
815 p = hook.p;
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
816 c = hook.c;
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
817 idl = t <= c(1);
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
818 idg = t >= c(2);
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
819 idb = ~ (idl | idg);
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
820 l = zeros (size (t));
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
821 l(idl) = c(3);
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
822 l(idg) = c(4) * t(idg) + c(5);
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
823 l(idb) = polyval (c(6:9), t(idb));
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
824 dls = max (1e-6, l - p(6) - x);
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
825 tf = x / p(3);
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
826 ido = tf >= 1;
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
827 idx = ~ido;
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
828 ret(ido) = 0;
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
829 ret(idx) = - ((p(4) + p(1)) * p(2)) ./ ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
830 ((p(5) * dls(idx)) ./ (1 - tf(idx) .^ 2) + p(1)) + p(2);
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
831
7411
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
832 function ret = alpha_391 (p, id)
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
833
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
834 %% for .general.schittkowski_391; id is a numeric index(-vector)
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
835 %% into p
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
836
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
837 p = p(:);
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
838 n = size (p, 1);
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
839
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
840 nid = length (id);
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
841 id = reshape (id, 1, nid);
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
842
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
843 v = sqrt (repmat (p .^ 2, 1, nid) + 1 ./ ((1:n).') * id);
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
844
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
845 log_v = log (v);
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
846
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
847 ret = 420 * p(id) + (id(:) - 15) .^ 3 + ...
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
848 sum (v .* (sin (log_v) .^ 5 + cos (log_v) .^ 5)).';
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
849
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
850 function ret = schittkowski_281_dfdp (p)
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
851
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
852 tp = (sum (((1:10).') .^ 3 .* (p - 1) .^ 2)) ^ (- 2 / 3) / 3;
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
853
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
854 ret = 2 * ((1:10).') .^ 3 .* (p - 1) * tp;
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
855
7231
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
856 function state = fixed_step_rk4 (t, x0, step, f)
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
857
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
858 %% minimalistic fourth order ODE-solver, as said to be a popular one
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
859 %% by Wikipedia (to make these optimization tests self-contained;
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
860 %% for the same reason 'lookup' and even 'interp1' are not used
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
861 %% here)
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
862
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
863 n = ceil ((t(end) - t(1)) / step) + 1;
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
864 m = length (x0);
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
865 tstate = zeros (m, n);
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
866 tstate(:, 1) = x0;
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
867 tt = linspace (t(1), t(1) + step * (n - 1), n);
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
868 for id = 1 : n - 1
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
869 k1 = f (tstate(:, id), tt(id));
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
870 k2 = f (tstate(:, id) + .5 * step * k1, tt(id) + .5 * step);
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
871 k3 = f (tstate(:, id) + .5 * step * k2, tt(id) + .5 * step);
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
872 k4 = f (tstate(:, id) + step * k3, tt(id + 1));
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
873 tstate(:, id + 1) = tstate(:, id) + ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
874 (step / 6) * (k1 + 2 * k2 + 2 * k3 + k4);
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
875 end
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
876 state = lin_interp (tt, tstate, t);
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
877
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
878 function ret = pc2 (p, id)
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
879 %% a combination out of 2 possible values for each parameter
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
880 r = size (p, 1);
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
881 n = 2 ^ r;
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
882 if (id < 0 || id > n)
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
883 error ('no parameter set for this index');
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
884 end
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
885 if (id == 0) % return maximum id
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
886 ret = n;
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
887 return;
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
888 end
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
889 idx = dec2bin (id - 1, r) == '1';
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
890 nidx = ~idx;
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
891 ret = zeros (r, 1);
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
892 ret(nidx) = p(nidx, 1);
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
893 ret(idx) = p(idx, 2);
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
894
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
895 function [varargout] = essential_ode23 (vfun, vslot, vinit, vodeoptions)
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
896
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
897 %% This code is taken from the ode23 solver of Thomas Treichl
8822
55c73f24f0ee Updated Thomas Treichl e-mail address
carandraug
parents: 7411
diff changeset
898 %% <thomas.treichl@gmx.net>, some flexibility of the
7231
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
899 %% interface has been removed. The idea behind this duplication is
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
900 %% to have a fixed version of the solver here which runs both in
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
901 %% Octave and Matlab.
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
902
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
903 %% Some of the option treatment has been left out.
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
904 if (length (vslot) > 2)
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
905 vstepsizefixed = true;
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
906 else
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
907 vstepsizefixed = false;
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
908 end
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
909 if (strcmp (vodeoptions.NormControl, 'on'))
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
910 vnormcontrol = true;
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
911 else
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
912 vnormcontrol = false;
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
913 end
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
914 if (~isempty (vodeoptions.NonNegative))
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
915 if (isempty (vodeoptions.Mass))
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
916 vhavenonnegative = true;
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
917 else
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
918 vhavenonnegative = false;
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
919 end
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
920 else
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
921 vhavenonnegative = false;
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
922 end
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
923 if (isempty (vodeoptions.OutputFcn) && nargout == 0)
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
924 vodeoptions.OutputFcn = @odeplot;
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
925 vhaveoutputfunction = true;
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
926 elseif (isempty (vodeoptions.OutputFcn))
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
927 vhaveoutputfunction = false;
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
928 else
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
929 vhaveoutputfunction = true;
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
930 end
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
931 if (~isempty (vodeoptions.OutputSel))
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
932 vhaveoutputselection = true;
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
933 else
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
934 vhaveoutputselection = false;
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
935 end
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
936 if (isempty (vodeoptions.OutputSave))
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
937 vodeoptions.OutputSave = 1;
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
938 end
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
939 if (vodeoptions.Refine > 0)
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
940 vhaverefine = true;
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
941 else
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
942 vhaverefine = false;
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
943 end
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
944 if (isempty (vodeoptions.InitialStep) && ~vstepsizefixed)
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
945 vodeoptions.InitialStep = (vslot(1,2) - vslot(1,1)) / 10;
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
946 vodeoptions.InitialStep = vodeoptions.InitialStep / ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
947 10^vodeoptions.Refine;
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
948 end
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
949 if (isempty (vodeoptions.MaxStep) && ~vstepsizefixed)
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
950 vodeoptions.MaxStep = (vslot(1,2) - vslot(1,1)) / 10;
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
951 end
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
952 if (~isempty (vodeoptions.Events))
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
953 vhaveeventfunction = true;
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
954 else
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
955 vhaveeventfunction = false;
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
956 end
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
957 if (~isempty (vodeoptions.Mass) && ismatrix (vodeoptions.Mass))
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
958 vhavemasshandle = false;
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
959 vmass = vodeoptions.Mass;
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
960 elseif (isa (vodeoptions.Mass, 'function_handle'))
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
961 vhavemasshandle = true;
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
962 else
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
963 vhavemasshandle = false;
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
964 end
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
965 if (strcmp (vodeoptions.MStateDependence, 'none'))
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
966 vmassdependence = false;
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
967 else
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
968 vmassdependence = true;
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
969 end
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
970
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
971 %% Starting the initialisation of the core solver ode23
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
972 vtimestamp = vslot(1,1); %% timestamp = start time
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
973 vtimelength = length (vslot); %% length needed if fixed steps
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
974 vtimestop = vslot(1,vtimelength); %% stop time = last value
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
975 vdirection = sign (vtimestop); %% Flag for direction to solve
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
976
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
977 if (~vstepsizefixed)
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
978 vstepsize = vodeoptions.InitialStep;
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
979 vminstepsize = (vtimestop - vtimestamp) / (1/eps);
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
980 else %% If step size is given then use the fixed time steps
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
981 vstepsize = vslot(1,2) - vslot(1,1);
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
982 vminstepsize = sign (vstepsize) * eps;
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
983 end
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
984
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
985 vretvaltime = vtimestamp; %% first timestamp output
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
986 vretvalresult = vinit; %% first solution output
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
987
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
988 %% Initialize the OutputFcn
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
989 if (vhaveoutputfunction)
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
990 if (vhaveoutputselection) vretout = ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
991 vretvalresult(vodeoptions.OutputSel);
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
992 else
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
993 vretout = vretvalresult;
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
994 end
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
995 feval (vodeoptions.OutputFcn, vslot.', ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
996 vretout.', 'init');
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
997 end
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
998
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
999 %% Initialize the EventFcn
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1000 if (vhaveeventfunction)
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1001 odepkg_event_handle (vodeoptions.Events, vtimestamp, ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1002 vretvalresult.', 'init');
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1003 end
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1004
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1005 vpow = 1/3; %% 20071016, reported by Luis Randez
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1006 va = [ 0, 0, 0; %% The Runge-Kutta-Fehlberg 2(3) coefficients
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1007 1/2, 0, 0; %% Coefficients proved on 20060827
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1008 -1, 2, 0]; %% See p.91 in Ascher & Petzold
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1009 vb2 = [0; 1; 0]; %% 2nd and 3rd order
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1010 vb3 = [1/6; 2/3; 1/6]; %% b-coefficients
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1011 vc = sum (va, 2);
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1012
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1013 %% The solver main loop - stop if the endpoint has been reached
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1014 vcntloop = 2; vcntcycles = 1; vu = vinit; vk = vu.' * zeros(1,3);
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1015 vcntiter = 0; vunhandledtermination = true; vcntsave = 2;
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1016 while ((vdirection * (vtimestamp) < vdirection * (vtimestop)) && ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1017 (vdirection * (vstepsize) >= vdirection * (vminstepsize)))
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1018
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1019 %% Hit the endpoint of the time slot exactely
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1020 if ((vtimestamp + vstepsize) > vdirection * vtimestop)
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1021 %% if (((vtimestamp + vstepsize) > vtimestop) || ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1022 %% (abs(vtimestamp + vstepsize - vtimestop) < eps))
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1023 vstepsize = vtimestop - vdirection * vtimestamp;
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1024 end
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1025
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1026 %% Estimate the three results when using this solver
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1027 for j = 1:3
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1028 vthetime = vtimestamp + vc(j,1) * vstepsize;
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1029 vtheinput = vu.' + vstepsize * vk(:,1:j-1) * va(j,1:j-1).';
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1030 if (vhavemasshandle) %% Handle only the dynamic mass matrix,
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1031 if (vmassdependence) %% constant mass matrices have already
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1032 vmass = feval ... %% been set before (if any)
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1033 (vodeoptions.Mass, vthetime, vtheinput);
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1034 else %% if (vmassdependence == false)
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1035 vmass = feval ... %% then we only have the time argument
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1036 (vodeoptions.Mass, vthetime);
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1037 end
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1038 vk(:,j) = vmass \ feval ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1039 (vfun, vthetime, vtheinput);
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1040 else
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1041 vk(:,j) = feval ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1042 (vfun, vthetime, vtheinput);
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1043 end
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1044 end
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1045
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1046 %% Compute the 2nd and the 3rd order estimation
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1047 y2 = vu.' + vstepsize * (vk * vb2);
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1048 y3 = vu.' + vstepsize * (vk * vb3);
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1049 if (vhavenonnegative)
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1050 vu(vodeoptions.NonNegative) = abs (vu(vodeoptions.NonNegative));
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1051 y2(vodeoptions.NonNegative) = abs (y2(vodeoptions.NonNegative));
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1052 y3(vodeoptions.NonNegative) = abs (y3(vodeoptions.NonNegative));
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1053 end
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1054 vSaveVUForRefine = vu;
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1055
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1056 %% Calculate the absolute local truncation error and the
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1057 %% acceptable error
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1058 if (~vstepsizefixed)
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1059 if (~vnormcontrol)
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1060 vdelta = abs (y3 - y2);
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1061 vtau = max (vodeoptions.RelTol * abs (vu.'), ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1062 vodeoptions.AbsTol);
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1063 else
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1064 vdelta = norm (y3 - y2, Inf);
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1065 vtau = max (vodeoptions.RelTol * max (norm (vu.', Inf), ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1066 1.0), ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1067 vodeoptions.AbsTol);
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1068 end
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1069 else %% if (vstepsizefixed == true)
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1070 vdelta = 1; vtau = 2;
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1071 end
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1072
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1073 %% If the error is acceptable then update the vretval variables
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1074 if (all (vdelta <= vtau))
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1075 vtimestamp = vtimestamp + vstepsize;
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1076 vu = y3.'; %% MC2001: the higher order estimation as 'local
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1077 %% extrapolation' Save the solution every vodeoptions.OutputSave
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1078 %% steps
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1079 if (mod (vcntloop-1,vodeoptions.OutputSave) == 0)
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1080 vretvaltime(vcntsave,:) = vtimestamp;
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1081 vretvalresult(vcntsave,:) = vu;
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1082 vcntsave = vcntsave + 1;
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1083 end
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1084 vcntloop = vcntloop + 1; vcntiter = 0;
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1085
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1086 %% Call plot only if a valid result has been found, therefore
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1087 %% this code fragment has moved here. Stop integration if plot
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1088 %% function returns false
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1089 if (vhaveoutputfunction)
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1090 for vcnt = 0:vodeoptions.Refine %% Approximation between told
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1091 %% and t
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1092 if (vhaverefine) %% Do interpolation
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1093 vapproxtime = (vcnt + 1) * vstepsize / ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1094 (vodeoptions.Refine + 2);
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1095 vapproxvals = vSaveVUForRefine.' + vapproxtime * (vk * ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1096 vb3);
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1097 vapproxtime = (vtimestamp - vstepsize) + vapproxtime;
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1098 else
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1099 vapproxvals = vu.';
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1100 vapproxtime = vtimestamp;
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1101 end
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1102 if (vhaveoutputselection)
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1103 vapproxvals = vapproxvals(vodeoptions.OutputSel);
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1104 end
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1105 vpltret = feval (vodeoptions.OutputFcn, vapproxtime, ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1106 vapproxvals, []);
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1107 if vpltret %% Leave refinement loop
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1108 break;
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1109 end
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1110 end
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1111 if (vpltret) %% Leave main loop
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1112 vunhandledtermination = false;
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1113 break;
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1114 end
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1115 end
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1116
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1117 %% Call event only if a valid result has been found, therefore
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1118 %% this code fragment has moved here. Stop integration if
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1119 %% veventbreak is true
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1120 if (vhaveeventfunction)
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1121 vevent = ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1122 odepkg_event_handle (vodeoptions.Events, vtimestamp, ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1123 vu(:), []);
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1124 if (~isempty (vevent{1}) && vevent{1} == 1)
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1125 vretvaltime(vcntloop-1,:) = vevent{3}(end,:);
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1126 vretvalresult(vcntloop-1,:) = vevent{4}(end,:);
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1127 vunhandledtermination = false; break;
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1128 end
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1129 end
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1130 end %% If the error is acceptable ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1131
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1132 %% Update the step size for the next integration step
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1133 if (~vstepsizefixed)
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1134 %% 20080425, reported by Marco Caliari vdelta cannot be negative
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1135 %% (because of the absolute value that has been introduced) but
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1136 %% it could be 0, then replace the zeros with the maximum value
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1137 %% of vdelta
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1138 vdelta(find (vdelta == 0)) = max (vdelta);
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1139 %% It could happen that max (vdelta) == 0 (ie. that the original
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1140 %% vdelta was 0), in that case we double the previous vstepsize
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1141 vdelta(find (vdelta == 0)) = max (vtau) .* (0.4 ^ (1 / vpow));
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1142
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1143 if (vdirection == 1)
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1144 vstepsize = min (vodeoptions.MaxStep, ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1145 min (0.8 * vstepsize * (vtau ./ vdelta) .^ ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1146 vpow));
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1147 else
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1148 vstepsize = max (vodeoptions.MaxStep, ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1149 max (0.8 * vstepsize * (vtau ./ vdelta) .^ ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1150 vpow));
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1151 end
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1152 else %% if (vstepsizefixed)
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1153 if (vcntloop <= vtimelength)
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1154 vstepsize = vslot(vcntloop) - vslot(vcntloop-1);
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1155 else %% Get out of the main integration loop
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1156 break;
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1157 end
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1158 end
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1159
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1160 %% Update counters that count the number of iteration cycles
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1161 vcntcycles = vcntcycles + 1; %% Needed for cost statistics
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1162 vcntiter = vcntiter + 1; %% Needed to find iteration problems
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1163
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1164 %% Stop solving because the last 1000 steps no successful valid
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1165 %% value has been found
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1166 if (vcntiter >= 5000)
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1167 error (['Solving has not been successful. The iterative', ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1168 ' integration loop exited at time t = %f before endpoint at', ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1169 ' tend = %f was reached. This happened because the iterative', ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1170 ' integration loop does not find a valid solution at this time', ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1171 ' stamp. Try to reduce the value of ''InitialStep'' and/or', ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1172 ' ''MaxStep'' with the command ''odeset''.\n'], vtimestamp, vtimestop);
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1173 end
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1174
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1175 end %% The main loop
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1176
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1177 %% Check if integration of the ode has been successful
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1178 if (vdirection * vtimestamp < vdirection * vtimestop)
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1179 if (vunhandledtermination == true)
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1180 error ('OdePkg:InvalidArgument', ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1181 ['Solving has not been successful. The iterative', ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1182 ' integration loop exited at time t = %f', ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1183 ' before endpoint at tend = %f was reached. This may', ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1184 ' happen if the stepsize grows smaller than defined in', ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1185 ' vminstepsize. Try to reduce the value of ''InitialStep'' and/or', ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1186 ' ''MaxStep'' with the command ''odeset''.\n'], vtimestamp, vtimestop);
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1187 else
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1188 warning ('OdePkg:InvalidArgument', ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1189 ['Solver has been stopped by a call of ''break'' in', ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1190 ' the main iteration loop at time t = %f before endpoint at', ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1191 ' tend = %f was reached. This may happen because the @odeplot', ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1192 ' function returned ''true'' or the @event function returned ''true''.'], ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1193 vtimestamp, vtimestop);
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1194 end
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1195 end
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1196
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1197 %% Postprocessing, do whatever when terminating integration
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1198 %% algorithm
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1199 if (vhaveoutputfunction) %% Cleanup plotter
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1200 feval (vodeoptions.OutputFcn, vtimestamp, ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1201 vu.', 'done');
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1202 end
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1203 if (vhaveeventfunction) %% Cleanup event function handling
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1204 odepkg_event_handle (vodeoptions.Events, vtimestamp, ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1205 vu.', 'done');
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1206 end
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1207 %% Save the last step, if not already saved
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1208 if (mod (vcntloop-2,vodeoptions.OutputSave) ~= 0)
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1209 vretvaltime(vcntsave,:) = vtimestamp;
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1210 vretvalresult(vcntsave,:) = vu;
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1211 end
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1212
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1213
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1214 varargout{1} = vretvaltime; %% Time stamps are first output argument
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1215 varargout{2} = vretvalresult; %% Results are second output argument
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1216
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1217 function yi = lin_interp (x, y, xi)
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1218
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1219 %% Actually interp1 with 'linear' should behave equally in Octave
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1220 %% and Matlab, but having this subset of functionality here is being
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1221 %% on the safe side.
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1222
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1223 n = size (x, 2);
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1224 m = size (y, 1);
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1225 %% This elegant lookup is from an older version of 'lookup' by Paul
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1226 %% Kienzle, and had been suggested by Kai Habel <kai.habel@gmx.de>.
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1227 [v, p] = sort ([x, xi]);
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1228 idx(p) = cumsum (p <= n);
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1229 idx = idx(n + 1 : n + size (xi, 2));
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1230 %%
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1231 idx(idx == n) = n - 1;
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1232 yi = y(:, idx) + ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1233 repmat (xi - x(idx), m, 1) .* ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1234 (y(:, idx + 1) - y(:, idx)) ./ ...
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1235 repmat (x(idx + 1) - x(idx), m, 1);
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1236
7240
e95b49939947 - INDEX: added optim_problems,
i7tiol
parents: 7231
diff changeset
1237 function ret = apply_idx_if_given (ret, idx)
e95b49939947 - INDEX: added optim_problems,
i7tiol
parents: 7231
diff changeset
1238
e95b49939947 - INDEX: added optim_problems,
i7tiol
parents: 7231
diff changeset
1239 if (nargin > 1)
e95b49939947 - INDEX: added optim_problems,
i7tiol
parents: 7231
diff changeset
1240 ret = ret(idx);
e95b49939947 - INDEX: added optim_problems,
i7tiol
parents: 7231
diff changeset
1241 end
e95b49939947 - INDEX: added optim_problems,
i7tiol
parents: 7231
diff changeset
1242
7411
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
1243 function fval = scalar_ifelse (cond, tval, fval)
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
1244
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
1245 %% needed for some anonymous functions, builtin ifelse only available
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
1246 %% in Octave > 3.2; we need only the scalar case here
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
1247
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
1248 if (cond)
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
1249 fval = tval;
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
1250 end
2cf09f65806b - optim_problems.m: added unconstrained problems schittkowski_281, _289,
i7tiol
parents: 7248
diff changeset
1251
7231
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1252 %!demo
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1253 %! p_t = optim_problems ().curve.p_1;
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1254 %! global verbose;
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1255 %! verbose = false;
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1256 %! [cy, cp, cvg, iter] = leasqr (p_t.data.x, p_t.data.y, p_t.init_p, p_t.f)
1711037d6d34 optim_problems.m: new function, test cases for optimization.
i7tiol
parents:
diff changeset
1257 %! disp (p_t.result.p)
9930
d30cfca46e8a optim: upgrade license to GPLv3+ and mention on DESCRIPTION the other package licenses
carandraug
parents: 8822
diff changeset
1258 %! sumsq (cy - p_t.data.y)