Skip to content

Commit

Permalink
remove Constant in QuadExpr
Browse files Browse the repository at this point in the history
  • Loading branch information
hlefebvr committed Oct 24, 2024
1 parent 1a83061 commit 6b87e38
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 25 deletions.
16 changes: 0 additions & 16 deletions lib/include/idol/modeling/expressions/Expr.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ class idol::impl::Expr {
Expr();
Expr(double t_num); // NOLINT(google-explicit-constructor)
Expr(const Param& t_param); // NOLINT(google-explicit-constructor)
Expr(Constant&& t_expr); // NOLINT(google-explicit-constructor)
Expr(const Constant& t_expr); // NOLINT(google-explicit-constructor)
Expr(const Key1& t_var); // NOLINT(google-explicit-constructor)
Expr(LinExpr<Key1>&& t_expr); // NOLINT(google-explicit-constructor)
Expr(const LinExpr<Key1>& t_expr); // NOLINT(google-explicit-constructor)
Expand Down Expand Up @@ -119,18 +117,6 @@ idol::impl::Expr<Key1, Key2>::Expr(const Param &t_param)

}

template<class Key1, class Key2>
idol::impl::Expr<Key1, Key2>::Expr(Constant &&t_expr)
: m_constant(std::make_unique<MatrixCoefficient>(std::move(t_expr))) {

}

template<class Key1, class Key2>
idol::impl::Expr<Key1, Key2>::Expr(const Constant &t_expr)
: m_constant(std::make_unique<MatrixCoefficient>(t_expr)) {

}

template<class Key1, class Key2>
idol::impl::Expr<Key1, Key2>::Expr(const Key1 &t_var)
: m_linear(t_var),
Expand Down Expand Up @@ -230,8 +216,6 @@ class idol::Expr : public impl::Expr<Key1, Key2> {
Expr() = default;
Expr(double t_num) : impl::Expr<Key1, Key2>(t_num) {} // NOLINT(google-explicit-constructor)
Expr(const Param& t_param) : impl::Expr<Key1, Key2>(t_param) {} // NOLINT(google-explicit-constructor)
Expr(Constant&& t_expr) : impl::Expr<Key1, Key2>(std::move(t_expr)) {} // NOLINT(google-explicit-constructor)
Expr(const Constant& t_expr) : impl::Expr<Key1, Key2>(t_expr) {} // NOLINT(google-explicit-constructor)
Expr(const Key1& t_var) : impl::Expr<Key1, Key2>(t_var) {} // NOLINT(google-explicit-constructor)
Expr(LinExpr<Key1>&& t_expr) : impl::Expr<Key1, Key2>(std::move(t_expr)) {} // NOLINT(google-explicit-constructor)
Expr(const LinExpr<Key1>& t_expr) : impl::Expr<Key1, Key2>(t_expr) {} // NOLINT(google-explicit-constructor)
Expand Down
12 changes: 3 additions & 9 deletions lib/include/idol/modeling/expressions/QuadExpr.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,7 @@ class idol::QuadExpr : public AbstractExpr<idol::Pair<Key1, Key2>, QuadTerm<Key1
public:
QuadExpr() = default;
QuadExpr(const Key1& t_a, const Key2& t_b);
QuadExpr(Constant&& t_factor, const Key1& t_a, const Key2& t_b);
QuadExpr(const Constant& t_factor, const Key1& t_a, const Key2& t_b);
QuadExpr(double t_factor, const Key1& t_a, const Key2& t_b);

QuadExpr(const QuadExpr&) = default;
QuadExpr(QuadExpr&&) noexcept = default;
Expand All @@ -73,13 +72,8 @@ idol::QuadExpr<Key1, Key2, Hash, EqualTo>::QuadExpr(const Key1 &t_a, const Key2
}

template<class Key1, class Key2, class Hash, class EqualTo>
idol::QuadExpr<Key1, Key2, Hash, EqualTo>::QuadExpr(Constant &&t_factor, const Key1 &t_a, const Key2 &t_b) {
set(t_a, t_b, std::move(t_factor));
}

template<class Key1, class Key2, class Hash, class EqualTo>
idol::QuadExpr<Key1, Key2, Hash, EqualTo>::QuadExpr(const Constant &t_factor, const Key1 &t_a, const Key2 &t_b) {
set(t_a, t_b, Constant(t_factor));
idol::QuadExpr<Key1, Key2, Hash, EqualTo>::QuadExpr(double t_factor, const Key1 &t_a, const Key2 &t_b) {
set(t_a, t_b, t_factor);
}

template<class Key1, class Key2, class Hash, class EqualTo>
Expand Down

0 comments on commit 6b87e38

Please sign in to comment.