annotate liboctave/NPSOL.cc @ 1253:bb67a902760b

[project @ 1995-04-11 16:35:23 by jwe]
author jwe
date Tue, 11 Apr 1995 16:35:23 +0000
parents 97eac19837dc
children f93b7fa5e113
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
1 // NPSOL.cc -*- C++ -*-
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
2 /*
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
3
1011
18933dbd5e43 [project @ 1995-01-04 04:18:15 by jwe]
jwe
parents: 882
diff changeset
4 Copyright (C) 1992, 1993, 1994, 1995 John W. Eaton
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
5
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
6 This file is part of Octave.
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
7
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
8 Octave is free software; you can redistribute it and/or modify it
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
9 under the terms of the GNU General Public License as published by the
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
10 Free Software Foundation; either version 2, or (at your option) any
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
11 later version.
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
12
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
13 Octave is distributed in the hope that it will be useful, but WITHOUT
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
16 for more details.
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
17
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
18 You should have received a copy of the GNU General Public License
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
19 along with Octave; see the file COPYING. If not, write to the Free
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
20 Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
21
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
22 */
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
23
238
780cbbc57b7c [project @ 1993-11-30 20:23:04 by jwe]
jwe
parents: 130
diff changeset
24 #ifdef HAVE_CONFIG_H
1192
b6360f2d4fa6 [project @ 1995-03-30 21:38:35 by jwe]
jwe
parents: 1011
diff changeset
25 #include <config.h>
238
780cbbc57b7c [project @ 1993-11-30 20:23:04 by jwe]
jwe
parents: 130
diff changeset
26 #endif
780cbbc57b7c [project @ 1993-11-30 20:23:04 by jwe]
jwe
parents: 130
diff changeset
27
780cbbc57b7c [project @ 1993-11-30 20:23:04 by jwe]
jwe
parents: 130
diff changeset
28 #include <math.h>
288
f8ae4f4dc9fd [project @ 1994-01-13 03:29:16 by jwe]
jwe
parents: 287
diff changeset
29 #include <float.h>
287
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
30 #include <string.h>
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
31 #include <strstream.h>
238
780cbbc57b7c [project @ 1993-11-30 20:23:04 by jwe]
jwe
parents: 130
diff changeset
32
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
33 #ifndef NPSOL_MISSING
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
34
461
00f8b2242a18 [project @ 1994-06-06 00:45:57 by jwe]
jwe
parents: 296
diff changeset
35 #include "dMatrix.h"
00f8b2242a18 [project @ 1994-06-06 00:45:57 by jwe]
jwe
parents: 296
diff changeset
36
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
37 #include "NPSOL.h"
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
38 #include "f77-uscore.h"
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
39 #include "sun-utils.h"
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
40
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
41 extern "C"
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
42 {
1253
bb67a902760b [project @ 1995-04-11 16:35:23 by jwe]
jwe
parents: 1251
diff changeset
43 int F77_FCN (npoptn, NPOPTN) (const char*, long);
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
44
1253
bb67a902760b [project @ 1995-04-11 16:35:23 by jwe]
jwe
parents: 1251
diff changeset
45 int F77_FCN (npsol, NPSOL) (int&, int&, int&, int&, int&, int&,
bb67a902760b [project @ 1995-04-11 16:35:23 by jwe]
jwe
parents: 1251
diff changeset
46 double*, double*, double*,
bb67a902760b [project @ 1995-04-11 16:35:23 by jwe]
jwe
parents: 1251
diff changeset
47 int (*)(int&, const int&, const int&,
bb67a902760b [project @ 1995-04-11 16:35:23 by jwe]
jwe
parents: 1251
diff changeset
48 const int&, int*, double*,
bb67a902760b [project @ 1995-04-11 16:35:23 by jwe]
jwe
parents: 1251
diff changeset
49 double*, double*, int*),
bb67a902760b [project @ 1995-04-11 16:35:23 by jwe]
jwe
parents: 1251
diff changeset
50 int (*)(int&, const int&, double*,
bb67a902760b [project @ 1995-04-11 16:35:23 by jwe]
jwe
parents: 1251
diff changeset
51 double*, double*, int*),
bb67a902760b [project @ 1995-04-11 16:35:23 by jwe]
jwe
parents: 1251
diff changeset
52 int&, int&, int*, double*, double*,
bb67a902760b [project @ 1995-04-11 16:35:23 by jwe]
jwe
parents: 1251
diff changeset
53 double*, double&, double*, double*,
bb67a902760b [project @ 1995-04-11 16:35:23 by jwe]
jwe
parents: 1251
diff changeset
54 double*, int*, int&, double*, int&);
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
55 }
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
56
255
98246fedc941 [project @ 1993-12-08 22:55:41 by jwe]
jwe
parents: 238
diff changeset
57 // XXX FIXME XXX -- would be nice to not have to have this global
98246fedc941 [project @ 1993-12-08 22:55:41 by jwe]
jwe
parents: 238
diff changeset
58 // variable.
98246fedc941 [project @ 1993-12-08 22:55:41 by jwe]
jwe
parents: 238
diff changeset
59 // Nonzero means an error occurred in the calculation of the objective
98246fedc941 [project @ 1993-12-08 22:55:41 by jwe]
jwe
parents: 238
diff changeset
60 // function, and the user wants us to quit.
98246fedc941 [project @ 1993-12-08 22:55:41 by jwe]
jwe
parents: 238
diff changeset
61 int npsol_objective_error = 0;
98246fedc941 [project @ 1993-12-08 22:55:41 by jwe]
jwe
parents: 238
diff changeset
62
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
63 static objective_fcn user_phi;
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
64 static gradient_fcn user_grad;
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
65 static nonlinear_fcn user_g;
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
66 static jacobian_fcn user_jac;
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
67
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
68 int
1251
97eac19837dc [project @ 1995-04-11 15:58:32 by jwe]
jwe
parents: 1192
diff changeset
69 npsol_objfun (int& mode, const int& n, double *xx, double *objf,
97eac19837dc [project @ 1995-04-11 15:58:32 by jwe]
jwe
parents: 1192
diff changeset
70 double *objgrd, int* nstate)
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
71 {
1251
97eac19837dc [project @ 1995-04-11 15:58:32 by jwe]
jwe
parents: 1192
diff changeset
72 Vector tmp_x (n);
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
73
255
98246fedc941 [project @ 1993-12-08 22:55:41 by jwe]
jwe
parents: 238
diff changeset
74 npsol_objective_error = 0;
98246fedc941 [project @ 1993-12-08 22:55:41 by jwe]
jwe
parents: 238
diff changeset
75
1251
97eac19837dc [project @ 1995-04-11 15:58:32 by jwe]
jwe
parents: 1192
diff changeset
76 for (int i = 0; i < n; i++)
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
77 tmp_x.elem (i) = xx[i];
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
78
1251
97eac19837dc [project @ 1995-04-11 15:58:32 by jwe]
jwe
parents: 1192
diff changeset
79 if (mode == 0 || mode == 2)
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
80 {
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
81 double value = (*user_phi) (tmp_x);
255
98246fedc941 [project @ 1993-12-08 22:55:41 by jwe]
jwe
parents: 238
diff changeset
82
98246fedc941 [project @ 1993-12-08 22:55:41 by jwe]
jwe
parents: 238
diff changeset
83 if (npsol_objective_error)
98246fedc941 [project @ 1993-12-08 22:55:41 by jwe]
jwe
parents: 238
diff changeset
84 {
1251
97eac19837dc [project @ 1995-04-11 15:58:32 by jwe]
jwe
parents: 1192
diff changeset
85 mode = -1;
255
98246fedc941 [project @ 1993-12-08 22:55:41 by jwe]
jwe
parents: 238
diff changeset
86 return 0;
98246fedc941 [project @ 1993-12-08 22:55:41 by jwe]
jwe
parents: 238
diff changeset
87 }
98246fedc941 [project @ 1993-12-08 22:55:41 by jwe]
jwe
parents: 238
diff changeset
88
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
89 #if defined (sun) && defined (__GNUC__)
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
90 assign_double (objf, value);
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
91 #else
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
92 *objf = value;
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
93 #endif
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
94 }
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
95
1251
97eac19837dc [project @ 1995-04-11 15:58:32 by jwe]
jwe
parents: 1192
diff changeset
96 if ((mode == 1 || mode == 2) && user_grad)
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
97 {
1251
97eac19837dc [project @ 1995-04-11 15:58:32 by jwe]
jwe
parents: 1192
diff changeset
98 Vector tmp_grad (n);
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
99
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
100 tmp_grad = (*user_grad) (tmp_x);
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
101
255
98246fedc941 [project @ 1993-12-08 22:55:41 by jwe]
jwe
parents: 238
diff changeset
102 if (tmp_grad.length () == 0)
1251
97eac19837dc [project @ 1995-04-11 15:58:32 by jwe]
jwe
parents: 1192
diff changeset
103 mode = -1;
255
98246fedc941 [project @ 1993-12-08 22:55:41 by jwe]
jwe
parents: 238
diff changeset
104 else
98246fedc941 [project @ 1993-12-08 22:55:41 by jwe]
jwe
parents: 238
diff changeset
105 {
1251
97eac19837dc [project @ 1995-04-11 15:58:32 by jwe]
jwe
parents: 1192
diff changeset
106 for (i = 0; i < n; i++)
255
98246fedc941 [project @ 1993-12-08 22:55:41 by jwe]
jwe
parents: 238
diff changeset
107 objgrd[i] = tmp_grad.elem (i);
98246fedc941 [project @ 1993-12-08 22:55:41 by jwe]
jwe
parents: 238
diff changeset
108 }
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
109 }
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
110
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
111 return 0;
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
112 }
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
113
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
114 int
1251
97eac19837dc [project @ 1995-04-11 15:58:32 by jwe]
jwe
parents: 1192
diff changeset
115 npsol_confun (int& mode, const int& ncnln, const int& n,
97eac19837dc [project @ 1995-04-11 15:58:32 by jwe]
jwe
parents: 1192
diff changeset
116 const int& nrowj, int* needc, double *xx,
97eac19837dc [project @ 1995-04-11 15:58:32 by jwe]
jwe
parents: 1192
diff changeset
117 double *cons, double *cjac, int* nstate)
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
118 {
1251
97eac19837dc [project @ 1995-04-11 15:58:32 by jwe]
jwe
parents: 1192
diff changeset
119 Vector tmp_x (n);
97eac19837dc [project @ 1995-04-11 15:58:32 by jwe]
jwe
parents: 1192
diff changeset
120 Vector tmp_c (ncnln);
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
121
1251
97eac19837dc [project @ 1995-04-11 15:58:32 by jwe]
jwe
parents: 1192
diff changeset
122 for (int i = 0; i < n; i++)
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
123 tmp_x.elem (i) = xx[i];
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
124
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
125 tmp_c = (*user_g) (tmp_x);
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
126
255
98246fedc941 [project @ 1993-12-08 22:55:41 by jwe]
jwe
parents: 238
diff changeset
127 if (tmp_c.length () == 0)
98246fedc941 [project @ 1993-12-08 22:55:41 by jwe]
jwe
parents: 238
diff changeset
128 {
1251
97eac19837dc [project @ 1995-04-11 15:58:32 by jwe]
jwe
parents: 1192
diff changeset
129 mode = -1;
255
98246fedc941 [project @ 1993-12-08 22:55:41 by jwe]
jwe
parents: 238
diff changeset
130 return 0;
98246fedc941 [project @ 1993-12-08 22:55:41 by jwe]
jwe
parents: 238
diff changeset
131 }
98246fedc941 [project @ 1993-12-08 22:55:41 by jwe]
jwe
parents: 238
diff changeset
132 else
98246fedc941 [project @ 1993-12-08 22:55:41 by jwe]
jwe
parents: 238
diff changeset
133 {
1251
97eac19837dc [project @ 1995-04-11 15:58:32 by jwe]
jwe
parents: 1192
diff changeset
134 for (i = 0; i < ncnln; i++)
255
98246fedc941 [project @ 1993-12-08 22:55:41 by jwe]
jwe
parents: 238
diff changeset
135 cons[i] = tmp_c.elem (i);
98246fedc941 [project @ 1993-12-08 22:55:41 by jwe]
jwe
parents: 238
diff changeset
136 }
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
137
533
883197c5ad75 [project @ 1994-07-20 20:02:51 by jwe]
jwe
parents: 461
diff changeset
138 if (user_jac)
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
139 {
1251
97eac19837dc [project @ 1995-04-11 15:58:32 by jwe]
jwe
parents: 1192
diff changeset
140 Matrix tmp_jac (ncnln, n);
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
141
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
142 tmp_jac = (*user_jac) (tmp_x);
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
143
255
98246fedc941 [project @ 1993-12-08 22:55:41 by jwe]
jwe
parents: 238
diff changeset
144 if (tmp_jac.rows () == 0 || tmp_jac.columns () == 0)
1251
97eac19837dc [project @ 1995-04-11 15:58:32 by jwe]
jwe
parents: 1192
diff changeset
145 mode = -1;
255
98246fedc941 [project @ 1993-12-08 22:55:41 by jwe]
jwe
parents: 238
diff changeset
146 else
98246fedc941 [project @ 1993-12-08 22:55:41 by jwe]
jwe
parents: 238
diff changeset
147 {
1251
97eac19837dc [project @ 1995-04-11 15:58:32 by jwe]
jwe
parents: 1192
diff changeset
148 int ld = nrowj;
97eac19837dc [project @ 1995-04-11 15:58:32 by jwe]
jwe
parents: 1192
diff changeset
149 for (int j = 0; j < n; j++)
97eac19837dc [project @ 1995-04-11 15:58:32 by jwe]
jwe
parents: 1192
diff changeset
150 for (i = 0; i < ncnln; i++)
255
98246fedc941 [project @ 1993-12-08 22:55:41 by jwe]
jwe
parents: 238
diff changeset
151 cjac[i+j*ld] = tmp_jac (i, j);
98246fedc941 [project @ 1993-12-08 22:55:41 by jwe]
jwe
parents: 238
diff changeset
152 }
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
153 }
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
154
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
155 return 0;
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
156 }
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
157
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
158 Vector
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
159 NPSOL::minimize (void)
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
160 {
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
161 double objf;
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
162 int inform;
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
163 Vector lambda;
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
164 return minimize (objf, inform, lambda);
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
165 }
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
166
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
167 Vector
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
168 NPSOL::minimize (double& objf)
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
169 {
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
170 int inform;
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
171 Vector lambda;
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
172 return minimize (objf, inform, lambda);
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
173 }
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
174
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
175 Vector
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
176 NPSOL::minimize (double& objf, int& inform)
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
177 {
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
178 Vector lambda;
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
179 return minimize (objf, inform, lambda);
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
180 }
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
181
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
182 Vector
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
183 NPSOL::minimize (double& objf, int& inform, Vector& lambda)
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
184 {
656
d285f62d8638 [project @ 1994-08-29 04:32:55 by jwe]
jwe
parents: 533
diff changeset
185 // Dimensions of various things.
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
186
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
187 int n = x.capacity ();
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
188 int nclin = lc.size ();
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
189 int ncnln = nlc.size ();
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
190 int nrowa = 1 > nclin ? 1 : nclin;
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
191 int nrowj = 1 > ncnln ? 1 : ncnln;
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
192 int nrowr = n;
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
193
656
d285f62d8638 [project @ 1994-08-29 04:32:55 by jwe]
jwe
parents: 533
diff changeset
194 // Informative stuff.
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
195
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
196 int iter;
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
197 int *istate = new int [n+nclin+ncnln];
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
198
656
d285f62d8638 [project @ 1994-08-29 04:32:55 by jwe]
jwe
parents: 533
diff changeset
199 // User defined function stuff is defined above in the functions
d285f62d8638 [project @ 1994-08-29 04:32:55 by jwe]
jwe
parents: 533
diff changeset
200 // npsol_confun() and npsol_objfun();
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
201
656
d285f62d8638 [project @ 1994-08-29 04:32:55 by jwe]
jwe
parents: 533
diff changeset
202 // Constraint stuff.
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
203
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
204 double dummy;
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
205 double *pclin = &dummy;
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
206 Matrix clin;
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
207 if (nclin > 0)
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
208 {
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
209 clin = lc.constraint_matrix ();
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
210 pclin = clin.fortran_vec ();
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
211 }
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
212
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
213 double *clow = new double [n+nclin+ncnln];
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
214 double *cup = new double [n+nclin+ncnln];
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
215
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
216 if (bnds.size () > 0)
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
217 {
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
218 for (int i = 0; i < n; i++)
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
219 {
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
220 clow[i] = bnds.lower_bound (i);
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
221 cup[i] = bnds.upper_bound (i);
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
222 }
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
223 }
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
224 else
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
225 {
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
226 double huge = 1.0e30;
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
227 for (int i = 0; i < n; i++)
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
228 {
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
229 clow[i] = -huge;
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
230 cup[i] = huge;
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
231 }
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
232 }
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
233
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
234 for (int i = 0; i < nclin; i++)
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
235 {
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
236 clow[i+n] = lc.lower_bound (i);
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
237 cup[i+n] = lc.upper_bound (i);
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
238 }
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
239
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
240 for (i = 0; i < ncnln; i++)
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
241 {
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
242 clow[i+n+nclin] = nlc.lower_bound (i);
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
243 cup[i+n+nclin] = nlc.upper_bound (i);
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
244 }
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
245
656
d285f62d8638 [project @ 1994-08-29 04:32:55 by jwe]
jwe
parents: 533
diff changeset
246 double *c = 0;
d285f62d8638 [project @ 1994-08-29 04:32:55 by jwe]
jwe
parents: 533
diff changeset
247 double *cjac = 0;
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
248 if (ncnln > 0)
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
249 {
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
250 c = new double [ncnln];
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
251 cjac = new double [nrowj*n];
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
252 }
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
253
656
d285f62d8638 [project @ 1994-08-29 04:32:55 by jwe]
jwe
parents: 533
diff changeset
254 // Objective stuff.
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
255
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
256 double *objgrd = new double [n];
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
257
656
d285f62d8638 [project @ 1994-08-29 04:32:55 by jwe]
jwe
parents: 533
diff changeset
258 // Other stuff.
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
259
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
260 double *r = new double [n*n];
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
261
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
262 lambda.resize (n+nclin+ncnln);
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
263 double *pclambda = lambda.fortran_vec ();
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
264
656
d285f62d8638 [project @ 1994-08-29 04:32:55 by jwe]
jwe
parents: 533
diff changeset
265 // Decision variable stuff.
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
266
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
267 double *px = x.fortran_vec ();
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
268
656
d285f62d8638 [project @ 1994-08-29 04:32:55 by jwe]
jwe
parents: 533
diff changeset
269 // Workspace parameters.
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
270
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
271 int lenw;
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
272 int leniw = 3 * n + nclin + 2 * ncnln;
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
273 if (nclin == 0 && ncnln == 0)
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
274 lenw = 20*n;
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
275 else if (ncnln == 0)
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
276 lenw = 2*n*(10 + n) + 11*nclin;
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
277 else
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
278 lenw = 2*n*(n + 10) + nclin*(n + 11) + ncnln*(2*n + 21);
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
279
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
280 int *iw = new int [leniw];
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
281 double *w = new double [lenw];
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
282
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
283 user_phi = phi.objective_function ();
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
284 user_grad = phi.gradient_function ();
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
285 user_g = nlc.function ();
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
286 user_jac = nlc.jacobian_function ();
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
287
287
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
288 pass_options_to_npsol ();
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
289
533
883197c5ad75 [project @ 1994-07-20 20:02:51 by jwe]
jwe
parents: 461
diff changeset
290 if (! user_jac && ! user_grad)
1253
bb67a902760b [project @ 1995-04-11 16:35:23 by jwe]
jwe
parents: 1251
diff changeset
291 F77_FCN (npoptn, NPOPTN) ("Derivative Level 0", 18L);
533
883197c5ad75 [project @ 1994-07-20 20:02:51 by jwe]
jwe
parents: 461
diff changeset
292 else if (! user_jac && user_grad)
1253
bb67a902760b [project @ 1995-04-11 16:35:23 by jwe]
jwe
parents: 1251
diff changeset
293 F77_FCN (npoptn, NPOPTN) ("Derivative Level 1", 18L);
533
883197c5ad75 [project @ 1994-07-20 20:02:51 by jwe]
jwe
parents: 461
diff changeset
294 else if (user_jac && ! user_grad)
1253
bb67a902760b [project @ 1995-04-11 16:35:23 by jwe]
jwe
parents: 1251
diff changeset
295 F77_FCN (npoptn, NPOPTN) ("Derivative Level 2", 18L);
533
883197c5ad75 [project @ 1994-07-20 20:02:51 by jwe]
jwe
parents: 461
diff changeset
296 else if (user_jac && user_grad)
1253
bb67a902760b [project @ 1995-04-11 16:35:23 by jwe]
jwe
parents: 1251
diff changeset
297 F77_FCN (npoptn, NPOPTN) ("Derivative Level 3", 18L);
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
298
130
6642c455bf82 [project @ 1993-09-28 02:54:21 by jwe]
jwe
parents: 3
diff changeset
299 int attempt = 0;
6642c455bf82 [project @ 1993-09-28 02:54:21 by jwe]
jwe
parents: 3
diff changeset
300 while (attempt++ < 5)
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
301 {
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
302
1253
bb67a902760b [project @ 1995-04-11 16:35:23 by jwe]
jwe
parents: 1251
diff changeset
303 F77_FCN (npsol, NPSOL) (n, nclin, ncnln, nrowa, nrowj, nrowr,
bb67a902760b [project @ 1995-04-11 16:35:23 by jwe]
jwe
parents: 1251
diff changeset
304 pclin, clow, cup, npsol_confun,
bb67a902760b [project @ 1995-04-11 16:35:23 by jwe]
jwe
parents: 1251
diff changeset
305 npsol_objfun, inform, iter, istate, c,
bb67a902760b [project @ 1995-04-11 16:35:23 by jwe]
jwe
parents: 1251
diff changeset
306 cjac, pclambda, objf, objgrd, r, px, iw,
bb67a902760b [project @ 1995-04-11 16:35:23 by jwe]
jwe
parents: 1251
diff changeset
307 leniw, w, lenw);
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
308
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
309 if (inform == 6 || inform == 1)
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
310 continue;
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
311 else
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
312 break;
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
313 }
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
314
656
d285f62d8638 [project @ 1994-08-29 04:32:55 by jwe]
jwe
parents: 533
diff changeset
315 // Clean up.
d285f62d8638 [project @ 1994-08-29 04:32:55 by jwe]
jwe
parents: 533
diff changeset
316
d285f62d8638 [project @ 1994-08-29 04:32:55 by jwe]
jwe
parents: 533
diff changeset
317 delete [] istate;
d285f62d8638 [project @ 1994-08-29 04:32:55 by jwe]
jwe
parents: 533
diff changeset
318 delete [] clow;
d285f62d8638 [project @ 1994-08-29 04:32:55 by jwe]
jwe
parents: 533
diff changeset
319 delete [] cup;
d285f62d8638 [project @ 1994-08-29 04:32:55 by jwe]
jwe
parents: 533
diff changeset
320 delete [] c;
658
ce51ae1bc05e [project @ 1994-08-29 04:46:51 by jwe]
jwe
parents: 656
diff changeset
321 delete [] cjac;
656
d285f62d8638 [project @ 1994-08-29 04:32:55 by jwe]
jwe
parents: 533
diff changeset
322 delete [] objgrd;
d285f62d8638 [project @ 1994-08-29 04:32:55 by jwe]
jwe
parents: 533
diff changeset
323 delete [] r;
d285f62d8638 [project @ 1994-08-29 04:32:55 by jwe]
jwe
parents: 533
diff changeset
324 delete [] iw;
d285f62d8638 [project @ 1994-08-29 04:32:55 by jwe]
jwe
parents: 533
diff changeset
325 delete [] w;
d285f62d8638 [project @ 1994-08-29 04:32:55 by jwe]
jwe
parents: 533
diff changeset
326
d285f62d8638 [project @ 1994-08-29 04:32:55 by jwe]
jwe
parents: 533
diff changeset
327 // See how it went.
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
328
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
329 return x;
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
330 }
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
331
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
332 Vector
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
333 NPSOL::minimize (const Vector& xnew)
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
334 {
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
335 x = xnew;
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
336 return minimize ();
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
337 }
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
338
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
339 Vector
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
340 NPSOL::minimize (const Vector& xnew, double& objf)
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
341 {
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
342 x = xnew;
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
343 return minimize (objf);
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
344 }
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
345
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
346 Vector
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
347 NPSOL::minimize (const Vector& xnew, double& objf, int& inform)
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
348 {
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
349 x = xnew;
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
350 return minimize (objf, inform);
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
351 }
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
352
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
353 Vector
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
354 NPSOL::minimize (const Vector& xnew, double& objf, int& inform, Vector& lambda)
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
355 {
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
356 x = xnew;
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
357 return minimize (objf, inform, lambda);
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
358 }
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
359
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
360 NPSOL&
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
361 NPSOL::option (char *s)
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
362 {
287
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
363 cerr << "This function no longer has any effect.\n"
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
364 << "Use the NPSOL_option class instead\n";
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
365
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
366 return *this;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
367 }
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
368
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
369 NPSOL_options::NPSOL_options (void)
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
370 {
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
371 init ();
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
372 }
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
373
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
374 NPSOL_options::NPSOL_options (const NPSOL_options& opt)
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
375 {
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
376 copy (opt);
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
377 }
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
378
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
379 NPSOL_options&
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
380 NPSOL_options::operator = (const NPSOL_options& opt)
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
381 {
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
382 if (this != &opt)
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
383 copy (opt);
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
384
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
385 return *this;
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
386 }
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
387
287
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
388 NPSOL_options::~NPSOL_options (void)
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
389 {
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
390 }
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
391
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
392 void
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
393 NPSOL_options::init (void)
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
394 {
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
395 x_central_difference_interval = -1.0;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
396 x_crash_tolerance = 0.1;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
397 x_difference_interval = -1.0;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
398 x_function_precision = pow (DBL_EPSILON, 0.9);
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
399 x_infinite_bound = 1.0e+30;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
400 x_infinite_step = 1.0e+30;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
401 x_linear_feasibility_tolerance = sqrt (DBL_EPSILON);
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
402 x_linesearch_tolerance = 0.9;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
403 x_nonlinear_feasibility_tolerance = sqrt (DBL_EPSILON);
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
404 x_optimality_tolerance = pow (DBL_EPSILON, 0.8);
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
405 x_derivative_level = 0;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
406 x_major_iteration_limit = -1;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
407 x_minor_iteration_limit = -1;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
408 x_major_print_level = 0;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
409 x_minor_print_level = 0;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
410 x_start_objective_check = 1;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
411 x_start_constraint_check = 1;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
412 x_stop_objective_check = -1;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
413 x_stop_constraint_check = -1;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
414 x_verify_level = 0;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
415 }
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
416
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
417 void
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
418 NPSOL_options::copy (const NPSOL_options& opt)
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
419 {
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
420 x_central_difference_interval = opt.x_central_difference_interval;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
421 x_crash_tolerance = opt.x_crash_tolerance;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
422 x_difference_interval = opt.x_difference_interval;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
423 x_function_precision = opt.x_function_precision;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
424 x_infinite_bound = opt.x_infinite_bound;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
425 x_infinite_step = opt.x_infinite_step;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
426 x_linear_feasibility_tolerance = opt.x_linear_feasibility_tolerance;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
427 x_linesearch_tolerance = opt.x_linesearch_tolerance;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
428 x_nonlinear_feasibility_tolerance = opt.x_nonlinear_feasibility_tolerance;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
429 x_optimality_tolerance = opt.x_optimality_tolerance;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
430 x_derivative_level = opt.x_derivative_level;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
431 x_major_iteration_limit = opt.x_major_iteration_limit;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
432 x_minor_iteration_limit = opt.x_minor_iteration_limit;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
433 x_major_print_level = opt.x_major_print_level;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
434 x_minor_print_level = opt.x_minor_print_level;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
435 x_start_objective_check = opt.x_start_objective_check;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
436 x_start_constraint_check = opt.x_start_constraint_check;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
437 x_stop_objective_check = opt.x_stop_objective_check;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
438 x_stop_constraint_check = opt.x_stop_constraint_check;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
439 x_verify_level = opt.x_verify_level;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
440 }
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
441
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
442 void
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
443 NPSOL_options::set_default_options (void)
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
444 {
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
445 init ();
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
446 }
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
447
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
448 /*
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
449 * Passing invalid values to the set_* functions will result in
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
450 * setting the default option.
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
451 */
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
452
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
453 void
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
454 NPSOL_options::set_central_difference_interval (double val)
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
455 {
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
456 x_central_difference_interval = (val > 0.0) ? val : -1.0;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
457 }
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
458
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
459 void
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
460 NPSOL_options::set_crash_tolerance (double val)
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
461 {
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
462 x_crash_tolerance = (val >= 0.0) ? val : 0.1;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
463 }
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
464
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
465 void
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
466 NPSOL_options::set_difference_interval (double val)
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
467 {
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
468 x_difference_interval = (val > 0.0) ? val : -1.0;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
469 }
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
470
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
471 void
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
472 NPSOL_options::set_function_precision (double val)
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
473 {
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
474 x_function_precision = (val > 0.0) ? val : pow (DBL_EPSILON, 0.9);
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
475 }
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
476
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
477 void
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
478 NPSOL_options::set_infinite_bound (double val)
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
479 {
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
480 x_infinite_bound = (val > 0.0) ? val : 1.0e+30;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
481 }
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
482
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
483 void
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
484 NPSOL_options::set_infinite_step (double val)
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
485 {
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
486 x_infinite_step = (val > 0.0) ? val : 1.0e+30;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
487 }
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
488
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
489 void
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
490 NPSOL_options::set_linear_feasibility_tolerance (double val)
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
491 {
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
492 x_linear_feasibility_tolerance = (val > 0.0) ? val : sqrt (DBL_EPSILON);
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
493 }
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
494
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
495 void
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
496 NPSOL_options::set_linesearch_tolerance (double val)
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
497 {
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
498 x_linesearch_tolerance = (val >= 0.0 && val < 1.0) ? val : 0.9;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
499 }
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
500
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
501 void
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
502 NPSOL_options::set_nonlinear_feasibility_tolerance (double val)
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
503 {
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
504 x_nonlinear_feasibility_tolerance = (val > 0.0) ? val : sqrt (DBL_EPSILON);
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
505 }
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
506
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
507 void
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
508 NPSOL_options::set_optimality_tolerance (double val)
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
509 {
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
510 x_optimality_tolerance = (val > 0.0) ? val : pow (DBL_EPSILON, 0.8);
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
511 }
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
512
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
513 void
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
514 NPSOL_options::set_derivative_level (int val)
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
515 {
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
516 x_derivative_level = (val >= 0 && val < 4) ? val : 0;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
517 }
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
518
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
519 void
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
520 NPSOL_options::set_major_iteration_limit (int val)
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
521 {
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
522 x_major_iteration_limit = (val > 0) ? val : -1;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
523 }
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
524
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
525 void
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
526 NPSOL_options::set_minor_iteration_limit (int val)
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
527 {
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
528 x_minor_iteration_limit = (val > 0) ? val : -1;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
529 }
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
530
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
531 void
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
532 NPSOL_options::set_major_print_level (int val)
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
533 {
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
534 x_major_print_level = (val >= 0) ? val : -1;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
535 }
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
536
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
537 void
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
538 NPSOL_options::set_minor_print_level (int val)
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
539 {
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
540 x_minor_print_level = (val >= 0) ? val : -1;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
541 }
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
542
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
543 void
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
544 NPSOL_options::set_start_objective_check (int val)
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
545 {
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
546 x_start_objective_check = (val >= 0) ? val : -1;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
547 }
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
548
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
549 void
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
550 NPSOL_options::set_start_constraint_check (int val)
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
551 {
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
552 x_start_constraint_check = (val >= 0) ? val : -1;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
553 }
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
554
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
555 void
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
556 NPSOL_options::set_stop_objective_check (int val)
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
557 {
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
558 x_stop_objective_check = (val >= 0) ? val : -1;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
559 }
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
560
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
561 void
287
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
562 NPSOL_options::set_stop_constraint_check (int val)
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
563 {
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
564 x_stop_constraint_check = (val >= 0) ? val : -1;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
565 }
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
566
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
567 void
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
568 NPSOL_options::set_verify_level (int val)
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
569 {
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
570 x_verify_level = ((val > -1 && val < 4) || (val > 9 && val < 14)) ? val : 0;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
571 }
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
572
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
573 double
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
574 NPSOL_options::central_difference_interval (void) const
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
575 {
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
576 return x_central_difference_interval;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
577 }
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
578
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
579 double
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
580 NPSOL_options::crash_tolerance (void) const
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
581 {
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
582 return x_crash_tolerance;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
583 }
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
584
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
585 double
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
586 NPSOL_options::difference_interval (void) const
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
587 {
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
588 return x_difference_interval;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
589 }
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
590
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
591 double
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
592 NPSOL_options::function_precision (void) const
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
593 {
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
594 return x_function_precision;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
595 }
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
596
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
597 double
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
598 NPSOL_options::infinite_bound (void) const
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
599 {
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
600 return x_infinite_bound;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
601 }
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
602
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
603 double
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
604 NPSOL_options::infinite_step (void) const
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
605 {
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
606 return x_infinite_step;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
607 }
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
608
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
609 double
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
610 NPSOL_options::linear_feasibility_tolerance (void) const
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
611 {
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
612 return x_linear_feasibility_tolerance;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
613 }
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
614
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
615 double
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
616 NPSOL_options::linesearch_tolerance (void) const
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
617 {
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
618 return x_linesearch_tolerance;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
619 }
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
620
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
621 double
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
622 NPSOL_options::nonlinear_feasibility_tolerance (void) const
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
623 {
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
624 return x_nonlinear_feasibility_tolerance;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
625 }
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
626
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
627 double
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
628 NPSOL_options::optimality_tolerance (void) const
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
629 {
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
630 return x_optimality_tolerance;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
631 }
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
632
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
633 int
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
634 NPSOL_options::derivative_level (void) const
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
635 {
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
636 return x_derivative_level;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
637 }
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
638
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
639 int
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
640 NPSOL_options::major_iteration_limit (void) const
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
641 {
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
642 return x_major_iteration_limit;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
643 }
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
644
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
645 int
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
646 NPSOL_options::minor_iteration_limit (void) const
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
647 {
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
648 return x_minor_iteration_limit;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
649 }
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
650
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
651 int
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
652 NPSOL_options::major_print_level (void) const
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
653 {
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
654 return x_major_print_level;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
655 }
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
656
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
657 int
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
658 NPSOL_options::minor_print_level (void) const
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
659 {
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
660 return x_minor_print_level;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
661 }
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
662
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
663 int
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
664 NPSOL_options::start_objective_check (void) const
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
665 {
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
666 return x_start_objective_check;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
667 }
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
668
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
669 int
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
670 NPSOL_options::start_constraint_check (void) const
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
671 {
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
672 return x_start_constraint_check;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
673 }
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
674
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
675 int
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
676 NPSOL_options::stop_objective_check (void) const
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
677 {
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
678 return x_stop_objective_check;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
679 }
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
680
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
681 int
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
682 NPSOL_options::stop_constraint_check (void) const
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
683 {
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
684 return x_stop_constraint_check;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
685 }
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
686
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
687 int
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
688 NPSOL_options::verify_level (void) const
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
689 {
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
690 return x_verify_level;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
691 }
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
692
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
693 void
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
694 NPSOL_options::pass_options_to_npsol (void)
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
695 {
1253
bb67a902760b [project @ 1995-04-11 16:35:23 by jwe]
jwe
parents: 1251
diff changeset
696 F77_FCN (npoptn, NPOPTN) ("Nolist", 6L);
bb67a902760b [project @ 1995-04-11 16:35:23 by jwe]
jwe
parents: 1251
diff changeset
697 F77_FCN (npoptn, NPOPTN) ("Defaults", 8L);
287
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
698
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
699 if (x_central_difference_interval > 0.0)
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
700 set_option ("Central Difference", x_central_difference_interval);
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
701
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
702 set_option ("Crash Tolerance", x_crash_tolerance);
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
703
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
704 if (x_difference_interval > 0.0)
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
705 set_option ("Difference Interval", x_difference_interval);
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
706
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
707 set_option ("Function Precision", x_function_precision);
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
708
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
709 set_option ("Infinite Bound", x_infinite_bound);
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
710
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
711 set_option ("Infinite Step", x_infinite_step);
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
712
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
713 set_option ("Linear Feasibility", x_linear_feasibility_tolerance);
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
714
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
715 set_option ("Linesearch Tolerance", x_linesearch_tolerance);
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
716
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
717 set_option ("Nonlinear Feasibility", x_nonlinear_feasibility_tolerance);
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
718
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
719 set_option ("Optimality Tolerance", x_optimality_tolerance);
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
720
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
721 set_option ("Derivative Level", x_derivative_level);
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
722
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
723 if (x_major_iteration_limit > 0)
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
724 set_option ("Major Iteration", x_major_iteration_limit);
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
725
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
726 if (x_minor_iteration_limit > 0)
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
727 set_option ("Minor Iteration", x_minor_iteration_limit);
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
728
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
729 set_option ("Major Print", x_major_print_level);
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
730
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
731 set_option ("Minor Print", x_minor_print_level);
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
732
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
733 set_option ("Start Objective", x_start_objective_check);
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
734
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
735 set_option ("Start Constraint", x_start_constraint_check);
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
736
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
737 if (x_stop_objective_check > 0)
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
738 set_option ("Stop Objective", x_stop_objective_check);
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
739
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
740 if (x_stop_constraint_check > 0)
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
741 set_option ("Stop Constraint", x_stop_constraint_check);
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
742
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
743 set_option ("Verify Level", x_verify_level);
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
744 }
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
745
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
746 void
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
747 NPSOL_options::set_option (const char *key, int opt)
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
748 {
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
749 ostrstream buf;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
750 buf << key << " " << opt << ends;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
751 char *command = buf.str ();
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
752 size_t len = strlen (command);
1253
bb67a902760b [project @ 1995-04-11 16:35:23 by jwe]
jwe
parents: 1251
diff changeset
753 F77_FCN (npoptn, NPOPTN) (command, (long) len);
287
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
754 delete [] command;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
755 }
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
756
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
757 void
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
758 NPSOL_options::set_option (const char *key, double opt)
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
759 {
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
760 ostrstream buf;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
761 buf << key << " " << opt << ends;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
762 char *command = buf.str ();
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
763 size_t len = strlen (command);
1253
bb67a902760b [project @ 1995-04-11 16:35:23 by jwe]
jwe
parents: 1251
diff changeset
764 F77_FCN (npoptn, NPOPTN) (command, (long) len);
287
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
765 delete [] command;
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
766 }
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
767
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
768 #endif /* NPSOL_MISSING */
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
769
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
770 /*
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
771 ;;; Local Variables: ***
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
772 ;;; mode: C++ ***
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
773 ;;; page-delimiter: "^/\\*" ***
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
774 ;;; End: ***
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
775 */