idol
A C++ Framework for Optimization
Loading...
Searching...
No Matches
TempCtr.h
1
//
2
// Created by henri on 08/09/22.
3
//
4
5
#ifndef OPTIMIZE_TEMPCTR_H
6
#define OPTIMIZE_TEMPCTR_H
7
8
#include <ostream>
9
#include <idol/mixed-integer/modeling/expressions/LinExpr.h>
10
#include <idol/mixed-integer/modeling/Types.h>
11
#include <idol/mixed-integer/modeling/variables/Var.h>
12
13
namespace
idol {
14
15
class
TempCtr;
16
17
template
<
class
,
class
>
class
AffExpr;
18
}
19
41
class
idol::TempCtr
{
42
LinExpr<Var>
m_lhs;
43
CtrType m_type = LessOrEqual;
44
double
m_rhs = 0.;
45
public
:
51
TempCtr
() =
default
;
52
60
TempCtr
(
LinExpr<Var>
&& t_lhs, CtrType t_type,
double
t_rhs) : m_lhs(std::move(t_lhs)), m_rhs(t_rhs), m_type(t_type) {}
61
66
TempCtr
(
const
TempCtr
& t_src) =
default
;
67
72
TempCtr
(
TempCtr
&& t_src)
noexcept
=
default
;
73
78
TempCtr
&
operator=
(
const
TempCtr
& t_src) =
default
;
79
84
TempCtr
&
operator=
(
TempCtr
&& t_src)
noexcept
=
default
;
85
86
LinExpr<Var>
& lhs() {
return
m_lhs; }
87
88
const
LinExpr<Var>
& lhs()
const
{
return
m_lhs; }
89
90
void
set_lhs(LinExpr<Var>&& t_lhs) { m_lhs = std::move(t_lhs); }
91
96
[[nodiscard]] CtrType
type
()
const
{
return
m_type; }
97
98
double
rhs()
const
{
return
m_rhs; }
99
100
double
& rhs() {
return
m_rhs; }
101
102
void
set_rhs(
double
t_rhs) { m_rhs = t_rhs; }
103
108
void
set_type
(CtrType t_type) {
109
if
(t_type < 0 || t_type > 2) {
110
throw
Exception
(
"Constraint type out of bounds."
);
111
}
112
m_type = t_type;
113
}
114
115
};
116
117
idol::TempCtr
operator<=(
idol::AffExpr<idol::Var, double>
t_lhs,
idol::AffExpr<idol::Var, double>
t_rhs);
118
idol::TempCtr
operator>=(
idol::AffExpr<idol::Var, double>
t_lhs,
idol::AffExpr<idol::Var, double>
t_rhs);
119
idol::TempCtr
operator==(
idol::AffExpr<idol::Var, double>
t_lhs,
idol::AffExpr<idol::Var, double>
t_rhs);
120
121
namespace
idol {
122
std::ostream &operator<<(std::ostream &t_os,
const
TempCtr &t_temp_ctr);
123
}
124
125
#endif
//OPTIMIZE_TEMPCTR_H
idol::AffExpr
Definition
AffExpr.h:19
idol::Exception
Definition
Exception.h:14
idol::LinExpr
Definition
LinExpr.h:28
idol::TempCtr
Definition
TempCtr.h:41
idol::TempCtr::type
CtrType type() const
Definition
TempCtr.h:96
idol::TempCtr::operator=
TempCtr & operator=(TempCtr &&t_src) noexcept=default
idol::TempCtr::TempCtr
TempCtr(TempCtr &&t_src) noexcept=default
idol::TempCtr::TempCtr
TempCtr(LinExpr< Var > &&t_lhs, CtrType t_type, double t_rhs)
Definition
TempCtr.h:60
idol::TempCtr::TempCtr
TempCtr()=default
idol::TempCtr::set_type
void set_type(CtrType t_type)
Definition
TempCtr.h:108
idol::TempCtr::operator=
TempCtr & operator=(const TempCtr &t_src)=default
idol::TempCtr::TempCtr
TempCtr(const TempCtr &t_src)=default
lib
include
idol
mixed-integer
modeling
constraints
TempCtr.h
Generated by
1.9.8