8#include "SparseVector.h"
10#include "idol/mixed-integer/modeling/variables/Var.h"
11#include "idol/general/numericals.h"
15 template<
class T>
class Point;
16 using PrimalPoint = Point<Var>;
17 using DualPoint = Point<Ctr>;
22 SolutionStatus m_status = Loaded;
23 SolutionReason m_reason = NotSpecified;
24 std::optional<double> m_objective_value;
30 [[nodiscard]] SolutionStatus status()
const {
return m_status; }
31 void set_status(SolutionStatus t_status) { m_status = t_status; }
33 [[nodiscard]] SolutionReason reason()
const {
return m_reason; }
35 void set_reason(SolutionReason t_reason) { m_reason = t_reason; }
37 [[nodiscard]]
double objective_value()
const;
39 void set_objective_value(
double t_objective_value) { m_objective_value = t_objective_value; }
41 [[nodiscard]]
bool has_objective_value()
const {
return m_objective_value.has_value(); }
43 void reset_objective_value() { m_objective_value.reset(); }
55 if (m_objective_value.has_value()) {
56 return m_objective_value.value();
59 if (m_status == Unbounded) {
68 static std::ostream &operator<<(std::ostream &t_os,
const Point<T> &t_point) {
69 t_os <<
"Status: " << t_point.status() <<
'\n';
70 t_os <<
"Reason: " << t_point.reason() <<
'\n';
71 t_os <<
"Objective value: " << t_point.objective_value() <<
'\n';
72 t_os <<
"Values: " <<
'\n';
73 t_os << static_cast<const SparseVector<T, double> &>(t_point);
77 template<
class T>
static Point<T> operator+(Point<T>&& t_x, Point<T>&& t_y) {
return Point(std::move(t_x)) += t_y; }
78 template<
class T>
static Point<T> operator+(Point<T>&& t_x,
const Point<T>& t_y) {
return Point(std::move(t_x)) += t_y; }
79 template<
class T>
static Point<T> operator+(
const Point<T>& t_x, Point<T>&& t_y) {
return Point(std::move(t_y)) += t_x; }
80 template<
class T>
static Point<T> operator+(
const Point<T>& t_x,
const Point<T>& t_y) {
return Point(t_x) += t_y; }
82 template<
class T>
static Point<T> operator*(
double t_factor,
const Point<T>& t_y) {
return Point(t_y) *= t_factor; }