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