annotate liboctave/NPSOL.cc @ 296:3c23b8ea9099

[project @ 1994-01-17 02:49:15 by jwe]
author jwe
date Mon, 17 Jan 1994 02:54:02 +0000
parents f8ae4f4dc9fd
children 00f8b2242a18
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
296
3c23b8ea9099 [project @ 1994-01-17 02:49:15 by jwe]
jwe
parents: 288
diff changeset
4 Copyright (C) 1992, 1993, 1994 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
780cbbc57b7c [project @ 1993-11-30 20:23:04 by jwe]
jwe
parents: 130
diff changeset
25 #include "config.h"
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
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
35 #include "NPSOL.h"
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
36 #include "f77-uscore.h"
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
37 #include "sun-utils.h"
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
38
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
39 extern "C"
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 int F77_FCN (npoptn) (char *, long);
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
42
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
43 int F77_FCN (npsol) (int *, int *, int *, int *, int *, int *,
255
98246fedc941 [project @ 1993-12-08 22:55:41 by jwe]
jwe
parents: 238
diff changeset
44 double *, double *, double *,
98246fedc941 [project @ 1993-12-08 22:55:41 by jwe]
jwe
parents: 238
diff changeset
45 int (*)(int*, int*, int*, int*, int*, double*,
98246fedc941 [project @ 1993-12-08 22:55:41 by jwe]
jwe
parents: 238
diff changeset
46 double*, double*, int*),
98246fedc941 [project @ 1993-12-08 22:55:41 by jwe]
jwe
parents: 238
diff changeset
47 int (*)(int*, int*, double*, double*, double*, int*),
98246fedc941 [project @ 1993-12-08 22:55:41 by jwe]
jwe
parents: 238
diff changeset
48 int *, int *, int *, double *,
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
49 double *, double *, double *, double *,
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
50 double *, double *, int *, int *, double *,
287
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
51 int *);
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
52 }
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
53
255
98246fedc941 [project @ 1993-12-08 22:55:41 by jwe]
jwe
parents: 238
diff changeset
54 // 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
55 // variable.
98246fedc941 [project @ 1993-12-08 22:55:41 by jwe]
jwe
parents: 238
diff changeset
56 // 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
57 // function, and the user wants us to quit.
98246fedc941 [project @ 1993-12-08 22:55:41 by jwe]
jwe
parents: 238
diff changeset
58 int npsol_objective_error = 0;
98246fedc941 [project @ 1993-12-08 22:55:41 by jwe]
jwe
parents: 238
diff changeset
59
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
60 static objective_fcn user_phi;
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
61 static gradient_fcn user_grad;
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
62 static nonlinear_fcn user_g;
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
63 static jacobian_fcn user_jac;
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
64
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
65 int
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
66 npsol_objfun (int *mode, int *n, double *xx, double *objf,
287
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
67 double *objgrd, int *nstate)
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
68 {
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
69 int nn = *n;
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
70 Vector tmp_x (nn);
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
71
255
98246fedc941 [project @ 1993-12-08 22:55:41 by jwe]
jwe
parents: 238
diff changeset
72 npsol_objective_error = 0;
98246fedc941 [project @ 1993-12-08 22:55:41 by jwe]
jwe
parents: 238
diff changeset
73
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
74 for (int i = 0; i < nn; i++)
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
75 tmp_x.elem (i) = xx[i];
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
76
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
77 if (*mode == 0 || *mode == 2)
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
78 {
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
79 double value = (*user_phi) (tmp_x);
255
98246fedc941 [project @ 1993-12-08 22:55:41 by jwe]
jwe
parents: 238
diff changeset
80
98246fedc941 [project @ 1993-12-08 22:55:41 by jwe]
jwe
parents: 238
diff changeset
81 if (npsol_objective_error)
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 *mode = -1;
98246fedc941 [project @ 1993-12-08 22:55:41 by jwe]
jwe
parents: 238
diff changeset
84 return 0;
98246fedc941 [project @ 1993-12-08 22:55:41 by jwe]
jwe
parents: 238
diff changeset
85 }
98246fedc941 [project @ 1993-12-08 22:55:41 by jwe]
jwe
parents: 238
diff changeset
86
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
87 #if defined (sun) && defined (__GNUC__)
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
88 assign_double (objf, value);
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
89 #else
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
90 *objf = value;
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
91 #endif
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
92 }
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
93
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
94 if ((*mode == 1 || *mode == 2) && user_grad != NULL)
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
95 {
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
96 Vector tmp_grad (nn);
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
97
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
98 tmp_grad = (*user_grad) (tmp_x);
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
99
255
98246fedc941 [project @ 1993-12-08 22:55:41 by jwe]
jwe
parents: 238
diff changeset
100 if (tmp_grad.length () == 0)
98246fedc941 [project @ 1993-12-08 22:55:41 by jwe]
jwe
parents: 238
diff changeset
101 *mode = -1;
98246fedc941 [project @ 1993-12-08 22:55:41 by jwe]
jwe
parents: 238
diff changeset
102 else
98246fedc941 [project @ 1993-12-08 22:55:41 by jwe]
jwe
parents: 238
diff changeset
103 {
98246fedc941 [project @ 1993-12-08 22:55:41 by jwe]
jwe
parents: 238
diff changeset
104 for (i = 0; i < nn; i++)
98246fedc941 [project @ 1993-12-08 22:55:41 by jwe]
jwe
parents: 238
diff changeset
105 objgrd[i] = tmp_grad.elem (i);
98246fedc941 [project @ 1993-12-08 22:55:41 by jwe]
jwe
parents: 238
diff changeset
106 }
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
107 }
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
108
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
109 return 0;
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
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
112 int
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
113 npsol_confun (int *mode, int *ncnln, int *n, int *nrowj, int *needc,
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
114 double *xx, double *cons, double *cjac, int *nstate)
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
115 {
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
116 int nn = *n, nncnln = *ncnln;
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
117 Vector tmp_x (nn);
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
118 Vector tmp_c (nncnln);
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
119
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
120 for (int i = 0; i < nn; i++)
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
121 tmp_x.elem (i) = xx[i];
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
122
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
123 tmp_c = (*user_g) (tmp_x);
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
124
255
98246fedc941 [project @ 1993-12-08 22:55:41 by jwe]
jwe
parents: 238
diff changeset
125 if (tmp_c.length () == 0)
98246fedc941 [project @ 1993-12-08 22:55:41 by jwe]
jwe
parents: 238
diff changeset
126 {
98246fedc941 [project @ 1993-12-08 22:55:41 by jwe]
jwe
parents: 238
diff changeset
127 *mode = -1;
98246fedc941 [project @ 1993-12-08 22:55:41 by jwe]
jwe
parents: 238
diff changeset
128 return 0;
98246fedc941 [project @ 1993-12-08 22:55:41 by jwe]
jwe
parents: 238
diff changeset
129 }
98246fedc941 [project @ 1993-12-08 22:55:41 by jwe]
jwe
parents: 238
diff changeset
130 else
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 for (i = 0; i < nncnln; i++)
98246fedc941 [project @ 1993-12-08 22:55:41 by jwe]
jwe
parents: 238
diff changeset
133 cons[i] = tmp_c.elem (i);
98246fedc941 [project @ 1993-12-08 22:55:41 by jwe]
jwe
parents: 238
diff changeset
134 }
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
135
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
136 if (user_jac != NULL)
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
137 {
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
138 Matrix tmp_jac (nncnln, nn);
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
139
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
140 tmp_jac = (*user_jac) (tmp_x);
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
141
255
98246fedc941 [project @ 1993-12-08 22:55:41 by jwe]
jwe
parents: 238
diff changeset
142 if (tmp_jac.rows () == 0 || tmp_jac.columns () == 0)
98246fedc941 [project @ 1993-12-08 22:55:41 by jwe]
jwe
parents: 238
diff changeset
143 *mode = -1;
98246fedc941 [project @ 1993-12-08 22:55:41 by jwe]
jwe
parents: 238
diff changeset
144 else
98246fedc941 [project @ 1993-12-08 22:55:41 by jwe]
jwe
parents: 238
diff changeset
145 {
98246fedc941 [project @ 1993-12-08 22:55:41 by jwe]
jwe
parents: 238
diff changeset
146 int ld = *nrowj;
98246fedc941 [project @ 1993-12-08 22:55:41 by jwe]
jwe
parents: 238
diff changeset
147 for (int j = 0; j < nn; j++)
98246fedc941 [project @ 1993-12-08 22:55:41 by jwe]
jwe
parents: 238
diff changeset
148 for (i = 0; i < nncnln; i++)
98246fedc941 [project @ 1993-12-08 22:55:41 by jwe]
jwe
parents: 238
diff changeset
149 cjac[i+j*ld] = tmp_jac (i, j);
98246fedc941 [project @ 1993-12-08 22:55:41 by jwe]
jwe
parents: 238
diff changeset
150 }
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
151 }
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
152
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
153 return 0;
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
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
156 Vector
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
157 NPSOL::minimize (void)
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
158 {
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
159 double objf;
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
160 int inform;
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
161 Vector lambda;
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
162 return minimize (objf, inform, lambda);
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
163 }
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
164
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
165 Vector
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
166 NPSOL::minimize (double& objf)
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
167 {
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
168 int inform;
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
169 Vector lambda;
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
170 return minimize (objf, inform, lambda);
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
171 }
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
172
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
173 Vector
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
174 NPSOL::minimize (double& objf, int& inform)
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
175 {
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
176 Vector lambda;
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
177 return minimize (objf, inform, lambda);
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
178 }
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
179
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
180 Vector
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
181 NPSOL::minimize (double& objf, int& inform, Vector& lambda)
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
182 {
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
183 // Dimensions of various things.
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
184
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
185 int n = x.capacity ();
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
186 int nclin = lc.size ();
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
187 int ncnln = nlc.size ();
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
188 int nrowa = 1 > nclin ? 1 : nclin;
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
189 int nrowj = 1 > ncnln ? 1 : ncnln;
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
190 int nrowr = n;
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
191
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
192 // Informative stuff.
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
193
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
194 int iter;
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
195 int *istate = new int [n+nclin+ncnln];
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
196
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
197 // User defined function stuff is defined above in the functions
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
198 // npsol_confun() and npsol_objfun();
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
199
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
200 // Constraint stuff.
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
201
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
202 double dummy;
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
203 double *pclin = &dummy;
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
204 Matrix clin;
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
205 if (nclin > 0)
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
206 {
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
207 clin = lc.constraint_matrix ();
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
208 pclin = clin.fortran_vec ();
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
209 }
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
210
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
211 double *clow = new double [n+nclin+ncnln];
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
212 double *cup = new double [n+nclin+ncnln];
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
213
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
214 if (bnds.size () > 0)
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 for (int i = 0; i < n; i++)
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 clow[i] = bnds.lower_bound (i);
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
219 cup[i] = bnds.upper_bound (i);
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
220 }
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
221 }
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
222 else
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 double huge = 1.0e30;
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
225 for (int i = 0; i < n; i++)
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
226 {
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
227 clow[i] = -huge;
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
228 cup[i] = huge;
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
229 }
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
230 }
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 for (int i = 0; i < nclin; i++)
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 clow[i+n] = lc.lower_bound (i);
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
235 cup[i+n] = lc.upper_bound (i);
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
236 }
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
237
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
238 for (i = 0; i < ncnln; i++)
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 clow[i+n+nclin] = nlc.lower_bound (i);
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
241 cup[i+n+nclin] = nlc.upper_bound (i);
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
242 }
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
243
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
244 double *c = &dummy;
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
245 double *cjac = &dummy;
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
246 if (ncnln > 0)
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
247 {
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
248 c = new double [ncnln];
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
249 cjac = new double [nrowj*n];
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
250 }
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
251
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
252 // Objective stuff.
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
253
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
254 double *objgrd = new double [n];
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 // Other stuff.
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
257
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
258 double *r = new double [n*n];
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 lambda.resize (n+nclin+ncnln);
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
261 double *pclambda = lambda.fortran_vec ();
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
262
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
263 // Decision variable stuff.
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
264
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
265 double *px = x.fortran_vec ();
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 // Workspace parameters.
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
268
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
269 int lenw;
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
270 int leniw = 3 * n + nclin + 2 * ncnln;
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
271 if (nclin == 0 && ncnln == 0)
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
272 lenw = 20*n;
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
273 else if (ncnln == 0)
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
274 lenw = 2*n*(10 + n) + 11*nclin;
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
275 else
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
276 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
277
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
278 int *iw = new int [leniw];
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
279 double *w = new double [lenw];
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
280
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
281 user_phi = phi.objective_function ();
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
282 user_grad = phi.gradient_function ();
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
283 user_g = nlc.function ();
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
284 user_jac = nlc.jacobian_function ();
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
285
287
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
286 pass_options_to_npsol ();
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
287
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
288 if (user_jac == NULL && user_grad == NULL)
287
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
289 F77_FCN (npoptn) ("Derivative Level 0", 18L);
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
290 else if (user_jac == NULL && user_grad != NULL)
287
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
291 F77_FCN (npoptn) ("Derivative Level 1", 18L);
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
292 else if (user_jac != NULL && user_grad == NULL)
287
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
293 F77_FCN (npoptn) ("Derivative Level 2", 18L);
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
294 else if (user_jac != NULL && user_grad != NULL)
287
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
295 F77_FCN (npoptn) ("Derivative Level 3", 18L);
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
296
130
6642c455bf82 [project @ 1993-09-28 02:54:21 by jwe]
jwe
parents: 3
diff changeset
297 int attempt = 0;
6642c455bf82 [project @ 1993-09-28 02:54:21 by jwe]
jwe
parents: 3
diff changeset
298 while (attempt++ < 5)
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
299 {
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
300
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
301 F77_FCN (npsol) (&n, &nclin, &ncnln, &nrowa, &nrowj, &nrowr, pclin,
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
302 clow, cup, npsol_confun, npsol_objfun, &inform,
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
303 &iter, istate, c, cjac, pclambda, &objf, objgrd, r,
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
304 px, iw, &leniw, w, &lenw);
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
305
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
306 if (inform == 6 || inform == 1)
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
307 continue;
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
308 else
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
309 break;
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
310 }
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
311
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
312 // See how it went.
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 return x;
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
315 }
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
316
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
317 Vector
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
318 NPSOL::minimize (const Vector& xnew)
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
319 {
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
320 x = xnew;
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
321 return minimize ();
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
322 }
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
323
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
324 Vector
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
325 NPSOL::minimize (const Vector& xnew, double& objf)
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
326 {
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
327 x = xnew;
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
328 return minimize (objf);
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
329 }
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 Vector
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
332 NPSOL::minimize (const Vector& xnew, double& objf, int& inform)
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
333 {
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
334 x = xnew;
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
335 return minimize (objf, inform);
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
336 }
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 Vector
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
339 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
340 {
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
341 x = xnew;
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
342 return minimize (objf, inform, lambda);
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
343 }
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 NPSOL&
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
346 NPSOL::option (char *s)
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
347 {
287
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
348 cerr << "This function no longer has any effect.\n"
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
349 << "Use the NPSOL_option class instead\n";
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
350
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
351 return *this;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
352 }
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
353
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
354 NPSOL_options::NPSOL_options (void)
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
355 {
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
356 init ();
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
357 }
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
358
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
359 NPSOL_options::NPSOL_options (const NPSOL_options& opt)
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
360 {
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
361 copy (opt);
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
362 }
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
363
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
364 NPSOL_options&
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
365 NPSOL_options::operator = (const NPSOL_options& opt)
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
366 {
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
367 if (this != &opt)
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
368 copy (opt);
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
369
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
370 return *this;
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
371 }
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
372
287
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
373 NPSOL_options::~NPSOL_options (void)
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
374 {
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
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
377 void
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
378 NPSOL_options::init (void)
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
379 {
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
380 x_central_difference_interval = -1.0;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
381 x_crash_tolerance = 0.1;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
382 x_difference_interval = -1.0;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
383 x_function_precision = pow (DBL_EPSILON, 0.9);
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
384 x_infinite_bound = 1.0e+30;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
385 x_infinite_step = 1.0e+30;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
386 x_linear_feasibility_tolerance = sqrt (DBL_EPSILON);
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
387 x_linesearch_tolerance = 0.9;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
388 x_nonlinear_feasibility_tolerance = sqrt (DBL_EPSILON);
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
389 x_optimality_tolerance = pow (DBL_EPSILON, 0.8);
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
390 x_derivative_level = 0;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
391 x_major_iteration_limit = -1;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
392 x_minor_iteration_limit = -1;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
393 x_major_print_level = 0;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
394 x_minor_print_level = 0;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
395 x_start_objective_check = 1;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
396 x_start_constraint_check = 1;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
397 x_stop_objective_check = -1;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
398 x_stop_constraint_check = -1;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
399 x_verify_level = 0;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
400 }
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
401
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
402 void
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
403 NPSOL_options::copy (const NPSOL_options& opt)
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
404 {
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
405 x_central_difference_interval = opt.x_central_difference_interval;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
406 x_crash_tolerance = opt.x_crash_tolerance;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
407 x_difference_interval = opt.x_difference_interval;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
408 x_function_precision = opt.x_function_precision;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
409 x_infinite_bound = opt.x_infinite_bound;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
410 x_infinite_step = opt.x_infinite_step;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
411 x_linear_feasibility_tolerance = opt.x_linear_feasibility_tolerance;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
412 x_linesearch_tolerance = opt.x_linesearch_tolerance;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
413 x_nonlinear_feasibility_tolerance = opt.x_nonlinear_feasibility_tolerance;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
414 x_optimality_tolerance = opt.x_optimality_tolerance;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
415 x_derivative_level = opt.x_derivative_level;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
416 x_major_iteration_limit = opt.x_major_iteration_limit;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
417 x_minor_iteration_limit = opt.x_minor_iteration_limit;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
418 x_major_print_level = opt.x_major_print_level;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
419 x_minor_print_level = opt.x_minor_print_level;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
420 x_start_objective_check = opt.x_start_objective_check;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
421 x_start_constraint_check = opt.x_start_constraint_check;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
422 x_stop_objective_check = opt.x_stop_objective_check;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
423 x_stop_constraint_check = opt.x_stop_constraint_check;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
424 x_verify_level = opt.x_verify_level;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
425 }
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
426
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
427 void
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
428 NPSOL_options::set_default_options (void)
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
429 {
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
430 init ();
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
431 }
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
432
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
433 /*
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
434 * 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
435 * setting the default option.
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
436 */
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
437
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
438 void
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
439 NPSOL_options::set_central_difference_interval (double val)
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 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
442 }
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
443
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
444 void
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
445 NPSOL_options::set_crash_tolerance (double val)
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 x_crash_tolerance = (val >= 0.0) ? val : 0.1;
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
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
450 void
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
451 NPSOL_options::set_difference_interval (double val)
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 x_difference_interval = (val > 0.0) ? val : -1.0;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
454 }
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 void
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
457 NPSOL_options::set_function_precision (double val)
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 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
460 }
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 void
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
463 NPSOL_options::set_infinite_bound (double val)
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 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
466 }
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 void
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
469 NPSOL_options::set_infinite_step (double val)
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 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
472 }
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 void
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
475 NPSOL_options::set_linear_feasibility_tolerance (double val)
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 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
478 }
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 void
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
481 NPSOL_options::set_linesearch_tolerance (double val)
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 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
484 }
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 void
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
487 NPSOL_options::set_nonlinear_feasibility_tolerance (double val)
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 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
490 }
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 void
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
493 NPSOL_options::set_optimality_tolerance (double val)
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 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
496 }
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 void
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
499 NPSOL_options::set_derivative_level (int val)
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 x_derivative_level = (val >= 0 && val < 4) ? val : 0;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
502 }
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 void
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
505 NPSOL_options::set_major_iteration_limit (int val)
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 x_major_iteration_limit = (val > 0) ? val : -1;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
508 }
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 void
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
511 NPSOL_options::set_minor_iteration_limit (int val)
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 x_minor_iteration_limit = (val > 0) ? val : -1;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
514 }
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 void
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
517 NPSOL_options::set_major_print_level (int val)
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 x_major_print_level = (val >= 0) ? val : -1;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
520 }
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 void
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
523 NPSOL_options::set_minor_print_level (int val)
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 x_minor_print_level = (val >= 0) ? val : -1;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
526 }
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 void
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
529 NPSOL_options::set_start_objective_check (int val)
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 x_start_objective_check = (val >= 0) ? val : -1;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
532 }
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 void
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
535 NPSOL_options::set_start_constraint_check (int val)
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 x_start_constraint_check = (val >= 0) ? val : -1;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
538 }
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 void
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
541 NPSOL_options::set_stop_objective_check (int val)
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 x_stop_objective_check = (val >= 0) ? val : -1;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
544 }
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
545
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
546 void
287
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
547 NPSOL_options::set_stop_constraint_check (int val)
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 x_stop_constraint_check = (val >= 0) ? val : -1;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
550 }
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 void
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
553 NPSOL_options::set_verify_level (int val)
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 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
556 }
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 double
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
559 NPSOL_options::central_difference_interval (void) const
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
560 {
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
561 return x_central_difference_interval;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
562 }
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 double
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
565 NPSOL_options::crash_tolerance (void) const
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 return x_crash_tolerance;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
568 }
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 double
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
571 NPSOL_options::difference_interval (void) const
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 return x_difference_interval;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
574 }
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 double
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
577 NPSOL_options::function_precision (void) const
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 return x_function_precision;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
580 }
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 double
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
583 NPSOL_options::infinite_bound (void) const
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 return x_infinite_bound;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
586 }
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 double
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
589 NPSOL_options::infinite_step (void) const
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 return x_infinite_step;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
592 }
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 double
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
595 NPSOL_options::linear_feasibility_tolerance (void) const
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 return x_linear_feasibility_tolerance;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
598 }
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 double
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
601 NPSOL_options::linesearch_tolerance (void) const
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 return x_linesearch_tolerance;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
604 }
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 double
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
607 NPSOL_options::nonlinear_feasibility_tolerance (void) const
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 return x_nonlinear_feasibility_tolerance;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
610 }
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 double
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
613 NPSOL_options::optimality_tolerance (void) const
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 return x_optimality_tolerance;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
616 }
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 int
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
619 NPSOL_options::derivative_level (void) const
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 return x_derivative_level;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
622 }
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 int
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
625 NPSOL_options::major_iteration_limit (void) const
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 return x_major_iteration_limit;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
628 }
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 int
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
631 NPSOL_options::minor_iteration_limit (void) const
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 return x_minor_iteration_limit;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
634 }
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 int
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
637 NPSOL_options::major_print_level (void) const
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 return x_major_print_level;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
640 }
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 int
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
643 NPSOL_options::minor_print_level (void) const
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 return x_minor_print_level;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
646 }
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 int
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
649 NPSOL_options::start_objective_check (void) const
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 return x_start_objective_check;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
652 }
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 int
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
655 NPSOL_options::start_constraint_check (void) const
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 return x_start_constraint_check;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
658 }
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 int
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
661 NPSOL_options::stop_objective_check (void) const
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 return x_stop_objective_check;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
664 }
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 int
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
667 NPSOL_options::stop_constraint_check (void) const
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 return x_stop_constraint_check;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
670 }
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 int
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
673 NPSOL_options::verify_level (void) const
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 return x_verify_level;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
676 }
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 void
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
679 NPSOL_options::pass_options_to_npsol (void)
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
680 {
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
681 F77_FCN (npoptn) ("Nolist", 6L);
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
682 F77_FCN (npoptn) ("Defaults", 8L);
287
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 if (x_central_difference_interval > 0.0)
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
685 set_option ("Central Difference", x_central_difference_interval);
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 set_option ("Crash Tolerance", x_crash_tolerance);
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
688
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
689 if (x_difference_interval > 0.0)
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
690 set_option ("Difference Interval", x_difference_interval);
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 set_option ("Function Precision", x_function_precision);
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
693
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
694 set_option ("Infinite Bound", x_infinite_bound);
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
695
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
696 set_option ("Infinite Step", x_infinite_step);
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
697
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
698 set_option ("Linear Feasibility", x_linear_feasibility_tolerance);
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
699
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
700 set_option ("Linesearch Tolerance", x_linesearch_tolerance);
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 ("Nonlinear Feasibility", x_nonlinear_feasibility_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 set_option ("Optimality Tolerance", x_optimality_tolerance);
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
705
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
706 set_option ("Derivative Level", x_derivative_level);
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
707
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
708 if (x_major_iteration_limit > 0)
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
709 set_option ("Major Iteration", x_major_iteration_limit);
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 if (x_minor_iteration_limit > 0)
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
712 set_option ("Minor Iteration", x_minor_iteration_limit);
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
713
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
714 set_option ("Major Print", x_major_print_level);
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
715
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
716 set_option ("Minor Print", x_minor_print_level);
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
717
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
718 set_option ("Start Objective", x_start_objective_check);
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
719
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
720 set_option ("Start Constraint", x_start_constraint_check);
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
721
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
722 if (x_stop_objective_check > 0)
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
723 set_option ("Stop Objective", x_stop_objective_check);
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
724
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
725 if (x_stop_constraint_check > 0)
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
726 set_option ("Stop Constraint", x_stop_constraint_check);
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
727
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
728 set_option ("Verify Level", x_verify_level);
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
729 }
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 void
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
732 NPSOL_options::set_option (const char *key, int opt)
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
733 {
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
734 ostrstream buf;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
735 buf << key << " " << opt << ends;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
736 char *command = buf.str ();
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
737 size_t len = strlen (command);
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
738 F77_FCN (npoptn) (command, (long) len);
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
739 delete [] command;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
740 }
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
741
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
742 void
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
743 NPSOL_options::set_option (const char *key, double opt)
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 ostrstream buf;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
746 buf << key << " " << opt << ends;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
747 char *command = buf.str ();
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
748 size_t len = strlen (command);
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
749 F77_FCN (npoptn) (command, (long) len);
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
750 delete [] command;
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
751 }
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
752
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
753 #endif /* NPSOL_MISSING */
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
754
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
755 /*
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
756 ;;; Local Variables: ***
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
757 ;;; mode: C++ ***
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
758 ;;; page-delimiter: "^/\\*" ***
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
759 ;;; End: ***
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
760 */