Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix warnings #929

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/cpp/benders/benders_core/BendersBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,6 @@ void BendersBase::ComputeXCut() {
void BendersBase::ComputeInvestCost() {
_data.invest_cost = 0;

int ncols = _master->_solver->get_ncols();
std::vector<double> obj(MasterObjectiveFunctionCoeffs());

for (const auto &[col_name, value] : _data.x_cut) {
Expand Down
1 change: 0 additions & 1 deletion src/cpp/benders/factories/BendersFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,6 @@ int BendersMainFactory::RunExternalLoop() const {
&criterion_computation);

double tau = 0.5;
double epsilon_lambda = 0.1;

std::shared_ptr<Outerloop::IMasterUpdate> master_updater =
std::make_shared<Outerloop::MasterUpdateBase>(
Expand Down
3 changes: 2 additions & 1 deletion src/cpp/helpers/ArchiveWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ int32_t ArchiveWriter::AddFileInArchive(const FileBuffer& FileBufferToAdd) {
}
const auto len = FileBufferToAdd.buffer.size();
auto bw = mz_zip_writer_entry_write(pmz_zip_writer_instance_,
FileBufferToAdd.buffer.c_str(), len);
FileBufferToAdd.buffer.c_str(),
static_cast<int32_t>(len));
if (bw != len) {
Close();
Delete();
Expand Down
18 changes: 9 additions & 9 deletions src/cpp/lpnamer/model/Candidate.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,21 @@
struct CandidateData {
bool enable = true;

std::string link_name;
int link_id;
std::string linkor;
std::string linkex;
std::string installed_direct_link_profile_name;
std::string installed_indirect_link_profile_name;
std::string link_name = "";
int link_id = 0;
std::string linkor = "";
std::string linkex = "";
std::string installed_direct_link_profile_name = "";
std::string installed_indirect_link_profile_name = "";
double already_installed_capacity = 1.0;

std::string name;
std::string name = "";
double annual_cost_per_mw = 0.0;
double max_investment = 0.0;
double unit_size = 0.0;
double max_units = 0.0;
std::string direct_link_profile;
std::string indirect_link_profile;
std::string direct_link_profile = "";
std::string indirect_link_profile = "";
};

/*!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@ AntaresProblemToXpansionProblemTranslator::translateToXpansionProblem(
convertSignToLEG(hebdo->Sens.data()).data(), hebdo->SecondMembre.data(),
{}, constant->Mdeb.data(), constant->IndicesColonnes.data(),
constant->CoefficientsDeLaMatriceDesContraintes.data());
auto rows = problem->get_nrows();
auto cols = problem->get_ncols();
auto elem = problem->get_nelems();
// On peut ajouter la partie qui renomme les variables ici si on stocke les
// données du type de variables dans ConstantDataFromAntares, i.e. en
// définissant une autre implémentation de IProblemVariablesProviderPort
Expand Down
1 change: 0 additions & 1 deletion src/cpp/multisolver_interface/SolverCbc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@ void SolverCbc::write_prob_mps(const std::filesystem::path &filename) {
}

{
auto mcol = _clp_inner_solver.getMatrixByCol();
auto col = *(_clp_inner_solver.getMatrixByCol());
auto infinity = _clp_inner_solver.getInfinity();
writer.setMpsData(
Expand Down
38 changes: 19 additions & 19 deletions src/cpp/xpansion_interfaces/ILogger.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,25 +46,25 @@ inline std::string criterion_to_str(
}

struct LogData {
double lb;
double best_ub;
double ub;
int it;
int best_it;
double subproblem_cost;
double invest_cost;
LogPoint x_in;
LogPoint x_out;
LogPoint x_cut;
LogPoint min_invest;
LogPoint max_invest;
double optimality_gap;
double relative_gap;
int max_iterations;
double benders_elapsed_time;
double master_time;
double subproblem_time;
int cumulative_number_of_subproblem_resolved;
double lb = 0.;
double best_ub = 0.;
double ub = 0.;
int it = 0;
int best_it = 0;
double subproblem_cost = 0.;
double invest_cost = 0.;
LogPoint x_in = {};
LogPoint x_out = {};
LogPoint x_cut = {};
LogPoint min_invest = {};
LogPoint max_invest = {};
double optimality_gap = 0.;
double relative_gap = 0.;
int max_iterations = 0;
double benders_elapsed_time = 0.;
double master_time = 0.;
double subproblem_time = 0.;
int cumulative_number_of_subproblem_resolved = 0;
};

/**
Expand Down
60 changes: 32 additions & 28 deletions src/cpp/xpansion_interfaces/OutputWriter.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,26 +27,28 @@ const std::string ANTARES_C("antares"), VERSION_C("version"),
PROBLEMPATH_C("problem_path"),
CUMULATIVE_NUMBER_OF_SUBPROBLEM_RESOLVED_C(
"cumulative_number_of_subproblem_resolutions");

struct CandidateData {
std::string name;
double invest;
double min;
double max;
std::string name = "";
double invest = 0.;
double min = 0.;
double max = 0.;
};

typedef std::vector<CandidateData> CandidatesVec;
struct Iteration {
double master_duration;
double subproblem_duration;
double lb;
double ub;
double best_ub;
double optimality_gap;
double relative_gap;
double investment_cost;
double operational_cost;
double overall_cost;
CandidatesVec candidates;
int cumulative_number_of_subproblem_resolved;
double master_duration = 0.;
double subproblem_duration = 0.;
double lb = 0.;
double ub = 0.;
double best_ub = 0.;
double optimality_gap = 0.;
double relative_gap = 0.;
double investment_cost = 0.;
double operational_cost = 0.;
double overall_cost = 0.;
CandidatesVec candidates = {};
int cumulative_number_of_subproblem_resolved = 0;
};
typedef std::vector<Iteration> Iterations;
/*!
Expand All @@ -56,11 +58,11 @@ typedef std::vector<Iteration> Iterations;
* solution : solution data as iteration
*/
struct SolutionData {
Iteration solution;
int nbWeeks_p;
int best_it;
std::string problem_status;
std::string stopping_criterion;
Iteration solution = {};
int nbWeeks_p = 0;
int best_it = 0;
std::string problem_status = "";
std::string stopping_criterion = "";
};
/*!
* \brief struct containing some entries to be later written to the json file
Expand All @@ -73,16 +75,18 @@ struct SolutionData {
* max_iter : maximum number of iterations
*/
struct IterationsData {
int nbWeeks_p;
double elapsed_time;
Iterations iters;
SolutionData solution_data;
int nbWeeks_p = 0;
double elapsed_time = 0;
Iterations iters = {};
SolutionData solution_data = {};
};

struct ProblemData {
std::string name;
std::filesystem::path path;
std::string status;
std::string name = "";
std::filesystem::path path = "";
std::string status = "";
};

/*!
* \class OutputWriter
* \brief OutputWriter class to describe the execuion session of an antares
Expand Down
8 changes: 0 additions & 8 deletions tests/cpp/logger/logger_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -949,14 +949,11 @@ TEST(MathLoggerBendersByBatchTest, DataInFileLong) {
}

TEST(MathLoggerBendersByBatchTest, DataInStdOutShort) {
HEADERSTYPE headers_type = HEADERSTYPE::SHORT;
std::streamsize width = 25;

CurrentIterationData data;
data.it = 35;
data.lb = 256999;
// data.ub = 222256999;
// data.best_ub = 222256999;
data.min_simplexiter = 3;
data.max_simplexiter = 30;
data.number_of_subproblem_solved = 657;
Expand All @@ -965,8 +962,6 @@ TEST(MathLoggerBendersByBatchTest, DataInStdOutShort) {
data.timer_master = 10;
data.subproblems_walltime = 16;
data.subproblems_cumulative_cputime = 160;
auto time_not_solving =
data.iteration_time - data.timer_master - data.subproblems_walltime;

std::ostringstream expected_msg;
expected_msg << std::left << std::setw(width) << data.it;
Expand Down Expand Up @@ -1055,7 +1050,6 @@ TEST(MathLoggerBendersBaseTest, DataInFileLong) {
}

TEST(MathLoggerBendersBaseTest, DataInStdOutShort) {
HEADERSTYPE headers_type = HEADERSTYPE::SHORT;
std::streamsize width = 25;

CurrentIterationData data;
Expand All @@ -1071,8 +1065,6 @@ TEST(MathLoggerBendersBaseTest, DataInStdOutShort) {
data.timer_master = 10;
data.subproblems_walltime = 16;
data.subproblems_cumulative_cputime = 160;
auto time_not_solving =
data.iteration_time - data.timer_master - data.subproblems_walltime;

std::ostringstream expected_msg;
expected_msg << std::left << std::setw(width) << data.it;
Expand Down
2 changes: 0 additions & 2 deletions tests/cpp/lp_namer/ProblemModifierTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -701,7 +701,6 @@ TEST_F(ProblemModifierTest, candidateWithNullProfileIsRemoved) {
p_direct_cost_columns,
p_indirect_cost_columns);

const int cand1_id = -1;

ASSERT_THROW(problem_modifier.get_candidate_col_id(cand1.name),
std::runtime_error);
Expand Down Expand Up @@ -936,7 +935,6 @@ TEST_F(ProblemModifierTestMultiChronicle, candidateWithNotNullProfileExists) {
p_direct_cost_columns,
p_indirect_cost_columns);

const int cand1_id = 3;

ASSERT_TRUE(problem_modifier.has_candidate_col_id(cand1.name));
}
Expand Down
1 change: 0 additions & 1 deletion tests/cpp/outer_loop/outer_loop_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,6 @@ TEST_P(MasterUpdateBaseTest, ConstraintIsAddedBendersMPI) {
// get added constraint infos (coeff, sign & rhs)
std::vector<int> mstart(1 + 1);
auto n_elems = benders->MasterGetNElems();
auto nnz = master_variables.size();
std::vector<int> mclind(n_elems);
std::vector<double> matval(n_elems);
std::vector<int> p_nels(1, 0);
Expand Down
8 changes: 4 additions & 4 deletions tests/cpp/zip_mps/zip_mps_lib_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,17 +139,17 @@ void compareArchiveAndDir(const std::filesystem::path& archivePath,
reader = mz_zip_reader_create();
const auto& archive_path_str = archivePath.string();
auto archive_path_c_str = archive_path_str.c_str();
assert(mz_zip_reader_open_file(reader, archive_path_c_str) == MZ_OK);
ASSERT_EQ(mz_zip_reader_open_file(reader, archive_path_c_str), MZ_OK);

for (const auto& file : std::filesystem::directory_iterator(dirPath)) {
const auto& filename_path = file.path().filename();
const auto& filename_str = filename_path.string();
const auto searchFilename = filename_str.c_str();
assert(mz_zip_reader_locate_entry(reader, searchFilename, 1) == MZ_OK);
assert(mz_zip_reader_entry_open(reader) == MZ_OK);
ASSERT_EQ(mz_zip_reader_locate_entry(reader, searchFilename, 1), MZ_OK);
ASSERT_EQ(mz_zip_reader_entry_open(reader), MZ_OK);
const auto extractedFilePath = tmpDir / searchFilename;
mz_zip_reader_entry_save_file(reader, extractedFilePath.string().c_str());
assert(equal_files(extractedFilePath, file.path()));
ASSERT_TRUE(equal_files(extractedFilePath, file.path()));
}
mz_zip_reader_close(reader);
mz_zip_reader_delete(&reader);
Expand Down
Loading