3
|
1 // NPSOL.h -*- C++ -*- |
|
2 /* |
|
3 |
296
|
4 Copyright (C) 1992, 1993, 1994 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 |
|
20 Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. |
|
21 |
|
22 */ |
|
23 |
382
|
24 #if !defined (octave_NPSOL_h) |
|
25 #define octave_NPSOL_h 1 |
|
26 |
645
|
27 #ifndef NPSOL_MISSING |
|
28 |
461
|
29 #if defined (__GNUG__) |
|
30 #pragma interface |
|
31 #endif |
|
32 |
|
33 #include "dColVector.h" |
3
|
34 #include "NLP.h" |
|
35 |
384
|
36 extern "C++" { |
|
37 |
3
|
38 #ifndef Vector |
|
39 #define Vector ColumnVector |
|
40 #endif |
|
41 |
287
|
42 class NPSOL_options |
3
|
43 { |
|
44 public: |
|
45 |
287
|
46 NPSOL_options (void); |
|
47 NPSOL_options (const NPSOL_options& opt); |
|
48 |
|
49 NPSOL_options& operator = (const NPSOL_options& opt); |
|
50 |
|
51 ~NPSOL_options (void); |
|
52 |
|
53 void init (void); |
|
54 void copy (const NPSOL_options& opt); |
|
55 |
|
56 void set_default_options (void); |
|
57 |
|
58 void set_central_difference_interval (double val); |
|
59 void set_crash_tolerance (double val); |
|
60 void set_difference_interval (double val); |
|
61 void set_function_precision (double val); |
|
62 void set_infinite_bound (double val); |
|
63 void set_infinite_step (double val); |
|
64 void set_linear_feasibility_tolerance (double val); |
|
65 void set_linesearch_tolerance (double val); |
|
66 void set_nonlinear_feasibility_tolerance (double val); |
|
67 void set_optimality_tolerance (double val); |
|
68 |
|
69 void set_derivative_level (int val); |
|
70 void set_major_iteration_limit (int val); |
|
71 void set_minor_iteration_limit (int val); |
|
72 void set_major_print_level (int val); |
|
73 void set_minor_print_level (int val); |
|
74 void set_start_objective_check (int val); |
|
75 void set_start_constraint_check (int val); |
|
76 void set_stop_objective_check (int val); |
|
77 void set_stop_constraint_check (int val); |
|
78 void set_verify_level (int val); |
|
79 |
|
80 double central_difference_interval (void) const; |
|
81 double crash_tolerance (void) const; |
|
82 double difference_interval (void) const; |
|
83 double function_precision (void) const; |
|
84 double infinite_bound (void) const; |
|
85 double infinite_step (void) const; |
|
86 double linear_feasibility_tolerance (void) const; |
|
87 double linesearch_tolerance (void) const; |
|
88 double nonlinear_feasibility_tolerance (void) const; |
|
89 double optimality_tolerance (void) const; |
3
|
90 |
287
|
91 int derivative_level (void) const; |
|
92 int major_iteration_limit (void) const; |
|
93 int minor_iteration_limit (void) const; |
|
94 int major_print_level (void) const; |
|
95 int minor_print_level (void) const; |
|
96 int start_objective_check (void) const; |
|
97 int start_constraint_check (void) const; |
|
98 int stop_objective_check (void) const; |
|
99 int stop_constraint_check (void) const; |
|
100 int verify_level (void) const; |
|
101 |
|
102 protected: |
|
103 |
|
104 void pass_options_to_npsol (void); |
|
105 |
|
106 void set_option (const char *key, int opt); |
|
107 void set_option (const char *key, double opt); |
|
108 |
|
109 private: |
|
110 |
|
111 double x_central_difference_interval; |
|
112 double x_crash_tolerance; |
|
113 double x_difference_interval; |
|
114 double x_function_precision; |
|
115 double x_infinite_bound; |
|
116 double x_infinite_step; |
|
117 double x_linear_feasibility_tolerance; |
|
118 double x_linesearch_tolerance; |
|
119 double x_nonlinear_feasibility_tolerance; |
|
120 double x_optimality_tolerance; |
|
121 int x_derivative_level; |
|
122 int x_major_iteration_limit; |
|
123 int x_minor_iteration_limit; |
|
124 int x_major_print_level; |
|
125 int x_minor_print_level; |
|
126 int x_start_objective_check; |
|
127 int x_start_constraint_check; |
|
128 int x_stop_objective_check; |
|
129 int x_stop_constraint_check; |
|
130 int x_verify_level; |
|
131 }; |
|
132 |
|
133 class NPSOL : public NLP, public NPSOL_options |
|
134 { |
|
135 public: |
|
136 |
|
137 NPSOL (void) : NLP () { } |
|
138 |
|
139 NPSOL (const Vector& x, const Objective& phi) : NLP (x, phi) { } |
3
|
140 |
|
141 NPSOL (const Vector& x, const Objective& phi, |
|
142 const Bounds& b) : NLP (x, phi, b) |
287
|
143 { } |
3
|
144 |
|
145 NPSOL (const Vector& x, const Objective& phi, const Bounds& b, |
|
146 const LinConst& lc) : NLP (x, phi, b, lc) |
287
|
147 { } |
3
|
148 |
|
149 NPSOL (const Vector& x, const Objective& phi, const Bounds& b, |
|
150 const LinConst& lc, const NLConst& nlc) : NLP (x, phi, b, lc, nlc) |
287
|
151 { } |
3
|
152 |
|
153 NPSOL (const Vector& x, const Objective& phi, |
|
154 const LinConst& lc) : NLP (x, phi, lc) |
287
|
155 { } |
3
|
156 |
|
157 NPSOL (const Vector& x, const Objective& phi, const LinConst& lc, |
|
158 const NLConst& nlc) : NLP (x, phi, lc, nlc) |
287
|
159 { } |
3
|
160 |
|
161 NPSOL (const Vector& x, const Objective& phi, |
|
162 const NLConst& nlc) : NLP (x, phi, nlc) |
287
|
163 { } |
3
|
164 |
|
165 NPSOL (const Vector& x, const Objective& phi, const Bounds& b, |
|
166 const NLConst& nlc) : NLP (x, phi, b, nlc) |
287
|
167 { } |
3
|
168 |
|
169 NPSOL (const NPSOL& a); |
|
170 |
|
171 Vector minimize (void); |
|
172 Vector minimize (double& objf); |
|
173 Vector minimize (double& objf, int& inform); |
|
174 Vector minimize (double& objf, int& inform, Vector& lambda); |
|
175 |
|
176 Vector minimize (const Vector& x); |
|
177 Vector minimize (const Vector& x, double& objf); |
|
178 Vector minimize (const Vector& x, double& objf, int& inform); |
|
179 Vector minimize (const Vector& x, double& objf, int& inform, Vector& lambda); |
|
180 |
|
181 NPSOL& option (char *s); |
|
182 |
287
|
183 private: |
3
|
184 }; |
|
185 |
255
|
186 // XXX FIXME XXX -- would be nice to not have to have this global |
|
187 // variable. |
|
188 // Nonzero means an error occurred in the calculation of the objective |
|
189 // function, and the user wants us to quit. |
|
190 extern int npsol_objective_error; |
|
191 |
3
|
192 inline NPSOL::NPSOL (const NPSOL& a) : NLP (a.x, a.phi, a.bnds, a.lc, a.nlc) |
287
|
193 { } |
3
|
194 |
645
|
195 } // extern "C++" |
3
|
196 |
645
|
197 #endif /* NPSOL_MISSING */ |
382
|
198 |
238
|
199 #endif |
3
|
200 |
|
201 /* |
|
202 ;;; Local Variables: *** |
|
203 ;;; mode: C++ *** |
|
204 ;;; page-delimiter: "^/\\*" *** |
|
205 ;;; End: *** |
|
206 */ |