Skip to content

Commit

Permalink
detect linking constraints
Browse files Browse the repository at this point in the history
  • Loading branch information
hlefebvr committed Dec 11, 2024
1 parent 7bc0073 commit a15d517
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class idol::CCG::Formulation {
Model m_master;
std::vector<Var> m_second_stage_variables;
std::vector<Ctr> m_second_stage_constraints;
std::vector<Ctr> m_linking_constraints;

unsigned int m_n_added_scenario = 0;
std::optional<Var> m_second_stage_epigraph;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,17 @@ void idol::CCG::Formulation::parse_constraints() {

const auto& row = m_parent.get_ctr_row(ctr);

const bool has_first_stage = std::any_of(row.begin(), row.end(), [this](const auto& term) {
return m_description.stage(term.first) == 0;
});
const bool has_second_stage = std::any_of(row.begin(), row.end(), [this](const auto& term) {
return m_description.stage(term.first) > 0;
});

if (has_second_stage || !m_description.uncertain_mat_coeffs(ctr).empty()) {
if (has_first_stage) {
m_linking_constraints.emplace_back(ctr);
}
m_second_stage_constraints.emplace_back(ctr);
continue;
}
Expand Down

0 comments on commit a15d517

Please sign in to comment.