Ipopt  3.12.9
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
IpStdCInterface.h
Go to the documentation of this file.
1 /*************************************************************************
2  Copyright (C) 2004, 2010 International Business Machines and others.
3  All Rights Reserved.
4  This code is published under the Eclipse Public License.
5 
6  $Id: IpStdCInterface.h 2082 2012-02-16 03:00:34Z andreasw $
7 
8  Authors: Carl Laird, Andreas Waechter IBM 2004-09-02
9  *************************************************************************/
10 
11 #ifndef __IPSTDCINTERFACE_H__
12 #define __IPSTDCINTERFACE_H__
13 
14 #ifndef IPOPT_EXPORT
15 #ifdef _MSC_VER
16 #ifdef IPOPT_DLL
17 #define IPOPT_EXPORT(type) __declspec(dllexport) type __cdecl
18 #else
19 #define IPOPT_EXPORT(type) type __cdecl
20 #endif
21 #else
22 #define IPOPT_EXPORT(type) type
23 #endif
24 #endif
25 
26 #ifdef __cplusplus
27 extern "C"
28 {
29 #endif
30 
33  typedef double Number;
34 
37  typedef int Index;
38 
41  typedef int Int;
42 
43  /* This includes the SolverReturn enum type */
44 #include "IpReturnCodes.h"
45 
49  struct IpoptProblemInfo;
50 
52  typedef struct IpoptProblemInfo* IpoptProblem;
53 
55  typedef int Bool;
56 #ifndef TRUE
57 # define TRUE (1)
58 #endif
59 #ifndef FALSE
60 # define FALSE (0)
61 #endif
62 
65  typedef void * UserDataPtr;
66 
70  typedef Bool (*Eval_F_CB)(Index n, Number* x, Bool new_x,
71  Number* obj_value, UserDataPtr user_data);
72 
76  typedef Bool (*Eval_Grad_F_CB)(Index n, Number* x, Bool new_x,
77  Number* grad_f, UserDataPtr user_data);
78 
82  typedef Bool (*Eval_G_CB)(Index n, Number* x, Bool new_x,
83  Index m, Number* g, UserDataPtr user_data);
84 
88  typedef Bool (*Eval_Jac_G_CB)(Index n, Number *x, Bool new_x,
89  Index m, Index nele_jac,
90  Index *iRow, Index *jCol, Number *values,
91  UserDataPtr user_data);
92 
96  typedef Bool (*Eval_H_CB)(Index n, Number *x, Bool new_x, Number obj_factor,
97  Index m, Number *lambda, Bool new_lambda,
98  Index nele_hess, Index *iRow, Index *jCol,
99  Number *values, UserDataPtr user_data);
100 
108  typedef Bool (*Intermediate_CB)(Index alg_mod, /* 0 is regular, 1 is resto */
109  Index iter_count, Number obj_value,
110  Number inf_pr, Number inf_du,
111  Number mu, Number d_norm,
112  Number regularization_size,
113  Number alpha_du, Number alpha_pr,
114  Index ls_trials, UserDataPtr user_data);
115 
127  IPOPT_EXPORT(IpoptProblem) CreateIpoptProblem(
128  Index n
129  , Number* x_L
137  , Number* x_U
145  , Index m
146  , Number* g_L
154  , Number* g_U
162  , Index nele_jac
164  , Index nele_hess
166  , Index index_style
168  , Eval_F_CB eval_f
170  , Eval_G_CB eval_g
178  , Eval_H_CB eval_h
180  );
181 
184  IPOPT_EXPORT(void) FreeIpoptProblem(IpoptProblem ipopt_problem);
185 
186 
189  IPOPT_EXPORT(Bool) AddIpoptStrOption(IpoptProblem ipopt_problem, char* keyword, char* val);
190 
193  IPOPT_EXPORT(Bool) AddIpoptNumOption(IpoptProblem ipopt_problem, char* keyword, Number val);
194 
197  IPOPT_EXPORT(Bool) AddIpoptIntOption(IpoptProblem ipopt_problem, char* keyword, Int val);
198 
202  IPOPT_EXPORT(Bool) OpenIpoptOutputFile(IpoptProblem ipopt_problem, char* file_name,
203  Int print_level);
204 
209  IPOPT_EXPORT(Bool) SetIpoptProblemScaling(IpoptProblem ipopt_problem,
210  Number obj_scaling,
211  Number* x_scaling,
212  Number* g_scaling);
213 
223  IPOPT_EXPORT(Bool) SetIntermediateCallback(IpoptProblem ipopt_problem,
225 
231  IPOPT_EXPORT(enum ApplicationReturnStatus) IpoptSolve(
232  IpoptProblem ipopt_problem
236  , Number* x
238  , Number* g
240  , Number* obj_val
242  , Number* mult_g
247  , Number* mult_x_L
252  , Number* mult_x_U
257  , UserDataPtr user_data
261  );
262 
267 #ifdef __cplusplus
268 } /* extern "C" { */
269 #endif
270 
271 #endif
Bool(* Intermediate_CB)(Index alg_mod, Index iter_count, Number obj_value, Number inf_pr, Number inf_du, Number mu, Number d_norm, Number regularization_size, Number alpha_du, Number alpha_pr, Index ls_trials, UserDataPtr user_data)
Type defining the callback function for giving intermediate execution control to the user...
Bool(* Eval_Grad_F_CB)(Index n, Number *x, Bool new_x, Number *grad_f, UserDataPtr user_data)
Type defining the callback function for evaluating the gradient of the objective function.
Bool(* Eval_F_CB)(Index n, Number *x, Bool new_x, Number *obj_value, UserDataPtr user_data)
Type defining the callback function for evaluating the value of the objective function.
Number * x
Input: Starting point Output: Optimal solution.
int Index
Type for all incides.
char Int print_level
Number Number Index Number Number Index Index Index index_style
indexing style for iRow & jCol, 0 for C style, 1 for Fortran style
Number Number Index m
Number of constraints.
int Int
Type for all integers.
Number Number * g
Values of constraint at final point (output only - ignored if set to NULL)
Number Number Index Number Number Index Index Index Eval_F_CB Eval_G_CB Eval_Grad_F_CB Eval_Jac_G_CB Eval_H_CB eval_h
Callback function for evaluating Hessian of Lagrangian function.
int Bool
define a boolean type for C
struct IpoptProblemInfo * IpoptProblem
Pointer to a Ipopt Problem.
Number Number Index Number Number Index Index Index Eval_F_CB Eval_G_CB Eval_Grad_F_CB eval_grad_f
Callback function for evaluating gradient of objective function.
Number Number Number * obj_val
Final value of objective function (output only - ignored if set to NULL)
Number Number Index Number Number * g_U
Upper bounds on constraints.
char char * val
char * keyword
Number Number Index Number Number Index Index Index Eval_F_CB Eval_G_CB Eval_Grad_F_CB Eval_Jac_G_CB eval_jac_g
Callback function for evaluating Jacobian of constraint functions.
Number Number Index Number Number Index nele_jac
Number of non-zero elements in constraint Jacobian.
Number Number Number Number Number Number * mult_x_U
Input: Initial values for the multipliers for upper variable bounds (only if warm start option is cho...
Number Number Index Number Number Index Index Index Eval_F_CB Eval_G_CB eval_g
Callback function for evaluating constraint functions.
Number * x_L
Lower bounds on variables.
Number Number Index Number * g_L
Lower bounds on constraints.
Number Number Number Number * mult_g
Input: Initial values for the constraint multipliers (only if warm start option is chosen) Output: Fi...
Number Number * x_U
Upper bounds on variables.
Number Number Number Number Number * mult_x_L
Input: Initial values for the multipliers for lower variable bounds (only if warm start option is cho...
Number Number * x_scaling
Bool(* Eval_Jac_G_CB)(Index n, Number *x, Bool new_x, Index m, Index nele_jac, Index *iRow, Index *jCol, Number *values, UserDataPtr user_data)
Type defining the callback function for evaluating the Jacobian of the constrant functions.
double Number
Type for all number.
Number Number Index Number Number Index Index nele_hess
Number of non-zero elements in Hessian of Lagrangian.
Number Number Number * g_scaling
char * file_name
Bool(* Eval_G_CB)(Index n, Number *x, Bool new_x, Index m, Number *g, UserDataPtr user_data)
Type defining the callback function for evaluating the value of the constraint functions.
void * UserDataPtr
A pointer for anything that is to be passed between the called and individual callback function...
ApplicationReturnStatus
Return codes for the Optimize call for an application.
Bool(* Eval_H_CB)(Index n, Number *x, Bool new_x, Number obj_factor, Index m, Number *lambda, Bool new_lambda, Index nele_hess, Index *iRow, Index *jCol, Number *values, UserDataPtr user_data)
Type defining the callback function for evaluating the Hessian of the Lagrangian function.
Number Number Number Number Number Number UserDataPtr user_data
Pointer to user data.
Number obj_scaling
Intermediate_CB intermediate_cb
Number Number Index Number Number Index Index Index Eval_F_CB eval_f
Callback function for evaluating objective function.
#define IPOPT_EXPORT(type)