-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add Neame and Wentges static stabilization
- Loading branch information
Showing
12 changed files
with
237 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
lib/include/idol/optimizers/dantzig-wolfe/stabilization/DualPriceSmoothingStabilization.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// | ||
// Created by henri on 31.10.23. | ||
// | ||
|
||
#ifndef IDOL_DUALPRICESMOOTHINGSTABILIZATION_H | ||
#define IDOL_DUALPRICESMOOTHINGSTABILIZATION_H | ||
|
||
#include "idol/modeling/solutions/Solution.h" | ||
|
||
namespace idol::DantzigWolfe { | ||
class DualPriceSmoothingStabilization; | ||
} | ||
|
||
class idol::DantzigWolfe::DualPriceSmoothingStabilization { | ||
public: | ||
virtual ~DualPriceSmoothingStabilization() = default; | ||
|
||
class Strategy { | ||
public: | ||
virtual ~Strategy() = default; | ||
|
||
virtual void initialize() = 0; | ||
|
||
virtual void update_stability_center(const Solution::Dual& t_master_dual) = 0; | ||
|
||
virtual Solution::Dual compute_smoothed_dual_solution(const Solution::Dual& t_master_dual) = 0; | ||
}; | ||
|
||
virtual Strategy* operator()() const = 0; | ||
|
||
[[nodiscard]] virtual DualPriceSmoothingStabilization* clone() const = 0; | ||
}; | ||
|
||
#endif //IDOL_DUALPRICESMOOTHINGSTABILIZATION_H |
58 changes: 58 additions & 0 deletions
58
lib/include/idol/optimizers/dantzig-wolfe/stabilization/Neame.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
// | ||
// Created by henri on 31.10.23. | ||
// | ||
|
||
#ifndef IDOL_NEAME_H | ||
#define IDOL_NEAME_H | ||
|
||
#include "DualPriceSmoothingStabilization.h" | ||
|
||
namespace idol::DantzigWolfe { | ||
class Neame; | ||
} | ||
|
||
class idol::DantzigWolfe::Neame : public DualPriceSmoothingStabilization { | ||
double m_initial_factor; | ||
public: | ||
explicit Neame(double t_initial_factor) : m_initial_factor(t_initial_factor) {} | ||
|
||
class Strategy : public DualPriceSmoothingStabilization::Strategy { | ||
double m_factor; | ||
std::optional<Solution::Dual> m_last_master_dual; | ||
public: | ||
explicit Strategy(double t_initial_factor) : m_factor(t_initial_factor) {} | ||
|
||
void initialize() override { | ||
m_last_master_dual.reset(); | ||
} | ||
|
||
void update_stability_center(const Solution::Dual &t_master_dual) override { | ||
// intentionally left blank | ||
} | ||
|
||
Solution::Dual compute_smoothed_dual_solution(const Solution::Dual &t_master_dual) override { | ||
|
||
if (!m_last_master_dual.has_value() || m_factor <= 1e-4) { | ||
m_last_master_dual = t_master_dual; | ||
return t_master_dual; | ||
} | ||
|
||
auto result = m_factor * m_last_master_dual.value() + (1. - m_factor) * t_master_dual; | ||
|
||
m_last_master_dual = t_master_dual; | ||
|
||
return result; | ||
} | ||
|
||
}; | ||
|
||
DualPriceSmoothingStabilization::Strategy *operator()() const override { | ||
return new Strategy(m_initial_factor); | ||
} | ||
|
||
DualPriceSmoothingStabilization *clone() const override { | ||
return new Neame(*this); | ||
} | ||
}; | ||
|
||
#endif //IDOL_NEAME_H |
45 changes: 45 additions & 0 deletions
45
lib/include/idol/optimizers/dantzig-wolfe/stabilization/NoStabilization.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// | ||
// Created by henri on 31.10.23. | ||
// | ||
|
||
#ifndef IDOL_NOSTABILIZATION_H | ||
#define IDOL_NOSTABILIZATION_H | ||
|
||
#include "DualPriceSmoothingStabilization.h" | ||
|
||
namespace idol::DantzigWolfe { | ||
class NoStabilization; | ||
} | ||
|
||
class idol::DantzigWolfe::NoStabilization : public DualPriceSmoothingStabilization { | ||
public: | ||
explicit NoStabilization() = default; | ||
|
||
class Strategy : public DualPriceSmoothingStabilization::Strategy { | ||
public: | ||
explicit Strategy() = default; | ||
|
||
void initialize() override { | ||
// intentionally left blank | ||
} | ||
|
||
void update_stability_center(const Solution::Dual &t_master_dual) override { | ||
// intentionally left blank | ||
} | ||
|
||
Solution::Dual compute_smoothed_dual_solution(const Solution::Dual &t_master_dual) override { | ||
return t_master_dual; | ||
} | ||
|
||
}; | ||
|
||
DualPriceSmoothingStabilization::Strategy *operator()() const override { | ||
return new Strategy(); | ||
} | ||
|
||
DualPriceSmoothingStabilization *clone() const override { | ||
return new NoStabilization(*this); | ||
} | ||
}; | ||
|
||
#endif //IDOL_NOSTABILIZATION_H |
59 changes: 59 additions & 0 deletions
59
lib/include/idol/optimizers/dantzig-wolfe/stabilization/Wentges.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
// | ||
// Created by henri on 31.10.23. | ||
// | ||
|
||
#ifndef IDOL_WENTGES_H | ||
#define IDOL_WENTGES_H | ||
|
||
#include <optional> | ||
#include "DualPriceSmoothingStabilization.h" | ||
|
||
namespace idol::DantzigWolfe { | ||
class Wentges; | ||
} | ||
|
||
class idol::DantzigWolfe::Wentges : public DualPriceSmoothingStabilization { | ||
double m_initial_factor; | ||
public: | ||
explicit Wentges(double t_initial_factor) : m_initial_factor(t_initial_factor) {} | ||
|
||
class Strategy : public DualPriceSmoothingStabilization::Strategy { | ||
double m_factor; | ||
std::optional<Solution::Dual> m_stability_center; | ||
public: | ||
explicit Strategy(double t_initial_factor) : m_factor(t_initial_factor) {} | ||
|
||
void initialize() override { | ||
m_stability_center.reset(); | ||
} | ||
|
||
void update_stability_center(const Solution::Dual &t_master_dual) override { | ||
m_stability_center = t_master_dual; | ||
} | ||
|
||
Solution::Dual compute_smoothed_dual_solution(const Solution::Dual &t_master_dual) override { | ||
|
||
if (!m_stability_center.has_value() || m_factor <= 1e-4) { | ||
m_stability_center = t_master_dual; | ||
return t_master_dual; | ||
} | ||
|
||
auto result = m_factor * m_stability_center.value() + (1. - m_factor) * t_master_dual; | ||
|
||
m_stability_center = t_master_dual; | ||
|
||
return result; | ||
} | ||
|
||
}; | ||
|
||
DualPriceSmoothingStabilization::Strategy *operator()() const override { | ||
return new Strategy(m_initial_factor); | ||
} | ||
|
||
DualPriceSmoothingStabilization *clone() const override { | ||
return new Wentges(*this); | ||
} | ||
}; | ||
|
||
#endif //IDOL_WENTGES_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters