-
-
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.
- Loading branch information
Showing
10 changed files
with
154 additions
and
27 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
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
5 changes: 5 additions & 0 deletions
5
lib/include/idol/optimizers/mixed-integer-optimization/padm/PenaltyUpdates.cpp
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,5 @@ | ||
// | ||
// Created by henri on 19.09.24. | ||
// | ||
|
||
#include "PenaltyUpdates.h" |
55 changes: 55 additions & 0 deletions
55
lib/include/idol/optimizers/mixed-integer-optimization/padm/PenaltyUpdates.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,55 @@ | ||
// | ||
// Created by henri on 19.09.24. | ||
// | ||
|
||
#ifndef IDOL_PENALTYUPDATES_H | ||
#define IDOL_PENALTYUPDATES_H | ||
|
||
namespace idol { | ||
class PenaltyUpdate; | ||
|
||
namespace PenaltyUpdates { | ||
class Additive; | ||
class Multiplicative; | ||
} | ||
} | ||
|
||
class idol::PenaltyUpdate { | ||
public: | ||
virtual ~PenaltyUpdate() = default; | ||
|
||
virtual double operator()(double t_current_penalty) = 0; | ||
|
||
virtual PenaltyUpdate* clone() const = 0; | ||
}; | ||
|
||
class idol::PenaltyUpdates::Additive : public PenaltyUpdate { | ||
double m_increment; | ||
public: | ||
explicit Additive(double t_increment) : m_increment(t_increment) {} | ||
|
||
double operator()(double t_current_penalty) override { | ||
return t_current_penalty + m_increment; | ||
} | ||
|
||
PenaltyUpdate* clone() const override { | ||
return new Additive(*this); | ||
} | ||
}; | ||
|
||
class idol::PenaltyUpdates::Multiplicative : public PenaltyUpdate { | ||
double m_factor; | ||
public: | ||
explicit Multiplicative(double t_factor) : m_factor(t_factor) {} | ||
|
||
double operator()(double t_current_penalty) override { | ||
return t_current_penalty * m_factor; | ||
} | ||
|
||
PenaltyUpdate* clone() const override { | ||
return new Multiplicative(*this); | ||
} | ||
}; | ||
|
||
|
||
#endif //IDOL_PENALTYUPDATES_H |