Skip to content

Commit

Permalink
FIX: move quadratic constraints when moving Model
Browse files Browse the repository at this point in the history
  • Loading branch information
hlefebvr committed Dec 5, 2024
1 parent fd99d49 commit 0ead390
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class idol::CtrVersion : public Version {

void set_row(LinExpr<Var>&& t_row) { m_lhs = std::make_unique<LinExpr<Var>>(std::move(t_row)); }

bool has_row() const { return m_lhs != nullptr; }
bool has_row() const { return m_lhs.operator bool(); }

void set_row(const LinExpr<Var>& t_row) { m_lhs = std::make_unique<LinExpr<Var>>(t_row); }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class idol::VarVersion : public Version {

void set_column(LinExpr<Ctr>&& t_column) { m_column = std::make_unique<LinExpr<Ctr>>(std::move(t_column)); }

bool has_column() const { return m_column != nullptr; }
bool has_column() const { return m_column.operator bool(); }

void set_column(const LinExpr<Ctr>& t_column) { m_column = std::make_unique<LinExpr<Ctr>>(t_column); }

Expand Down
1 change: 1 addition & 0 deletions lib/src/bilevel/optimizers/StrongDuality/StrongDuality.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
//
// Created by henri on 29.11.24.
//
#include <cassert>
#include "idol/bilevel/optimizers/StrongDuality/StrongDuality.h"
#include "idol/bilevel/optimizers/StrongDuality/Optimizers_StrongDuality.h"
#include "idol/mixed-integer/modeling/models/KKT.h"
Expand Down
1 change: 1 addition & 0 deletions lib/src/mixed-integer/modeling/models/Model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ idol::Model::Model(idol::Model && t_src) noexcept
m_sense(t_src.m_sense),
m_variables(std::move(t_src.m_variables)),
m_constraints(std::move(t_src.m_constraints)),
m_qconstraints(std::move(t_src.m_qconstraints)),
m_optimizer_factory(std::move(t_src.m_optimizer_factory)),
m_objective(std::move(t_src.m_objective)),
m_rhs(std::move(t_src.m_rhs)),
Expand Down
5 changes: 3 additions & 2 deletions lib/src/mixed-integer/optimizers/padm/Optimizers_PADM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -380,11 +380,12 @@ idol::Optimizers::PADM::solve_sub_problem(unsigned int t_sub_problem_id) {

auto& sub_problem = m_formulation.sub_problem(t_sub_problem_id);


//sub_problem.model.write("sub_problem_" + std::to_string(t_sub_problem_id) + "_" + std::to_string(m_outer_loop_iteration) + "_" + std::to_string(m_inner_loop_iterations) + ".lp");

sub_problem.model.optimizer().set_param_time_limit(get_remaining_time());
sub_problem.model.optimize();

//sub_problem.model.write("iter_" + std::to_string(m_outer_loop_iteration) + "_" + std::to_string(m_inner_loop_iterations) + ".sub_problem_" + std::to_string(t_sub_problem_id) + ".lp");

const auto status = sub_problem.model.get_status();

if (status != Optimal && status != Feasible) {
Expand Down

0 comments on commit 0ead390

Please sign in to comment.