diff options
Diffstat (limited to 'omegalib/omega_lib/include/omega/pres_cmpr.h')
-rw-r--r-- | omegalib/omega_lib/include/omega/pres_cmpr.h | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/omegalib/omega_lib/include/omega/pres_cmpr.h b/omegalib/omega_lib/include/omega/pres_cmpr.h new file mode 100644 index 0000000..fb3e6f0 --- /dev/null +++ b/omegalib/omega_lib/include/omega/pres_cmpr.h @@ -0,0 +1,49 @@ +#if ! defined _pres_cmpr_h +#define _pres_cmpr_h 1 + +#include <omega/omega_core/oc.h> + +namespace omega { + +// +// Compressed problem: rectangular non-0 cut from the big problem. +// +class Comp_Constraints { +public: + Comp_Constraints(eqn *constrs, int no_constrs, int no_vars); + void UncompressConstr(eqn *constrs, short &pn_constrs); + ~Comp_Constraints(); + bool no_constraints() const + { return n_constrs == 0; } + int n_constraints() const + { return n_constrs; } + +protected: + inline int coef_index(int e, int v) + {return e*(n_vars+1) + v;} + +private: + int n_constrs; + int n_vars; + coef_t *coefs; +}; + +class Comp_Problem { +public: + Comp_Problem(Problem *problem); + Problem *UncompressProblem(); + bool no_constraints() const + { return eqs.no_constraints() && geqs.no_constraints(); } + +private: +/* === data === */ + int _nVars, _safeVars; + const char *(*_get_var_name)(unsigned int var, void *args); + void *_getVarNameArgs; + Comp_Constraints eqs; + Comp_Constraints geqs; +}; + +} // namespace + +#endif |