Ipopt  3.12.12
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
options.hpp
Go to the documentation of this file.
1 // Copyright (C) 2008 Peter Carbonetto. All Rights Reserved.
2 // This code is published under the Eclipse Public License.
3 //
4 // Author: Peter Carbonetto
5 // Dept. of Computer Science
6 // University of British Columbia
7 // September 25, 2008
8 
9 #ifndef INCLUDE_OPTIONS
10 #define INCLUDE_OPTIONS
11 
12 #include "mex.h"
13 #include "iterate.hpp"
14 #include "ipoptoptions.hpp"
15 
16 // Class Options.
17 // -----------------------------------------------------------------
18 // This class processes the options input from MATLAB.
19 class Options {
20 public:
21 
22  // The constructor expects as input a point to a MATLAB array, in
23  // particular a structure array with the appropriate fields. Note
24  // that the Options object does *not* possess an independent copy of
25  // some of the MATLAB data (such as the auxiliary data).
27  const mxArray* ptr);
28 
29  // The destructor.
30  ~Options();
31 
32  // Get the number of variables and the number of constraints.
33  friend int numvars (const Options& options) { return options.n; };
34  friend int numconstraints (const Options& options) { return options.m; };
35 
36  // Access the lower and upper bounds on the variables and constraints.
37  const double* lowerbounds () const { return lb; };
38  const double* upperbounds () const { return ub; };
39  const double* constraintlb() const { return cl; };
40  const double* constraintub() const { return cu; };
41 
42  // Access the IPOPT options object.
43  const IpoptOptions ipoptOptions() const { return ipopt; };
44 
45  // Access the Lagrange multpliers.
46  const double* multlb () const { return zl; };
47  const double* multub () const { return zu; };
48  const double* multconstr() const { return lambda; };
49 
50 protected:
51  int n; // The number of optimization variables.
52  int m; // The number of constraints.
53  double* lb; // Lower bounds on the variables.
54  double* ub; // Upper bounds on the variables.
55  double* cl; // Lower bounds on constraints.
56  double* cu; // Upper bounds on constraints.
57  double* zl; // Lagrange multipliers for lower bounds.
58  double* zu; // Lagrange multipliers for upper bounds.
59  double* lambda; // Lagrange multipliers for constraints.
60  IpoptOptions ipopt; // The IPOPT options.
61 
62  // These are helper functions used by the class constructor.
63  static double* loadLowerBounds (int n, const mxArray* ptr,
64  double neginfty);
65  static double* loadUpperBounds (int n, const mxArray* ptr,
66  double posinfty);
67  static int loadConstraintBounds (const mxArray* ptr, double*& cl,
68  double*& cu, double neginfty,
69  double posinfty);
70  static void loadMultipliers (int n, int m, const mxArray* ptr,
71  double*& zl, double*& zu,
72  double*& lambda);
73 };
74 
75 #endif
Number * x
Input: Starting point Output: Optimal solution.
double * cl
Definition: options.hpp:55
int m
Definition: options.hpp:52
double * lambda
Definition: options.hpp:59
const double * constraintub() const
Definition: options.hpp:40
double * zu
Definition: options.hpp:58
const double * upperbounds() const
Definition: options.hpp:38
const IpoptOptions ipoptOptions() const
Definition: options.hpp:43
const double * multlb() const
Definition: options.hpp:46
friend int numvars(const Options &options)
Definition: options.hpp:33
const double * multub() const
Definition: options.hpp:47
static void loadMultipliers(int n, int m, const mxArray *ptr, double *&zl, double *&zu, double *&lambda)
static double * loadLowerBounds(int n, const mxArray *ptr, double neginfty)
const double * constraintlb() const
Definition: options.hpp:39
int n
Definition: options.hpp:48
IpoptOptions ipopt
Definition: options.hpp:60
static double * loadUpperBounds(int n, const mxArray *ptr, double posinfty)
double * lb
Definition: options.hpp:53
friend int numconstraints(const Options &options)
Definition: options.hpp:34
const double * lowerbounds() const
Definition: options.hpp:37
This is the main application class for making calls to Ipopt.
double * ub
Definition: options.hpp:54
Options(const Iterate &x, Ipopt::IpoptApplication &app, const mxArray *ptr)
double * cu
Definition: options.hpp:56
const double * multconstr() const
Definition: options.hpp:48
double * zl
Definition: options.hpp:57
static int loadConstraintBounds(const mxArray *ptr, double *&cl, double *&cu, double neginfty, double posinfty)