|
ConstrainedOptPack: C++ Tools for Constrained (and Unconstrained) Optimization Version of the Day
|
00001 // @HEADER 00002 // *********************************************************************** 00003 // 00004 // Moocho: Multi-functional Object-Oriented arCHitecture for Optimization 00005 // Copyright (2003) Sandia Corporation 00006 // 00007 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive 00008 // license for use of this work by or on behalf of the U.S. Government. 00009 // 00010 // This library is free software; you can redistribute it and/or modify 00011 // it under the terms of the GNU Lesser General Public License as 00012 // published by the Free Software Foundation; either version 2.1 of the 00013 // License, or (at your option) any later version. 00014 // 00015 // This library is distributed in the hope that it will be useful, but 00016 // WITHOUT ANY WARRANTY; without even the implied warranty of 00017 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00018 // Lesser General Public License for more details. 00019 // 00020 // You should have received a copy of the GNU Lesser General Public 00021 // License along with this library; if not, write to the Free Software 00022 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 00023 // USA 00024 // Questions? Contact Roscoe A. Bartlett (rabartl@sandia.gov) 00025 // 00026 // *********************************************************************** 00027 // @HEADER 00028 // 00029 // C declarations for QPSOL functions. These declarations should not have to change 00030 // for different platforms. As long as the fortran object code uses capitalized 00031 // names for its identifers then the declarations in Teuchos_F77_wrappers.h should be 00032 // sufficent for portability. 00033 00034 #ifndef QPOPT_CPP_DECL_H 00035 #define QPOPT_CPP_DECL_H 00036 00037 #include "Teuchos_F77_wrappers.h" 00038 00039 namespace QPOPT_CppDecl { 00040 00041 // Declarations that will link to the fortran object file. 00042 // These may change for different platforms 00043 00044 using FortranTypes::f_int; // INTEGER 00045 using FortranTypes::f_real; // REAL 00046 using FortranTypes::f_dbl_prec; // DOUBLE PRECISION 00047 using FortranTypes::f_logical; // LOGICAL 00048 00049 // ///////////////////////////////////////////////////////////////////////// 00054 00055 typedef FORTRAN_FUNC_PTR_DECL_UL_(void,QPHESS_FUNC,qphess_func) ( const f_int& N, const f_int& LDH 00056 , const f_int& JTHCOL, const f_dbl_prec* HESS, const f_dbl_prec* X, f_dbl_prec* HX 00057 , f_int* IW, const f_int& LENIW, f_dbl_prec* W, const f_int& LENW ); 00058 00060 void qpopt( 00061 const f_int& N, const f_int& NCLIN 00062 ,const f_int& LDA, const f_int& LDH, const f_dbl_prec* A 00063 ,const f_dbl_prec* BL, const f_dbl_prec* BU, const f_dbl_prec* CVEC 00064 ,const f_dbl_prec* H, FORTRAN_NAME_UL_(QPHESS_FUNC,qphess_func) QPHESS, f_int* ISTATE, f_dbl_prec* X 00065 ,f_int& INFORM, f_int& ITER, f_dbl_prec& OBJ, f_dbl_prec* AX 00066 ,f_dbl_prec* CLAMDA, f_int* IW, const f_int& LENIW, f_dbl_prec* W 00067 ,const f_int& LENW 00068 ); 00069 00070 // ////////////////////////////////////////////////////////// 00071 // Enumerations for QPOPT options 00072 00074 enum EQPOPT_problem_type { 00075 FP = 1, 00076 LP = 2, 00077 QP1 = 3, 00078 QP2 = 4, 00079 QP3 = 5, 00080 QP4 = 6 00081 }; 00082 00084 enum EQPOPT_int_option { 00085 CHECK_FREQUENCY = 1, 00086 EXPAND_FREQUENCY = 2, 00087 FEASIBILITY_PHASE_ITER_LIMIT = 3, 00088 OPTIMALITY_PHASE_ITER_LIMIT = 4, 00089 HESSIAN_ROWS = 5, 00090 ITERATION_LIMIT = 6, 00091 MAXIMUM_DEGREES_OF_FREEDOM = 7, 00092 PRINT_FILE = 8, 00093 PRINT_LEVEL = 9, 00094 PROBLEM_TYPE = 10, // Use EQPOPT_problem_type 00095 SUMMARY_FILE = 11 00096 }; 00097 00098 00100 enum EQPOPT_logical_option { 00101 WARM_START = 1, 00102 LIST = 2, 00103 MIN_SUM = 3 00104 }; 00105 00107 enum EQPOPT_real_option { 00108 CRASH_TOLERANCE = 1, 00109 FEASIBILITY_TOLERANCE = 2, 00110 INFINITE_BOUND_SIZE = 3, 00111 INFINITE_STEP_SIZE = 4, 00112 OPTIMALITY_TOLERANCE = 5, 00113 RANK_TOLERANCE = 6 00114 }; 00115 00116 // /////////////////////////////////////////////////////////// 00117 // C++ functions for setting QPOPT options. 00118 00120 void reset_defaults(); 00121 00123 void set_int_option(EQPOPT_int_option option, const f_int&); 00124 00126 void set_logical_option(EQPOPT_logical_option option, const f_logical&); 00127 00129 void set_real_option(EQPOPT_real_option option, const f_dbl_prec&); 00130 00131 // //////////////////////////////////////////////////// 00132 // Declarations to link with Fortran QPSOL procedures 00133 00134 extern "C" { 00135 00136 FORTRAN_FUNC_DECL_UL(void,QPOPT,qpopt) ( const f_int& N, const f_int& NCLIN 00137 , const f_int& LDA, const f_int& LDH, const f_dbl_prec* A 00138 , const f_dbl_prec* BL, const f_dbl_prec* BU, const f_dbl_prec* CVEC 00139 , const f_dbl_prec* H, FORTRAN_NAME_UL_(QPHESS_FUNC,qphess_func) QPHESS, f_int* ISTATE, f_dbl_prec* X 00140 , f_int& INFORM, f_int& ITER, f_dbl_prec& OBJ, f_dbl_prec* AX 00141 , f_dbl_prec* CLAMDA, f_int* IW, const f_int& LENIW, f_dbl_prec* W 00142 , const f_int& LENW ); 00143 00144 FORTRAN_FUNC_DECL_UL(void,QPHESS,qphess) ( const f_int& N, const f_int& LDH 00145 , const f_int& JTHCOL, const f_dbl_prec* H, const f_dbl_prec* X, f_dbl_prec* HX 00146 , f_int* IW, const f_int& LENIW, f_dbl_prec* W, const f_int& LENW ); 00147 00148 FORTRAN_FUNC_DECL_UL_(void,QPOPT_SET_DEFAULTS,qpopt_set_defaults) (); 00149 00150 FORTRAN_FUNC_DECL_UL_(void,QPOPT_INT_OPT,qpopt_int_opt) (const f_int& option, const f_int& ); 00151 00152 FORTRAN_FUNC_DECL_UL_(void,QPOPT_LOG_OPT,qpopt_log_opt) (const f_int& option, const f_logical& ); 00153 00154 FORTRAN_FUNC_DECL_UL_(void,QPOPT_REAL_OPT,qpopt_real_opt) (const f_int& option, const f_dbl_prec& ); 00155 00156 } // end extern "C" 00157 00158 // /////////////////////////////////////////////////////////////////////////////// 00159 // Inline definitions. 00160 00161 inline 00162 void qpopt( const f_int& N, const f_int& NCLIN 00163 , const f_int& LDA, const f_int& LDH, const f_dbl_prec* A 00164 , const f_dbl_prec* BL, const f_dbl_prec* BU, const f_dbl_prec* CVEC 00165 , const f_dbl_prec* H, FORTRAN_NAME_UL_(QPHESS_FUNC,qphess_func) QPHESS, f_int* ISTATE, f_dbl_prec* X 00166 , f_int& INFORM, f_int& ITER, f_dbl_prec& OBJ, f_dbl_prec* AX 00167 , f_dbl_prec* CLAMDA, f_int* IW, const f_int& LENIW, f_dbl_prec* W 00168 , const f_int& LENW ) 00169 { 00170 FORTRAN_FUNC_CALL_UL(QPOPT,qpopt) ( N, NCLIN, LDA, LDH, A, BL, BU, CVEC, H, QPHESS 00171 , ISTATE, X, INFORM, ITER, OBJ, AX, CLAMDA, IW, LENIW, W, LENW ); 00172 } 00173 00174 inline 00175 void reset_defaults() 00176 { FORTRAN_FUNC_CALL_UL_(QPOPT_SET_DEFAULTS,qpopt_set_defaults) (); } 00177 00178 inline 00179 void set_int_option(EQPOPT_int_option option, const f_int& val) 00180 { FORTRAN_FUNC_CALL_UL_(QPOPT_INT_OPT,qpopt_int_opt) ( option, val ); } 00181 00182 inline 00183 void set_logical_option(EQPOPT_logical_option option, const f_logical& val) 00184 { FORTRAN_FUNC_CALL_UL_(QPOPT_LOG_OPT,qpopt_log_opt) ( option, val ); } 00185 00186 inline 00187 void set_real_option(EQPOPT_real_option option, const f_dbl_prec& val) 00188 { FORTRAN_FUNC_CALL_UL_(QPOPT_REAL_OPT,qpopt_real_opt) ( option, val ); } 00189 00191 00192 } // end namespace QPOPT_CppDecl 00193 00194 #endif // QPOPT_CPP_DECL_H
1.7.4