25#include <unordered_map>
27#include <antares/solver/optim-model-filler/FullKey.h>
35 const T& operator()(
const T& t)
41using FullKeyMap = std::unordered_map<FullKey, double, FullKeyHash>;
54 typename HashType = std::hash<Key>>
55std::unordered_map<Key, Value, HashType>
add_maps(
56 const std::unordered_map<Key, Value, HashType>& left,
57 const std::unordered_map<Key, Value, HashType>& right,
61 for (
auto [key, value]: right)
63 if (result.contains(key))
65 result[key] += op(value);
69 result[key] = op(value);
82FullKeyMap
scale_map(
const FullKeyMap& map,
double scale);
122 FullKeyMap coef_per_var_;
Definition LinearExpression.h:92
const FullKeyMap & coefPerVar() const
Get the non-zero coefficients per variable ID.
Definition LinearExpression.cpp:58
LinearExpression operator/(const LinearExpression &other) const
Definition LinearExpression.cpp:92
LinearExpression operator-() const
Multiply linear expression by -1.
Definition LinearExpression.cpp:101
double offset() const
Get the offset.
Definition LinearExpression.cpp:106
LinearExpression()=default
Build a linear expression with zero offset and zero coefficients.
LinearExpression operator*(const LinearExpression &other) const
Definition LinearExpression.cpp:76
LinearExpression operator+(const LinearExpression &other) const
Sum two linear expressions.
Definition LinearExpression.cpp:53
Definition constraint-slack-analysis.cpp:45
FullKeyMap scale_map(const FullKeyMap &map, double scale)
Definition LinearExpression.cpp:37
std::unordered_map< Key, Value, HashType > add_maps(const std::unordered_map< Key, Value, HashType > &left, const std::unordered_map< Key, Value, HashType > &right, UnaryOp op=IdentityFunction< Value >{})
Definition LinearExpression.h:55
Definition LinearExpression.h:34