idol
A C++ Framework for Optimization
Loading...
Searching...
No Matches
Var.h
1//
2// Created by henri on 27/01/23.
3//
4
5#ifndef IDOL_VAR_H
6#define IDOL_VAR_H
7
8#include "idol/mixed-integer/modeling/objects/Object.h"
9#include "idol/mixed-integer/modeling/Types.h"
10
11namespace idol {
12
13 class Env;
14 class VarVersion;
15
16 template<class T>
17 class Versions;
18
19 namespace impl {
20 class Env;
21 }
22
23 class Var;
24 template<class, class> class LinExpr;
25}
26
27class idol::Var : public Object<VarVersion, Var> {
28 friend class impl::Env;
29public:
42 Var(Env& t_env, double t_lb, double t_ub, VarType t_type, double t_obj = 0., std::string t_name = "");
43
57 Var(Env& t_env, double t_lb, double t_ub, VarType t_type, double t_obj, LinExpr<Ctr, double>&& t_column, std::string t_name = "");
58
72 Var(Env& t_env, double t_lb, double t_ub, VarType t_type, double t_obj, const LinExpr<Ctr, double>& t_column, std::string t_name = "");
73
74 Var(const Var&) = default;
75 Var(Var&&) = default;
76
77 Var& operator=(const Var&) = default;
78 Var& operator=(Var&&) = default;
79
103 template<unsigned int N = 1, unsigned int I = 0>
104 static Vector<Var, N - I> make_vector(Env& t_env, const Dim<N>& t_dim, double t_lb, double t_ub, VarType t_type, double t_obj, const std::string& t_name = "") {
105 return impl::create_many<Var, N, I>(t_dim, t_name.empty() ? "Var" : t_name, [&](const std::string& t_name_i) {
106 return Var(t_env, t_lb, t_ub, t_type, t_obj, t_name_i);
107 });
108 }
109
110 unsigned int index(const Model& t_model) const;
111};
112
113#endif //IDOL_VAR_H
Var(Env &t_env, double t_lb, double t_ub, VarType t_type, double t_obj=0., std::string t_name="")
Var(Env &t_env, double t_lb, double t_ub, VarType t_type, double t_obj, const LinExpr< Ctr, double > &t_column, std::string t_name="")
Var(Env &t_env, double t_lb, double t_ub, VarType t_type, double t_obj, LinExpr< Ctr, double > &&t_column, std::string t_name="")
static Vector< Var, N - I > make_vector(Env &t_env, const Dim< N > &t_dim, double t_lb, double t_ub, VarType t_type, double t_obj, const std::string &t_name="")
Definition Var.h:104