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 25, 2008 00008 00009 #ifndef INCLUDE_MATLABINFO 00010 #define INCLUDE_MATLABINFO 00011 00012 #include "mex.h" 00013 #include "IpIpoptApplication.hpp" 00014 00015 using Ipopt::ApplicationReturnStatus; 00016 00017 // Class MatlabInfo. 00018 // ----------------------------------------------------------------- 00019 // An object of this class stores all the information we will pass 00020 // back to MATLAB upon termination of IPOPT. 00021 class MatlabInfo { 00022 public: 00023 00024 // Create a new info object and store the information in a MATLAB 00025 // array. The input pointer will point to the the newly created 00026 // MATLAB array. Since the user has an opportunity to modify the 00027 // MATLAB array pointed to by "ptr", we do not destroy the array 00028 // when the MatlabInfo object is destroyed. It is up to the user to 00029 // do that. 00030 explicit MatlabInfo (mxArray*& ptr); 00031 00032 // The destructor. 00033 ~MatlabInfo() { }; 00034 00035 // Access and modify the exit status. 00036 ApplicationReturnStatus getExitStatus () const; 00037 void setExitStatus (ApplicationReturnStatus status); 00038 00039 // Access and modify the Lagrange multipliers. 00040 const double* getmultlb () const; 00041 const double* getmultub () const; 00042 const double* getmultconstr () const; 00043 void setmultlb (int n, const double* zl); 00044 void setmultub (int n, const double* zu); 00045 void setmultconstr (int m, const double* lambda); 00046 00047 protected: 00048 mxArray* ptr; // All the information is stored in a MATLAB array. 00049 }; 00050 00051 #endif