#ifndef __PAPILOLIB_H__
#define __PAPILOLIB_H__
#define PAPILOLIB_EXPORT __attribute__((__visibility__("default")))
#ifdef __cplusplus
extern "C"
{
#endif
#include <stddef.h>
#include <stdint.h>
typedef enum Papilo_RowType
{
PAPILO_ROW_TYPE_GREATER = 0,
PAPILO_ROW_TYPE_LESSER = 1,
PAPILO_ROW_TYPE_EQUAL = 2,
} PAPILO_ROW_TYPE;
typedef struct Papilo_Problem PAPILO_PROBLEM;
PAPILOLIB_EXPORT PAPILO_PROBLEM*
papilo_problem_create( double infinity, const char* name, int nnz_hint,
int row_hint, int col_hint );
PAPILOLIB_EXPORT void
papilo_problem_free( PAPILO_PROBLEM* );
PAPILOLIB_EXPORT int
papilo_problem_add_cols( PAPILO_PROBLEM* problem, int num, const double* lb,
const double* ub, const unsigned char* integral,
const double* obj, const char** colnames );
PAPILOLIB_EXPORT int
papilo_problem_add_col( PAPILO_PROBLEM* problem, double lb, double ub,
unsigned char integral, double obj,
const char* colname );
PAPILOLIB_EXPORT int
papilo_problem_get_num_cols( PAPILO_PROBLEM* problem );
PAPILOLIB_EXPORT int
papilo_problem_get_num_rows( PAPILO_PROBLEM* problem );
PAPILOLIB_EXPORT int
papilo_problem_get_num_nonzeros( PAPILO_PROBLEM* problem );
PAPILOLIB_EXPORT void
papilo_problem_change_col_lb( PAPILO_PROBLEM* problem, int col, double lb );
PAPILOLIB_EXPORT void
papilo_problem_change_col_ub( PAPILO_PROBLEM* problem, int col, double ub );
PAPILOLIB_EXPORT void
papilo_problem_change_col_integral( PAPILO_PROBLEM* problem, int col,
unsigned char integral );
PAPILOLIB_EXPORT void
papilo_problem_change_col_obj( PAPILO_PROBLEM* problem, int col,
double obj );
PAPILOLIB_EXPORT int
papilo_problem_add_simple_rows( PAPILO_PROBLEM* problem, int num,
const unsigned char* rowtypes,
const double* side, const char** rownames );
PAPILOLIB_EXPORT int
papilo_problem_add_generic_rows( PAPILO_PROBLEM* problem, int num,
const double* lhs, const double* rhs,
const char** rownames );
PAPILOLIB_EXPORT int
papilo_problem_add_simple_row( PAPILO_PROBLEM* problem,
unsigned char rowtype, double side,
const char* rowname );
PAPILOLIB_EXPORT int
papilo_problem_add_generic_row( PAPILO_PROBLEM* problem, double lhs,
double rhs, const char* rowname );
PAPILOLIB_EXPORT void
papilo_problem_add_nonzero( PAPILO_PROBLEM* problem, int row, int col,
double val );
PAPILOLIB_EXPORT void
papilo_problem_add_nonzeros_row( PAPILO_PROBLEM* problem, int row, int num,
const int* cols, const double* vals );
PAPILOLIB_EXPORT void
papilo_problem_add_nonzeros_col( PAPILO_PROBLEM* problem, int col, int num,
const int* rows, const double* vals );
PAPILOLIB_EXPORT void
papilo_problem_add_nonzeros_csr( PAPILO_PROBLEM* problem,
const int* rowstart, const int* cols,
const double* vals );
PAPILOLIB_EXPORT void
papilo_problem_add_nonzeros_csc( PAPILO_PROBLEM* problem,
const int* colstart, const int* rows,
const double* vals );
typedef struct Papilo_Solver PAPILO_SOLVER;
PAPILOLIB_EXPORT PAPILO_SOLVER*
papilo_solver_create();
PAPILOLIB_EXPORT void
papilo_solver_set_trace_callback( PAPILO_SOLVER* solver,
void ( *thetracecb )( int level,
const char* data,
size_t size,
void* usrptr ),
void* usrptr );
PAPILOLIB_EXPORT void
papilo_solver_free( PAPILO_SOLVER* );
typedef enum Papilo_ParamResult
{
PAPILO_PARAM_CHANGED = 0,
PAPILO_PARAM_NOT_FOUND = 1,
PAPILO_PARAM_WRONG_TYPE = 2,
PAPILO_PARAM_INVALID_VALUE = 3,
} PAPILO_PARAM_RESULT;
PAPILOLIB_EXPORT PAPILO_PARAM_RESULT
papilo_solver_set_param_bool( PAPILO_SOLVER* solver, const char* key,
unsigned int val );
PAPILOLIB_EXPORT PAPILO_PARAM_RESULT
papilo_solver_set_param_real( PAPILO_SOLVER* solver, const char* key,
double val );
PAPILOLIB_EXPORT PAPILO_PARAM_RESULT
papilo_solver_set_param_int( PAPILO_SOLVER* solver, const char* key,
int val );
PAPILOLIB_EXPORT PAPILO_PARAM_RESULT
papilo_solver_set_param_char( PAPILO_SOLVER* solver, const char* key,
char val );
PAPILOLIB_EXPORT PAPILO_PARAM_RESULT
papilo_solver_set_param_string( PAPILO_SOLVER* solver, const char* key,
const char* val );
PAPILOLIB_EXPORT PAPILO_PARAM_RESULT
papilo_solver_set_mip_param_real( PAPILO_SOLVER* solver, const char* key,
double val );
PAPILOLIB_EXPORT PAPILO_PARAM_RESULT
papilo_solver_set_mip_param_int( PAPILO_SOLVER* solver, const char* key,
int val );
PAPILOLIB_EXPORT PAPILO_PARAM_RESULT
papilo_solver_set_mip_param_bool( PAPILO_SOLVER* solver, const char* key,
unsigned int val );
PAPILOLIB_EXPORT PAPILO_PARAM_RESULT
papilo_solver_set_mip_param_int64( PAPILO_SOLVER* solver, const char* key,
int64_t val );
PAPILOLIB_EXPORT PAPILO_PARAM_RESULT
papilo_solver_set_mip_param_char( PAPILO_SOLVER* solver, const char* key,
char val );
PAPILOLIB_EXPORT PAPILO_PARAM_RESULT
papilo_solver_set_mip_param_string( PAPILO_SOLVER* solver, const char* key,
const char* val );
PAPILOLIB_EXPORT PAPILO_PARAM_RESULT
papilo_solver_set_lp_param_real( PAPILO_SOLVER* solver, const char* key,
double val );
PAPILOLIB_EXPORT PAPILO_PARAM_RESULT
papilo_solver_set_lp_param_int( PAPILO_SOLVER* solver, const char* key,
int val );
PAPILOLIB_EXPORT PAPILO_PARAM_RESULT
papilo_solver_set_lp_param_bool( PAPILO_SOLVER* solver, const char* key,
unsigned int val );
PAPILOLIB_EXPORT PAPILO_PARAM_RESULT
papilo_solver_set_lp_param_int64( PAPILO_SOLVER* solver, const char* key,
int64_t val );
PAPILOLIB_EXPORT PAPILO_PARAM_RESULT
papilo_solver_set_lp_param_char( PAPILO_SOLVER* solver, const char* key,
char val );
PAPILOLIB_EXPORT PAPILO_PARAM_RESULT
papilo_solver_set_lp_param_string( PAPILO_SOLVER* solver, const char* key,
const char* val );
typedef enum Papilo_SolveResult
{
PAPILO_SOLVE_RESULT_OPTIMAL = 0,
PAPILO_SOLVE_RESULT_FEASIBLE = 1,
PAPILO_SOLVE_RESULT_STOPPED = 2,
PAPILO_SOLVE_RESULT_UNBND_OR_INFEAS = 3,
PAPILO_SOLVE_RESULT_UNBOUNDED = 4,
PAPILO_SOLVE_RESULT_INFEASIBLE = 5,
} PAPILO_SOLVE_RESULT;
PAPILOLIB_EXPORT void
papilo_solver_load_problem( PAPILO_SOLVER* solver, PAPILO_PROBLEM* problem );
PAPILOLIB_EXPORT void
papilo_solver_write_mps( PAPILO_SOLVER* solver, const char* filename );
PAPILOLIB_EXPORT
void
papilo_solver_set_num_threads( PAPILO_SOLVER* solver, int numthreads );
typedef struct
{
PAPILO_SOLVE_RESULT solve_result;
const double* bestsol;
double bestsol_obj;
double bestsol_intviol;
double bestsol_boundviol;
double bestsol_consviol;
double dualbound;
double presolvetime;
double solvingtime;
} PAPILO_SOLVING_INFO;
PAPILOLIB_EXPORT PAPILO_SOLVING_INFO*
papilo_solver_start( PAPILO_SOLVER* solver );
#ifdef __cplusplus
}
#endif
#endif