Skip to content

Commit

Permalink
fix header
Browse files Browse the repository at this point in the history
  • Loading branch information
jgillis committed Jul 14, 2024
1 parent 2e01385 commit 1db6f33
Showing 1 changed file with 20 additions and 15 deletions.
35 changes: 20 additions & 15 deletions madnlp/include/madnlp_c.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ extern "C" {
#endif


#define madnlp_int int
#define madnlp_int long long int
#define madnlp_real double

// structs
Expand All @@ -35,15 +35,11 @@ struct MadnlpCInterface;
typedef struct MadnlpCSolver MadnlpCSolver;

// function pointer types
typedef madnlp_int (*MadnlpCEvalObj)(const double*, double *, void*);
typedef madnlp_int (*MadnlpCEvalConstr)(const double*, double *, void*);
typedef madnlp_int (*MadnlpCEvalObjGrad)(const double*, double*, void*);
typedef madnlp_int (*MadnlpCEvalConstrJac)(const double*, double*, void*);
typedef madnlp_int (*MadnlpCEvalLagHess)(double, const double*, const double*, double*, void*);

struct MadnlpCStats {
madnlp_int iter;
};
typedef int (*MadnlpCEvalObj)(const double*, double *, void*);
typedef int (*MadnlpCEvalConstr)(const double*, double *, void*);
typedef int (*MadnlpCEvalObjGrad)(const double*, double*, void*);
typedef int (*MadnlpCEvalConstrJac)(const double*, double*, void*);
typedef int (*MadnlpCEvalLagHess)(double, const double*, const double*, double*, void*);

struct MadnlpCInterface {
MadnlpCEvalObj eval_obj;
Expand Down Expand Up @@ -85,25 +81,34 @@ struct MadnlpCNumericOut {
const double* mul;
const double* mul_L;
const double* mul_U;
const double* primal_feas;
const double* dual_feas;
};

struct MadnlpCStats {
const madnlp_int* iter;
};

MADNLP_SYMBOL_EXPORT struct MadnlpCSolver* madnlp_c_create(struct MadnlpCInterface* nlp_interface);

MADNLP_SYMBOL_EXPORT const struct MadnlpCNumericIn* madnlp_c_input(struct MadnlpCSolver*);
MADNLP_SYMBOL_EXPORT const struct MadnlpCNumericOut* madnlp_c_output(struct MadnlpCSolver*);
MADNLP_SYMBOL_EXPORT madnlp_int madnlp_c_solve(struct MadnlpCSolver*);

/* -1 for not found, 0 for double, 1 for int, 2 for bool, 3 for string */
MADNLP_SYMBOL_EXPORT int madnlp_c_option_type(const char* name);
MADNLP_SYMBOL_EXPORT int madnlp_c_set_option_double(struct MadnlpCSolver* s, const char* name, double val);
MADNLP_SYMBOL_EXPORT int madnlp_c_set_option_bool(struct MadnlpCSolver* s, const char* name, int val);
MADNLP_SYMBOL_EXPORT int madnlp_c_set_option_int(struct MadnlpCSolver* s, const char* name, int val);
MADNLP_SYMBOL_EXPORT int madnlp_c_set_option_bool(struct MadnlpCSolver* s, const char* name, madnlp_int val);
MADNLP_SYMBOL_EXPORT int madnlp_c_set_option_int(struct MadnlpCSolver* s, const char* name, madnlp_int val);
MADNLP_SYMBOL_EXPORT int madnlp_c_set_option_string(struct MadnlpCSolver* s, const char* name, const char* val);

MADNLP_SYMBOL_EXPORT int madnlp_c_solve(struct MadnlpCSolver*);

MADNLP_SYMBOL_EXPORT const struct MadnlpCNumericOut* madnlp_c_output(struct MadnlpCSolver*);
MADNLP_SYMBOL_EXPORT const struct MadnlpCStats* madnlp_c_get_stats(struct MadnlpCSolver* s);

MADNLP_SYMBOL_EXPORT void madnlp_c_destroy(struct MadnlpCSolver*);

#ifdef __cplusplus
}
#endif

#endif // _MADNLP_C_H
#endif // _MADNLP_C_H

0 comments on commit 1db6f33

Please sign in to comment.