3
|
1 // NPSOL.h -*- C++ -*- |
|
2 /* |
|
3 |
1011
|
4 Copyright (C) 1992, 1993, 1994, 1995 John W. Eaton |
3
|
5 |
|
6 This file is part of Octave. |
|
7 |
|
8 Octave is free software; you can redistribute it and/or modify it |
|
9 under the terms of the GNU General Public License as published by the |
|
10 Free Software Foundation; either version 2, or (at your option) any |
|
11 later version. |
|
12 |
|
13 Octave is distributed in the hope that it will be useful, but WITHOUT |
|
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
16 for more details. |
|
17 |
|
18 You should have received a copy of the GNU General Public License |
|
19 along with Octave; see the file COPYING. If not, write to the Free |
1315
|
20 Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
3
|
21 |
|
22 */ |
|
23 |
382
|
24 #if !defined (octave_NPSOL_h) |
|
25 #define octave_NPSOL_h 1 |
|
26 |
1296
|
27 #if defined (__GNUG__) |
|
28 #pragma interface |
|
29 #endif |
|
30 |
645
|
31 #ifndef NPSOL_MISSING |
|
32 |
461
|
33 #include "dColVector.h" |
3
|
34 #include "NLP.h" |
|
35 |
|
36 #ifndef Vector |
|
37 #define Vector ColumnVector |
|
38 #endif |
|
39 |
287
|
40 class NPSOL_options |
3
|
41 { |
|
42 public: |
|
43 |
287
|
44 NPSOL_options (void); |
|
45 NPSOL_options (const NPSOL_options& opt); |
|
46 |
|
47 NPSOL_options& operator = (const NPSOL_options& opt); |
|
48 |
|
49 ~NPSOL_options (void); |
|
50 |
|
51 void init (void); |
|
52 void copy (const NPSOL_options& opt); |
|
53 |
|
54 void set_default_options (void); |
|
55 |
|
56 void set_central_difference_interval (double val); |
|
57 void set_crash_tolerance (double val); |
|
58 void set_difference_interval (double val); |
|
59 void set_function_precision (double val); |
|
60 void set_infinite_bound (double val); |
|
61 void set_infinite_step (double val); |
|
62 void set_linear_feasibility_tolerance (double val); |
|
63 void set_linesearch_tolerance (double val); |
|
64 void set_nonlinear_feasibility_tolerance (double val); |
|
65 void set_optimality_tolerance (double val); |
|
66 |
|
67 void set_derivative_level (int val); |
|
68 void set_major_iteration_limit (int val); |
|
69 void set_minor_iteration_limit (int val); |
|
70 void set_major_print_level (int val); |
|
71 void set_minor_print_level (int val); |
|
72 void set_start_objective_check (int val); |
|
73 void set_start_constraint_check (int val); |
|
74 void set_stop_objective_check (int val); |
|
75 void set_stop_constraint_check (int val); |
|
76 void set_verify_level (int val); |
|
77 |
|
78 double central_difference_interval (void) const; |
|
79 double crash_tolerance (void) const; |
|
80 double difference_interval (void) const; |
|
81 double function_precision (void) const; |
|
82 double infinite_bound (void) const; |
|
83 double infinite_step (void) const; |
|
84 double linear_feasibility_tolerance (void) const; |
|
85 double linesearch_tolerance (void) const; |
|
86 double nonlinear_feasibility_tolerance (void) const; |
|
87 double optimality_tolerance (void) const; |
3
|
88 |
287
|
89 int derivative_level (void) const; |
|
90 int major_iteration_limit (void) const; |
|
91 int minor_iteration_limit (void) const; |
|
92 int major_print_level (void) const; |
|
93 int minor_print_level (void) const; |
|
94 int start_objective_check (void) const; |
|
95 int start_constraint_check (void) const; |
|
96 int stop_objective_check (void) const; |
|
97 int stop_constraint_check (void) const; |
|
98 int verify_level (void) const; |
|
99 |
|
100 protected: |
|
101 |
|
102 void pass_options_to_npsol (void); |
|
103 |
|
104 void set_option (const char *key, int opt); |
|
105 void set_option (const char *key, double opt); |
|
106 |
|
107 private: |
|
108 |
|
109 double x_central_difference_interval; |
|
110 double x_crash_tolerance; |
|
111 double x_difference_interval; |
|
112 double x_function_precision; |
|
113 double x_infinite_bound; |
|
114 double x_infinite_step; |
|
115 double x_linear_feasibility_tolerance; |
|
116 double x_linesearch_tolerance; |
|
117 double x_nonlinear_feasibility_tolerance; |
|
118 double x_optimality_tolerance; |
|
119 int x_derivative_level; |
|
120 int x_major_iteration_limit; |
|
121 int x_minor_iteration_limit; |
|
122 int x_major_print_level; |
|
123 int x_minor_print_level; |
|
124 int x_start_objective_check; |
|
125 int x_start_constraint_check; |
|
126 int x_stop_objective_check; |
|
127 int x_stop_constraint_check; |
|
128 int x_verify_level; |
|
129 }; |
|
130 |
|
131 class NPSOL : public NLP, public NPSOL_options |
|
132 { |
|
133 public: |
|
134 |
|
135 NPSOL (void) : NLP () { } |
|
136 |
|
137 NPSOL (const Vector& x, const Objective& phi) : NLP (x, phi) { } |
3
|
138 |
|
139 NPSOL (const Vector& x, const Objective& phi, |
|
140 const Bounds& b) : NLP (x, phi, b) |
287
|
141 { } |
3
|
142 |
|
143 NPSOL (const Vector& x, const Objective& phi, const Bounds& b, |
|
144 const LinConst& lc) : NLP (x, phi, b, lc) |
287
|
145 { } |
3
|
146 |
|
147 NPSOL (const Vector& x, const Objective& phi, const Bounds& b, |
|
148 const LinConst& lc, const NLConst& nlc) : NLP (x, phi, b, lc, nlc) |
287
|
149 { } |
3
|
150 |
|
151 NPSOL (const Vector& x, const Objective& phi, |
|
152 const LinConst& lc) : NLP (x, phi, lc) |
287
|
153 { } |
3
|
154 |
|
155 NPSOL (const Vector& x, const Objective& phi, const LinConst& lc, |
|
156 const NLConst& nlc) : NLP (x, phi, lc, nlc) |
287
|
157 { } |
3
|
158 |
|
159 NPSOL (const Vector& x, const Objective& phi, |
|
160 const NLConst& nlc) : NLP (x, phi, nlc) |
287
|
161 { } |
3
|
162 |
|
163 NPSOL (const Vector& x, const Objective& phi, const Bounds& b, |
|
164 const NLConst& nlc) : NLP (x, phi, b, nlc) |
287
|
165 { } |
3
|
166 |
|
167 NPSOL (const NPSOL& a); |
|
168 |
|
169 Vector minimize (void); |
|
170 Vector minimize (double& objf); |
|
171 Vector minimize (double& objf, int& inform); |
|
172 Vector minimize (double& objf, int& inform, Vector& lambda); |
|
173 |
|
174 Vector minimize (const Vector& x); |
|
175 Vector minimize (const Vector& x, double& objf); |
|
176 Vector minimize (const Vector& x, double& objf, int& inform); |
|
177 Vector minimize (const Vector& x, double& objf, int& inform, Vector& lambda); |
|
178 |
|
179 NPSOL& option (char *s); |
|
180 |
287
|
181 private: |
3
|
182 }; |
|
183 |
255
|
184 // XXX FIXME XXX -- would be nice to not have to have this global |
|
185 // variable. |
|
186 // Nonzero means an error occurred in the calculation of the objective |
|
187 // function, and the user wants us to quit. |
|
188 extern int npsol_objective_error; |
|
189 |
3
|
190 inline NPSOL::NPSOL (const NPSOL& a) : NLP (a.x, a.phi, a.bnds, a.lc, a.nlc) |
287
|
191 { } |
3
|
192 |
645
|
193 #endif /* NPSOL_MISSING */ |
382
|
194 |
238
|
195 #endif |
3
|
196 |
|
197 /* |
|
198 ;;; Local Variables: *** |
|
199 ;;; mode: C++ *** |
|
200 ;;; page-delimiter: "^/\\*" *** |
|
201 ;;; End: *** |
|
202 */ |