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