annotate liboctave/NPSOL.cc @ 1251:97eac19837dc

[project @ 1995-04-11 15:58:32 by jwe]
author jwe
date Tue, 11 Apr 1995 15:58:32 +0000
parents b6360f2d4fa6
children bb67a902760b
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 {
1251
97eac19837dc [project @ 1995-04-11 15:58:32 by jwe]
jwe
parents: 1192
diff changeset
43 int F77_FCN (npoptn) (const char*, long);
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
44
1251
97eac19837dc [project @ 1995-04-11 15:58:32 by jwe]
jwe
parents: 1192
diff changeset
45 int F77_FCN (npsol) (int&, int&, int&, int&, int&, int&, double*,
97eac19837dc [project @ 1995-04-11 15:58:32 by jwe]
jwe
parents: 1192
diff changeset
46 double*, double*,
97eac19837dc [project @ 1995-04-11 15:58:32 by jwe]
jwe
parents: 1192
diff changeset
47 int (*)(int&, const int&, const int&, const
97eac19837dc [project @ 1995-04-11 15:58:32 by jwe]
jwe
parents: 1192
diff changeset
48 int&, int*, double*, double*, double*,
97eac19837dc [project @ 1995-04-11 15:58:32 by jwe]
jwe
parents: 1192
diff changeset
49 int*),
97eac19837dc [project @ 1995-04-11 15:58:32 by jwe]
jwe
parents: 1192
diff changeset
50 int (*)(int&, const int&, double*, double*,
97eac19837dc [project @ 1995-04-11 15:58:32 by jwe]
jwe
parents: 1192
diff changeset
51 double*, int*),
97eac19837dc [project @ 1995-04-11 15:58:32 by jwe]
jwe
parents: 1192
diff changeset
52 int&, int&, int*, double*, double*, double*,
97eac19837dc [project @ 1995-04-11 15:58:32 by jwe]
jwe
parents: 1192
diff changeset
53 double&, double*, double*, double*, int*, int&,
97eac19837dc [project @ 1995-04-11 15:58:32 by jwe]
jwe
parents: 1192
diff changeset
54 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)
287
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
291 F77_FCN (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)
287
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
293 F77_FCN (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)
287
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
295 F77_FCN (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)
287
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
297 F77_FCN (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
1251
97eac19837dc [project @ 1995-04-11 15:58:32 by jwe]
jwe
parents: 1192
diff changeset
303 F77_FCN (npsol) (n, nclin, ncnln, nrowa, nrowj, nrowr, pclin,
97eac19837dc [project @ 1995-04-11 15:58:32 by jwe]
jwe
parents: 1192
diff changeset
304 clow, cup, npsol_confun, npsol_objfun, inform,
97eac19837dc [project @ 1995-04-11 15:58:32 by jwe]
jwe
parents: 1192
diff changeset
305 iter, istate, c, cjac, pclambda, objf, objgrd, r,
97eac19837dc [project @ 1995-04-11 15:58:32 by jwe]
jwe
parents: 1192
diff changeset
306 px, iw, leniw, w, lenw);
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
307
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
308 if (inform == 6 || inform == 1)
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
309 continue;
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
310 else
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
311 break;
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
312 }
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
313
656
d285f62d8638 [project @ 1994-08-29 04:32:55 by jwe]
jwe
parents: 533
diff changeset
314 // Clean up.
d285f62d8638 [project @ 1994-08-29 04:32:55 by jwe]
jwe
parents: 533
diff changeset
315
d285f62d8638 [project @ 1994-08-29 04:32:55 by jwe]
jwe
parents: 533
diff changeset
316 delete [] istate;
d285f62d8638 [project @ 1994-08-29 04:32:55 by jwe]
jwe
parents: 533
diff changeset
317 delete [] clow;
d285f62d8638 [project @ 1994-08-29 04:32:55 by jwe]
jwe
parents: 533
diff changeset
318 delete [] cup;
d285f62d8638 [project @ 1994-08-29 04:32:55 by jwe]
jwe
parents: 533
diff changeset
319 delete [] c;
658
ce51ae1bc05e [project @ 1994-08-29 04:46:51 by jwe]
jwe
parents: 656
diff changeset
320 delete [] cjac;
656
d285f62d8638 [project @ 1994-08-29 04:32:55 by jwe]
jwe
parents: 533
diff changeset
321 delete [] objgrd;
d285f62d8638 [project @ 1994-08-29 04:32:55 by jwe]
jwe
parents: 533
diff changeset
322 delete [] r;
d285f62d8638 [project @ 1994-08-29 04:32:55 by jwe]
jwe
parents: 533
diff changeset
323 delete [] iw;
d285f62d8638 [project @ 1994-08-29 04:32:55 by jwe]
jwe
parents: 533
diff changeset
324 delete [] w;
d285f62d8638 [project @ 1994-08-29 04:32:55 by jwe]
jwe
parents: 533
diff changeset
325
d285f62d8638 [project @ 1994-08-29 04:32:55 by jwe]
jwe
parents: 533
diff changeset
326 // See how it went.
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
327
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
328 return x;
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)
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 ();
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)
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);
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 Vector
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
346 NPSOL::minimize (const Vector& xnew, double& objf, int& inform)
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
347 {
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
348 x = xnew;
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
349 return minimize (objf, inform);
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
350 }
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 Vector
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
353 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
354 {
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
355 x = xnew;
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
356 return minimize (objf, inform, lambda);
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
357 }
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 NPSOL&
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
360 NPSOL::option (char *s)
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
361 {
287
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
362 cerr << "This function no longer has any effect.\n"
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
363 << "Use the NPSOL_option class instead\n";
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
364
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
365 return *this;
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
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
368 NPSOL_options::NPSOL_options (void)
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
369 {
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
370 init ();
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
371 }
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 NPSOL_options::NPSOL_options (const NPSOL_options& opt)
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 copy (opt);
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
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
378 NPSOL_options&
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
379 NPSOL_options::operator = (const NPSOL_options& opt)
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
380 {
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
381 if (this != &opt)
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
382 copy (opt);
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
383
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
384 return *this;
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
385 }
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
386
287
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
387 NPSOL_options::~NPSOL_options (void)
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
388 {
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 void
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
392 NPSOL_options::init (void)
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
393 {
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
394 x_central_difference_interval = -1.0;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
395 x_crash_tolerance = 0.1;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
396 x_difference_interval = -1.0;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
397 x_function_precision = pow (DBL_EPSILON, 0.9);
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
398 x_infinite_bound = 1.0e+30;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
399 x_infinite_step = 1.0e+30;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
400 x_linear_feasibility_tolerance = sqrt (DBL_EPSILON);
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
401 x_linesearch_tolerance = 0.9;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
402 x_nonlinear_feasibility_tolerance = sqrt (DBL_EPSILON);
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
403 x_optimality_tolerance = pow (DBL_EPSILON, 0.8);
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
404 x_derivative_level = 0;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
405 x_major_iteration_limit = -1;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
406 x_minor_iteration_limit = -1;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
407 x_major_print_level = 0;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
408 x_minor_print_level = 0;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
409 x_start_objective_check = 1;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
410 x_start_constraint_check = 1;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
411 x_stop_objective_check = -1;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
412 x_stop_constraint_check = -1;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
413 x_verify_level = 0;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
414 }
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 void
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
417 NPSOL_options::copy (const NPSOL_options& opt)
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
418 {
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
419 x_central_difference_interval = opt.x_central_difference_interval;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
420 x_crash_tolerance = opt.x_crash_tolerance;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
421 x_difference_interval = opt.x_difference_interval;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
422 x_function_precision = opt.x_function_precision;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
423 x_infinite_bound = opt.x_infinite_bound;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
424 x_infinite_step = opt.x_infinite_step;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
425 x_linear_feasibility_tolerance = opt.x_linear_feasibility_tolerance;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
426 x_linesearch_tolerance = opt.x_linesearch_tolerance;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
427 x_nonlinear_feasibility_tolerance = opt.x_nonlinear_feasibility_tolerance;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
428 x_optimality_tolerance = opt.x_optimality_tolerance;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
429 x_derivative_level = opt.x_derivative_level;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
430 x_major_iteration_limit = opt.x_major_iteration_limit;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
431 x_minor_iteration_limit = opt.x_minor_iteration_limit;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
432 x_major_print_level = opt.x_major_print_level;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
433 x_minor_print_level = opt.x_minor_print_level;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
434 x_start_objective_check = opt.x_start_objective_check;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
435 x_start_constraint_check = opt.x_start_constraint_check;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
436 x_stop_objective_check = opt.x_stop_objective_check;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
437 x_stop_constraint_check = opt.x_stop_constraint_check;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
438 x_verify_level = opt.x_verify_level;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
439 }
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 void
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
442 NPSOL_options::set_default_options (void)
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 init ();
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
445 }
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 * 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
449 * setting the default option.
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
450 */
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 void
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
453 NPSOL_options::set_central_difference_interval (double val)
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 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
456 }
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 void
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
459 NPSOL_options::set_crash_tolerance (double val)
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 x_crash_tolerance = (val >= 0.0) ? val : 0.1;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
462 }
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 void
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
465 NPSOL_options::set_difference_interval (double val)
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 x_difference_interval = (val > 0.0) ? val : -1.0;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
468 }
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 void
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
471 NPSOL_options::set_function_precision (double val)
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 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
474 }
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 void
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
477 NPSOL_options::set_infinite_bound (double val)
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 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
480 }
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 void
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
483 NPSOL_options::set_infinite_step (double val)
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 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
486 }
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 void
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
489 NPSOL_options::set_linear_feasibility_tolerance (double val)
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 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
492 }
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 void
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
495 NPSOL_options::set_linesearch_tolerance (double val)
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 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
498 }
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 void
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
501 NPSOL_options::set_nonlinear_feasibility_tolerance (double val)
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 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
504 }
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 void
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
507 NPSOL_options::set_optimality_tolerance (double val)
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 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
510 }
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 void
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
513 NPSOL_options::set_derivative_level (int val)
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 x_derivative_level = (val >= 0 && val < 4) ? val : 0;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
516 }
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 void
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
519 NPSOL_options::set_major_iteration_limit (int val)
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 x_major_iteration_limit = (val > 0) ? val : -1;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
522 }
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 void
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
525 NPSOL_options::set_minor_iteration_limit (int val)
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 x_minor_iteration_limit = (val > 0) ? val : -1;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
528 }
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 void
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
531 NPSOL_options::set_major_print_level (int val)
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 x_major_print_level = (val >= 0) ? val : -1;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
534 }
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 void
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
537 NPSOL_options::set_minor_print_level (int val)
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 x_minor_print_level = (val >= 0) ? val : -1;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
540 }
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 void
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
543 NPSOL_options::set_start_objective_check (int val)
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 x_start_objective_check = (val >= 0) ? val : -1;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
546 }
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 void
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
549 NPSOL_options::set_start_constraint_check (int val)
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 x_start_constraint_check = (val >= 0) ? val : -1;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
552 }
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 void
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
555 NPSOL_options::set_stop_objective_check (int val)
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 x_stop_objective_check = (val >= 0) ? val : -1;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
558 }
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
559
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
560 void
287
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
561 NPSOL_options::set_stop_constraint_check (int val)
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 x_stop_constraint_check = (val >= 0) ? val : -1;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
564 }
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 void
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
567 NPSOL_options::set_verify_level (int val)
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 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
570 }
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 double
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
573 NPSOL_options::central_difference_interval (void) const
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 return x_central_difference_interval;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
576 }
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 double
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
579 NPSOL_options::crash_tolerance (void) const
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 return x_crash_tolerance;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
582 }
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 double
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
585 NPSOL_options::difference_interval (void) const
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 return x_difference_interval;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
588 }
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 double
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
591 NPSOL_options::function_precision (void) const
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 return x_function_precision;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
594 }
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 double
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
597 NPSOL_options::infinite_bound (void) const
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 return x_infinite_bound;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
600 }
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 double
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
603 NPSOL_options::infinite_step (void) const
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 return x_infinite_step;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
606 }
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 double
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
609 NPSOL_options::linear_feasibility_tolerance (void) const
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 return x_linear_feasibility_tolerance;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
612 }
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 double
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
615 NPSOL_options::linesearch_tolerance (void) const
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 return x_linesearch_tolerance;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
618 }
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 double
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
621 NPSOL_options::nonlinear_feasibility_tolerance (void) const
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 return x_nonlinear_feasibility_tolerance;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
624 }
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 double
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
627 NPSOL_options::optimality_tolerance (void) const
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 return x_optimality_tolerance;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
630 }
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 int
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
633 NPSOL_options::derivative_level (void) const
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 return x_derivative_level;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
636 }
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 int
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
639 NPSOL_options::major_iteration_limit (void) const
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 return x_major_iteration_limit;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
642 }
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 int
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
645 NPSOL_options::minor_iteration_limit (void) const
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 return x_minor_iteration_limit;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
648 }
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 int
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
651 NPSOL_options::major_print_level (void) const
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 return x_major_print_level;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
654 }
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 int
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
657 NPSOL_options::minor_print_level (void) const
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 return x_minor_print_level;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
660 }
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 int
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
663 NPSOL_options::start_objective_check (void) const
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 return x_start_objective_check;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
666 }
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 int
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
669 NPSOL_options::start_constraint_check (void) const
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 return x_start_constraint_check;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
672 }
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 int
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
675 NPSOL_options::stop_objective_check (void) const
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 return x_stop_objective_check;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
678 }
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 int
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
681 NPSOL_options::stop_constraint_check (void) const
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
682 {
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
683 return x_stop_constraint_check;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
684 }
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 int
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
687 NPSOL_options::verify_level (void) const
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 return x_verify_level;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
690 }
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 void
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
693 NPSOL_options::pass_options_to_npsol (void)
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
694 {
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
695 F77_FCN (npoptn) ("Nolist", 6L);
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
696 F77_FCN (npoptn) ("Defaults", 8L);
287
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 if (x_central_difference_interval > 0.0)
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
699 set_option ("Central Difference", x_central_difference_interval);
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
700
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
701 set_option ("Crash Tolerance", x_crash_tolerance);
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
702
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
703 if (x_difference_interval > 0.0)
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
704 set_option ("Difference Interval", x_difference_interval);
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 ("Function Precision", x_function_precision);
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 set_option ("Infinite Bound", x_infinite_bound);
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
709
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
710 set_option ("Infinite Step", x_infinite_step);
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
711
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
712 set_option ("Linear Feasibility", x_linear_feasibility_tolerance);
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 ("Linesearch Tolerance", x_linesearch_tolerance);
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 ("Nonlinear Feasibility", x_nonlinear_feasibility_tolerance);
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 ("Optimality Tolerance", x_optimality_tolerance);
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 ("Derivative Level", x_derivative_level);
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_major_iteration_limit > 0)
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
723 set_option ("Major Iteration", x_major_iteration_limit);
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_minor_iteration_limit > 0)
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
726 set_option ("Minor Iteration", x_minor_iteration_limit);
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 ("Major Print", x_major_print_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 set_option ("Minor Print", x_minor_print_level);
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
731
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
732 set_option ("Start Objective", x_start_objective_check);
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 set_option ("Start Constraint", x_start_constraint_check);
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
735
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
736 if (x_stop_objective_check > 0)
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
737 set_option ("Stop Objective", x_stop_objective_check);
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
738
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
739 if (x_stop_constraint_check > 0)
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
740 set_option ("Stop Constraint", x_stop_constraint_check);
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 set_option ("Verify Level", x_verify_level);
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
743 }
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 void
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
746 NPSOL_options::set_option (const char *key, int opt)
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
747 {
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
748 ostrstream buf;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
749 buf << key << " " << opt << ends;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
750 char *command = buf.str ();
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
751 size_t len = strlen (command);
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
752 F77_FCN (npoptn) (command, (long) len);
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
753 delete [] command;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
754 }
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 void
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
757 NPSOL_options::set_option (const char *key, double opt)
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
758 {
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
759 ostrstream buf;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
760 buf << key << " " << opt << ends;
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
761 char *command = buf.str ();
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
762 size_t len = strlen (command);
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
763 F77_FCN (npoptn) (command, (long) len);
6027a905fc06 [project @ 1994-01-13 01:41:00 by jwe]
jwe
parents: 255
diff changeset
764 delete [] command;
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
765 }
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 #endif /* NPSOL_MISSING */
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
768
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 ;;; Local Variables: ***
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
771 ;;; mode: C++ ***
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
772 ;;; page-delimiter: "^/\\*" ***
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
773 ;;; End: ***
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
774 */