Ipopt Documentation  
 
Loading...
Searching...
No Matches
IpStdCInterface.h
Go to the documentation of this file.
1/* Copyright (C) 2004, 2010 International Business Machines and others.
2 * All Rights Reserved.
3 * This code is published under the Eclipse Public License.
4 *
5 * Authors: Carl Laird, Andreas Waechter IBM 2004-09-02
6 */
7
8#ifndef __IPSTDCINTERFACE_H__
9#define __IPSTDCINTERFACE_H__
10
11#include <stdbool.h>
12
13#include "IpoptConfig.h"
14#include "IpTypes.h"
15#include "IpReturnCodes.h"
16
17#ifndef IPOPT_EXPORT
19#define IPOPT_EXPORT(type) type IPOPT_CALLCONV
20#endif
21
22#ifdef __cplusplus
23extern "C"
24{
25#endif
26
32
37typedef int Index;
38
43typedef int Int;
44
46struct IpoptProblemInfo;
47
49typedef struct IpoptProblemInfo* IpoptProblem;
50
54typedef bool Bool;
55#ifndef TRUE
56/* @deprecated Use true instead. */
57# define TRUE (1)
58#endif
59/* @deprecated Use false instead. */
60#ifndef FALSE
61# define FALSE (0)
62#endif
63
65typedef void* UserDataPtr;
66
73typedef bool (*Eval_F_CB)(
74 ipindex n,
75 ipnumber* x,
76 bool new_x,
77 ipnumber* obj_value,
78 UserDataPtr user_data
79);
80
87typedef bool (*Eval_Grad_F_CB)(
88 ipindex n,
89 ipnumber* x,
90 bool new_x,
91 ipnumber* grad_f,
92 UserDataPtr user_data
93);
94
101typedef bool (*Eval_G_CB)(
102 ipindex n,
103 ipnumber* x,
104 bool new_x,
105 ipindex m,
106 ipnumber* g,
107 UserDataPtr user_data
108);
109
116typedef bool (*Eval_Jac_G_CB)(
117 ipindex n,
118 ipnumber* x,
119 bool new_x,
120 ipindex m,
121 ipindex nele_jac,
122 ipindex* iRow,
123 ipindex* jCol,
124 ipnumber* values,
125 UserDataPtr user_data
126);
127
134typedef bool (*Eval_H_CB)(
135 ipindex n,
136 ipnumber* x,
137 bool new_x,
138 ipnumber obj_factor,
139 ipindex m,
140 ipnumber* lambda,
141 bool new_lambda,
142 ipindex nele_hess,
143 ipindex* iRow,
144 ipindex* jCol,
145 ipnumber* values,
146 UserDataPtr user_data
147);
148
159typedef bool (*Intermediate_CB)(
160 ipindex alg_mod,
161 ipindex iter_count,
162 ipnumber obj_value,
163 ipnumber inf_pr,
164 ipnumber inf_du,
165 ipnumber mu,
166 ipnumber d_norm,
167 ipnumber regularization_size,
168 ipnumber alpha_du,
169 ipnumber alpha_pr,
170 ipindex ls_trials,
171 UserDataPtr user_data
172);
173
190 ipindex n,
191 ipnumber* x_L,
199 ipnumber* x_U,
207 ipindex m,
208 ipnumber* g_L,
216 ipnumber* g_U,
224 ipindex nele_jac,
225 ipindex nele_hess,
226 ipindex index_style,
227 Eval_F_CB eval_f,
228 Eval_G_CB eval_g,
229 Eval_Grad_F_CB eval_grad_f,
230 Eval_Jac_G_CB eval_jac_g,
231 Eval_H_CB eval_h
232);
233
239 IpoptProblem ipopt_problem
240);
241
247 IpoptProblem ipopt_problem,
248 char* keyword,
249 char* val
250);
251
257 IpoptProblem ipopt_problem,
258 char* keyword,
259 ipnumber val
260);
261
267 IpoptProblem ipopt_problem,
268 char* keyword,
269 ipindex val
270);
271
277 IpoptProblem ipopt_problem,
278 char* file_name,
279 int print_level
280);
281
289 IpoptProblem ipopt_problem,
290 ipnumber obj_scaling,
291 ipnumber* x_scaling,
292 ipnumber* g_scaling
293);
294
306 IpoptProblem ipopt_problem,
307 Intermediate_CB intermediate_cb
308);
309
316 IpoptProblem ipopt_problem,
321 ipnumber* x,
322 ipnumber* g,
323 ipnumber* obj_val,
324 ipnumber* mult_g,
327 ipnumber* mult_x_L,
330 ipnumber* mult_x_U,
333 UserDataPtr user_data
337);
338
367 IpoptProblem ipopt_problem,
368 bool scaled,
369 ipindex n,
370 ipnumber* x,
371 ipnumber* z_L,
372 ipnumber* z_U,
373 ipindex m,
374 ipnumber* g,
375 ipnumber* lambda
376);
377
411 IpoptProblem ipopt_problem,
412 bool scaled,
413 ipindex n,
414 ipnumber* x_L_violation,
415 ipnumber* x_U_violation,
416 ipnumber* compl_x_L,
417 ipnumber* compl_x_U,
418 ipnumber* grad_lag_x,
419 ipindex m,
420 ipnumber* nlp_constraint_violation,
421 ipnumber* compl_g
422);
423
424#ifdef __cplusplus
425} /* extern "C" { */
426#endif
427
428#endif
ApplicationReturnStatus
Return codes for the Optimize call for an application.
bool(* Intermediate_CB)(ipindex alg_mod, ipindex iter_count, ipnumber obj_value, ipnumber inf_pr, ipnumber inf_du, ipnumber mu, ipnumber d_norm, ipnumber regularization_size, ipnumber alpha_du, ipnumber alpha_pr, ipindex ls_trials, UserDataPtr user_data)
Type defining the callback function for giving intermediate execution control to the user.
IPOPTLIB_EXPORT bool IPOPT_CALLCONV OpenIpoptOutputFile(IpoptProblem ipopt_problem, char *file_name, int print_level)
Function for opening an output file for a given name with given printlevel.
IPOPTLIB_EXPORT void IPOPT_CALLCONV FreeIpoptProblem(IpoptProblem ipopt_problem)
Method for freeing a previously created IpoptProblem.
void * UserDataPtr
A pointer for anything that is to be passed between the called and individual callback function.
IPOPTLIB_EXPORT bool IPOPT_CALLCONV AddIpoptIntOption(IpoptProblem ipopt_problem, char *keyword, ipindex val)
Function for adding an Integer option.
IPOPTLIB_EXPORT enum ApplicationReturnStatus IPOPT_CALLCONV IpoptSolve(IpoptProblem ipopt_problem, ipnumber *x, ipnumber *g, ipnumber *obj_val, ipnumber *mult_g, ipnumber *mult_x_L, ipnumber *mult_x_U, UserDataPtr user_data)
Function calling the Ipopt optimization algorithm for a problem previously defined with CreateIpoptPr...
bool(* Eval_H_CB)(ipindex n, ipnumber *x, bool new_x, ipnumber obj_factor, ipindex m, ipnumber *lambda, bool new_lambda, ipindex nele_hess, ipindex *iRow, ipindex *jCol, ipnumber *values, UserDataPtr user_data)
Type defining the callback function for evaluating the Hessian of the Lagrangian function.
bool(* Eval_G_CB)(ipindex n, ipnumber *x, bool new_x, ipindex m, ipnumber *g, UserDataPtr user_data)
Type defining the callback function for evaluating the value of the constraint functions.
bool Bool
define a boolean type for C
IPOPTLIB_EXPORT bool IPOPT_CALLCONV AddIpoptNumOption(IpoptProblem ipopt_problem, char *keyword, ipnumber val)
Function for adding a Number option.
IPOPT_DEPRECATED typedef int Int
Type for all integers.
bool(* Eval_F_CB)(ipindex n, ipnumber *x, bool new_x, ipnumber *obj_value, UserDataPtr user_data)
Type defining the callback function for evaluating the value of the objective function.
IPOPTLIB_EXPORT bool IPOPT_CALLCONV AddIpoptStrOption(IpoptProblem ipopt_problem, char *keyword, char *val)
Function for adding a string option.
IPOPTLIB_EXPORT bool IPOPT_CALLCONV SetIntermediateCallback(IpoptProblem ipopt_problem, Intermediate_CB intermediate_cb)
Setting a callback function for the "intermediate callback" method in the TNLP.
IPOPT_DEPRECATED typedef ipnumber Number
Type for all number.
IPOPT_DEPRECATED typedef int Index
Type for all indices.
IPOPTLIB_EXPORT bool IPOPT_CALLCONV GetIpoptCurrentIterate(IpoptProblem ipopt_problem, bool scaled, ipindex n, ipnumber *x, ipnumber *z_L, ipnumber *z_U, ipindex m, ipnumber *g, ipnumber *lambda)
Get primal and dual variable values of the current iterate.
IPOPTLIB_EXPORT IpoptProblem IPOPT_CALLCONV CreateIpoptProblem(ipindex n, ipnumber *x_L, ipnumber *x_U, ipindex m, ipnumber *g_L, ipnumber *g_U, ipindex nele_jac, ipindex nele_hess, ipindex index_style, Eval_F_CB eval_f, Eval_G_CB eval_g, Eval_Grad_F_CB eval_grad_f, Eval_Jac_G_CB eval_jac_g, Eval_H_CB eval_h)
Function for creating a new Ipopt Problem object.
bool(* Eval_Grad_F_CB)(ipindex n, ipnumber *x, bool new_x, ipnumber *grad_f, UserDataPtr user_data)
Type defining the callback function for evaluating the gradient of the objective function.
struct IpoptProblemInfo * IpoptProblem
Pointer to an Ipopt Problem.
IPOPTLIB_EXPORT bool IPOPT_CALLCONV GetIpoptCurrentViolations(IpoptProblem ipopt_problem, bool scaled, ipindex n, ipnumber *x_L_violation, ipnumber *x_U_violation, ipnumber *compl_x_L, ipnumber *compl_x_U, ipnumber *grad_lag_x, ipindex m, ipnumber *nlp_constraint_violation, ipnumber *compl_g)
Get primal and dual infeasibility of the current iterate.
bool(* Eval_Jac_G_CB)(ipindex n, ipnumber *x, bool new_x, ipindex m, ipindex nele_jac, ipindex *iRow, ipindex *jCol, ipnumber *values, UserDataPtr user_data)
Type defining the callback function for evaluating the Jacobian of the constrant functions.
IPOPTLIB_EXPORT bool IPOPT_CALLCONV SetIpoptProblemScaling(IpoptProblem ipopt_problem, ipnumber obj_scaling, ipnumber *x_scaling, ipnumber *g_scaling)
Optional function for setting scaling parameter for the NLP.
#define IPOPT_DEPRECATED
macro to declare symbols as deprecated
Definition IpTypes.h:25
double ipnumber
Type for floating-point numbers.
Definition IpTypes.h:51
int ipindex
Type of all indices of vectors, matrices etc.
Definition IpTypes.h:68
#define IPOPT_CALLCONV
Definition IpTypes.h:41
#define IPOPTLIB_EXPORT