Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make base algorithms (cobyla, bobyqa, etc.) directly available in the C API #183

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions c/include/prima/prima.h
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,30 @@ PRIMAC_API
int prima_init_options(prima_options_t *const options);


// Functions implemented in Fortran (*_c.f90)
int cobyla_c(const int m_nlcon, const prima_objcon_t calcfc, const void *data, const int n, double x[], double *const f, double *const cstrv, double nlconstr[],
const int m_ineq, const double Aineq[], const double bineq[],
const int m_eq, const double Aeq[], const double beq[],
const double xl[], const double xu[],
const double f0, const double nlconstr0[],
int *const nf, const double rhobeg, const double rhoend, const double ftarget, const int maxfun, const int iprint, const double ctol,
const prima_callback_t callback, int *const info);

int bobyqa_c(prima_obj_t calfun, const void *data, const int n, double x[], double *const f, const double xl[], const double xu[],
int *const nf, const double rhobeg, const double rhoend, const double ftarget, const int maxfun, const int npt, const int iprint, const prima_callback_t callback, int *const info);

int newuoa_c(prima_obj_t calfun, const void *data, const int n, double x[], double *const f,
int *const nf, const double rhobeg, const double rhoend, const double ftarget, const int maxfun, const int npt, const int iprint, const prima_callback_t callback, int *const info);

int uobyqa_c(prima_obj_t calfun, const void *data, const int n, double x[], double *const f,
int *const nf, const double rhobeg, const double rhoend, const double ftarget, const int maxfun, const int iprint, const prima_callback_t callback, int *const info);

int lincoa_c(prima_obj_t calfun, const void *data, const int n, double x[], double *const f,
double *const cstrv, const int m_ineq, const double Aineq[], const double bineq[],
const int m_eq, const double Aeq[], const double beq[], const double xl[], const double xu[],
int *const nf, const double rhobeg, const double rhoend, const double ftarget, const int maxfun, const int npt, const int iprint, const double ctol,
const prima_callback_t callback, int *const info);

// Structure to hold the result
// prima_minimize will allocate the memory for x and nlconstr (if needed),
// and as such the user is expected to free the memory using prima_free_result
Expand Down
26 changes: 0 additions & 26 deletions c/prima.c
Original file line number Diff line number Diff line change
Expand Up @@ -203,32 +203,6 @@ const char *prima_get_rc_string(const prima_rc_t rc)
}
}


// Functions implemented in Fortran (*_c.f90)
int cobyla_c(const int m_nlcon, const prima_objcon_t calcfc, const void *data, const int n, double x[], double *const f, double *const cstrv, double nlconstr[],
const int m_ineq, const double Aineq[], const double bineq[],
const int m_eq, const double Aeq[], const double beq[],
const double xl[], const double xu[],
const double f0, const double nlconstr0[],
int *const nf, const double rhobeg, const double rhoend, const double ftarget, const int maxfun, const int iprint, const double ctol,
const prima_callback_t callback, int *const info);

int bobyqa_c(prima_obj_t calfun, const void *data, const int n, double x[], double *const f, const double xl[], const double xu[],
int *const nf, const double rhobeg, const double rhoend, const double ftarget, const int maxfun, const int npt, const int iprint, const prima_callback_t callback, int *const info);

int newuoa_c(prima_obj_t calfun, const void *data, const int n, double x[], double *const f,
int *const nf, const double rhobeg, const double rhoend, const double ftarget, const int maxfun, const int npt, const int iprint, const prima_callback_t callback, int *const info);

int uobyqa_c(prima_obj_t calfun, const void *data, const int n, double x[], double *const f,
int *const nf, const double rhobeg, const double rhoend, const double ftarget, const int maxfun, const int iprint, const prima_callback_t callback, int *const info);

int lincoa_c(prima_obj_t calfun, const void *data, const int n, double x[], double *const f,
double *const cstrv, const int m_ineq, const double Aineq[], const double bineq[],
const int m_eq, const double Aeq[], const double beq[], const double xl[], const double xu[],
int *const nf, const double rhobeg, const double rhoend, const double ftarget, const int maxfun, const int npt, const int iprint, const double ctol,
const prima_callback_t callback, int *const info);


// The function that does the minimization using a PRIMA solver
int prima_minimize(const prima_algorithm_t algorithm, const prima_problem_t problem, const prima_options_t options, prima_result_t *const result)
{
Expand Down