00001 // Copyright (C) 2008 Peter Carbonetto. All Rights Reserved. 00002 // This code is published under the Common Public License. 00003 // 00004 // Author: Peter Carbonetto 00005 // Dept. of Computer Science 00006 // University of British Columbia 00007 // September 15, 2008 00008 00009 #ifndef INCLUDE_IPOPTOPTIONS 00010 #define INCLUDE_IPOPTOPTIONS 00011 00012 #include "mex.h" 00013 #include "IpIpoptApplication.hpp" 00014 00015 // Class IpoptOptions. 00016 // ----------------------------------------------------------------- 00017 // This class processes the IPOPT options as specified by a user in the 00018 // MATLAB environment. 00019 class IpoptOptions { 00020 public: 00021 00022 // The constructor accepts as input an IPOPT application object and 00023 // a MATLAB array. The latter input must be a structure array, with 00024 // field names corresponding to the names of options in IPOPT. 00025 IpoptOptions (Ipopt::IpoptApplication& app, const mxArray* ptr); 00026 00027 // The destructor. 00028 ~IpoptOptions() { }; 00029 00030 // The first function returns true if and only if the user has 00031 // specified a quasi-Newton approximation to the Hessian instead of 00032 // the exact Hessian. The second function returns true if and only 00033 // if the user has activated the derivative checker. The third 00034 // function returns true if and only if a user-specified scaling of 00035 // the problem is activated. The fourth function returns the print 00036 // level for the IPOPT console. The remaining two functions return 00037 // the floating-point value for positive and negative infinity, 00038 // respectively. 00039 bool useQuasiNewton () const; 00040 bool useDerivChecker() const; 00041 bool userScaling () const; 00042 int printLevel () const; 00043 double getPosInfty () const; 00044 double getNegInfty () const; 00045 00046 protected: 00047 Ipopt::IpoptApplication& app; // The IPOPT application object. 00048 00049 // These three functions are used by the class constructor. 00050 void setOption (const char* label, const mxArray* ptr); 00051 void setStringOption (const char* label, const mxArray* ptr); 00052 void setIntegerOption (const char* label, const mxArray* ptr); 00053 void setNumberOption (const char* label, const mxArray* ptr); 00054 }; 00055 00056 #endif