4 * Copyright: (c) Universitaet Karlsruhe
5 * Licence: This file protected by GPL - GNU GENERAL PUBLIC LICENSE.
10 typedef enum _opt_t {minimize, maximize} opt_t;
11 typedef enum _cst_t {objective=0, equal=1, less=2, greater=3} cst_t;
12 typedef enum _var_t {invalid=0, real=1, binary=2} var_t;
15 * Fixed-column mps where spaces are allowed in identifiers :-0
16 * Free mps where whitespace is a seperator :-)
19 typedef enum _style_t {s_mps_fixed, s_mps_free, s_lp} style_t;
21 typedef struct _lpp_t lpp_t;
24 * Creates a new problem. Optimization type is minimize or maximize
26 lpp_t *new_lp(char *name, opt_t opt_type);
28 void free_lp(lpp_t *lpp);
31 * Adds a constraint to a problem. If a constraint with the same name already exists result is undefined.
32 * @param cst_name The name of the constraint.
33 * @param cst_type The type of constraint: objective, equality, less-or-equal, greater-or-equal
35 void lpp_add_constr(lpp_t *lpp, const char *cst_name, cst_t cst_type);
38 * Adds a variable to a problem. If a variable with the same name already exists result is undefined.
39 * @param var_name The name of the variable.
40 * @param var_type The type of the var: real or binary
41 * NOTE: common integer or semi-continous vars are not (yet) implemented
43 void lpp_add_var(lpp_t *lpp, const char *var_name, var_t var_type);
46 * Sets the factor of the variable @p var_name in constraint @p cst_name to @p value.
48 void lpp_set_factor(lpp_t *lpp, const char *cst_name, const char *var_name, int value);
51 * Sets the value for the right hand side of constraint @p cst_name to @p value
53 void lpp_set_rhs(lpp_t *lpp, char *cst_name, int value);
56 * Sets, for constraint @p cst_name, all factors of all variables
57 * given in @p var_names to the values given in @p values.
59 void lpp_set_all_constr(lpp_t *lpp, char *cst_name, char **var_names, int *values);
62 * Writes out the problem in the format specified be @p style.
64 void lpp_dump(lpp_t *lpp, FILE *out, style_t style);