分支定界法基本框架

This commit is contained in:
2025-05-23 17:59:24 +08:00
parent 26ac3ddebd
commit d4456e9632
7 changed files with 353 additions and 98 deletions

View File

@ -87,17 +87,28 @@ namespace sv {
EQUAL
};
enum class VarType {
CONTINUOUS,
BINARY,
INTEGER,
};
class Var {
public:
Var(double coef = 1) :col(0), val(0), coeffs(coef) {};
friend class Model;
friend class LinSolver;
friend class Expr;
Var(double coef = 1, VarType type_ = VarType::CONTINUOUS);
double get(DoubleAttr attr);
int get(IntAttr attr);
friend class Model;
friend class Expr;
private:
double coeffs;
double val;
int col;
VarType type;
};
Expr operator+(const Expr& x, const Expr& y);
@ -131,7 +142,7 @@ namespace sv {
Expr(double constant = 0.0);
Expr(Var var, double coeff = 1.0);
friend class Model;
friend class LinSolver;
friend Expr operator+(const Expr& x, const Expr& y);
friend Expr operator+(const Expr& x);