Skip to content

Commit

Permalink
Print the dimensions of the original (AMPL) model and of the reformul…
Browse files Browse the repository at this point in the history
…ated problem
  • Loading branch information
cvanaret committed Oct 27, 2024
1 parent 2ea6cc5 commit 9a8d4ed
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
4 changes: 4 additions & 0 deletions bindings/AMPL/uno_ampl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ namespace uno {
try {
// AMPL model
std::unique_ptr<Model> ampl_model = std::make_unique<AMPLModel>(model_name, options);
DISCRETE << "Original model " << ampl_model->name << '\n' << ampl_model->number_variables << " variables, " <<
ampl_model->number_constraints << " constraints\n";

// initialize initial primal and dual points
Iterate initial_iterate(ampl_model->number_variables, ampl_model->number_constraints);
Expand All @@ -39,6 +41,8 @@ namespace uno {

// reformulate (scale, add slacks, relax the bounds, ...) if necessary
std::unique_ptr<Model> model = ModelFactory::reformulate(std::move(ampl_model), initial_iterate, options);
DISCRETE << "Reformulated model " << model->name << '\n' << model->number_variables << " variables, " <<
model->number_constraints << " constraints\n";

// create the constraint relaxation strategy, the globalization mechanism and the Uno solver
auto constraint_relaxation_strategy = ConstraintRelaxationStrategyFactory::create(*model, options);
Expand Down
2 changes: 0 additions & 2 deletions uno/Uno.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ namespace uno {
Level Logger::level = INFO;

Result Uno::solve(const Model& model, Iterate& current_iterate, const Options& options) {
DISCRETE << "Problem " << model.name << '\n' << model.number_variables << " variables, " << model.number_constraints << " constraints\n";

Timer timer{};
Statistics statistics = Uno::create_statistics(model, options);

Expand Down
2 changes: 1 addition & 1 deletion uno/options/Options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ namespace uno {
}
// print the overwritten options
if (number_used_options > 0) {
DISCRETE << "Used overwritten options:\n" << option_list << '\n';
DISCRETE << "\nUsed overwritten options:\n" << option_list << '\n';
}
}

Expand Down
2 changes: 1 addition & 1 deletion uno/preprocessing/Preprocessing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ namespace uno {

void Preprocessing::enforce_linear_constraints(const Model& model, Vector<double>& x, Multipliers& multipliers, QPSolver& qp_solver) {
const auto& linear_constraints = model.get_linear_constraints();
INFO << "Preprocessing phase: the problem has " << linear_constraints.size() << " linear constraints\n";
INFO << "\nPreprocessing phase: the problem has " << linear_constraints.size() << " linear constraints\n";
if (not linear_constraints.empty()) {
// evaluate the constraints
std::vector<double> constraints(model.number_constraints);
Expand Down

0 comments on commit 9a8d4ed

Please sign in to comment.