Google OR-Tools v9.11
a fast and portable software suite for combinatorial optimization
|
#include <stddef.h>
Go to the source code of this file.
Functions | |
struct MathOptInterrupter * | MathOptNewInterrupter () |
void | MathOptFreeInterrupter (struct MathOptInterrupter *interrupter) |
Frees interrupter, has no effect when interrupter is NULL. | |
void | MathOptInterrupt (struct MathOptInterrupter *interrupter) |
int | MathOptIsInterrupted (const struct MathOptInterrupter *interrupter) |
int | MathOptSolve (const void *model, size_t model_size, int solver_type, struct MathOptInterrupter *interrupter, void **solve_result, size_t *solve_result_size, char **status_msg) |
void | MathOptFree (void *ptr) |
void MathOptFree | ( | void * | ptr | ) |
Frees memory allocated by the MathOpt C API, e.g. the solve_result or status_msg output arguments from MathOptSolve(). If ptr
is NULL, has no effect.
void MathOptFreeInterrupter | ( | struct MathOptInterrupter * | interrupter | ) |
void MathOptInterrupt | ( | struct MathOptInterrupter * | interrupter | ) |
int MathOptIsInterrupted | ( | const struct MathOptInterrupter * | interrupter | ) |
Checks if the interrupter is triggered.
Will CHECK fail if interrupter is NULL. This is threadsafe.
struct MathOptInterrupter * MathOptNewInterrupter | ( | ) |
Returns a new interrupter that has not been triggered. The caller must free this with MathOptFreeInterrupter().
int MathOptSolve | ( | const void * | model, |
size_t | model_size, | ||
int | solver_type, | ||
struct MathOptInterrupter * | interrupter, | ||
void ** | solve_result, | ||
size_t * | solve_result_size, | ||
char ** | status_msg ) |
Solves an optimization model with MathOpt and returns the result.
Arguments:
*solve_result
is filled with a serialized SolveResultProto from solving model
. The caller must free *solve_result
in this case with MathOptFree(). On failure, *solve_result
is set to NULL.*solve_result_size
has the size in bytes of the serialized SolveResultProto from solving model
(the size of *solve_result
if set). On failure, *solve_result_size
is set to zero.*status_msg
is set to NULL. On failure, *status_msg
is set to a null terminated string describing the error. The caller must free *status_msg
with MathOptFree() in this case.solve_result_size
holds the size of the serialized proto returned in solve_result
. Typically, you should make solve_result
and solve_result_size
either both NULL or both not NULL. You cannot safely consume solve_result
without solve_result_size
.Returns 0 if successful and a nonzero value on failure (the value is an absl::StatusCode enum).