Skip to content

Commit

Permalink
Fix recently introduced build warnings (#2569)
Browse files Browse the repository at this point in the history
  • Loading branch information
flomnes authored Jan 15, 2025
1 parent fe48071 commit 600b914
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 35 deletions.
16 changes: 10 additions & 6 deletions src/solver/optimisation/opt_optimisation_lineaire.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,29 +67,33 @@ void OPT_WriteSolution(const PROBLEME_ANTARES_A_RESOUDRE& pb,
int optimizationNumber,
Solver::IResultWriter& writer)
{
auto s = [](int x) { return static_cast<size_t>(x); };

Yuni::Clob buffer;
auto filename = createSolutionFilename(optPeriodStringGenerator, optimizationNumber);
for (int var = 0; var < pb.NombreDeVariables; var++)
{
buffer.appendFormat("%s\t%11.10e\n", pb.NomDesVariables[var].c_str(), pb.X[var]);
buffer.appendFormat("%s\t%11.10e\n", pb.NomDesVariables[s(var)].c_str(), pb.X[s(var)]);
}
writer.addEntryFromBuffer(filename, buffer);
buffer.clear();

filename = createMarginalCostFilename(optPeriodStringGenerator, optimizationNumber);
for (unsigned int cont = 0; cont < pb.NombreDeContraintes; ++cont)
for (int cont = 0; cont < pb.NombreDeContraintes; ++cont)
{
buffer.appendFormat("%s\t%11.10e\n",
pb.NomDesContraintes[cont].c_str(),
pb.CoutsMarginauxDesContraintes[cont]);
pb.NomDesContraintes[s(cont)].c_str(),
pb.CoutsMarginauxDesContraintes[s(cont)]);
}
writer.addEntryFromBuffer(filename, buffer);
buffer.clear();

filename = createReducedCostFilename(optPeriodStringGenerator, optimizationNumber);
for (unsigned int var = 0; var < pb.NombreDeVariables; ++var)
for (int var = 0; var < pb.NombreDeVariables; ++var)
{
buffer.appendFormat("%s\t%11.10e\n", pb.NomDesVariables[var].c_str(), pb.CoutsReduits[var]);
buffer.appendFormat("%s\t%11.10e\n",
pb.NomDesVariables[s(var)].c_str(),
pb.CoutsReduits[s(var)]);
}
writer.addEntryFromBuffer(filename, buffer);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,30 +63,29 @@ struct VCardPriceCSR
//! The VCard to look for for calculating spatial aggregates
typedef VCardPrice VCardForSpatialAggregate;

enum
{
//! Data Level
categoryDataLevel = Category::DataLevel::area,
//! File level (provided by the type of the results)
categoryFileLevel = ResultsType::categoryFile
& (Category::FileLevel::id | Category::FileLevel::va),
//! Precision (views)
precision = Category::all,
//! Indentation (GUI)
nodeDepthForGUI = +0,
//! Decimal precision
decimal = 2,
//! Number of columns used by the variable (One ResultsType per column)
columnCount = 1,
//! The Spatial aggregation
spatialAggregate = Category::spatialAggregateAverage,
spatialAggregateMode = Category::spatialAggregateEachYear,
spatialAggregatePostProcessing = Category::spatialAggregatePostProcessingPrice,
//! Intermediate values
hasIntermediateValues = 1,
//! Can this variable be non applicable (0 : no, 1 : yes)
isPossiblyNonApplicable = 0,
};
//! Data Level
static constexpr uint8_t categoryDataLevel = Category::DataLevel::area;
//! File level (provided by the type of the results)
static constexpr uint8_t categoryFileLevel = ResultsType::categoryFile
& (Category::FileLevel::id
| Category::FileLevel::va);
//! Precision (views)
static constexpr uint8_t precision = Category::all;
//! Indentation (GUI)
static constexpr uint8_t nodeDepthForGUI = +0;
//! Decimal precision
static constexpr uint8_t decimal = 2;
//! Number of columns used by the variable (One ResultsType per column)
static constexpr int columnCount = 1;
//! The Spatial aggregation
static constexpr uint8_t spatialAggregate = Category::spatialAggregateAverage;
static constexpr uint8_t spatialAggregateMode = Category::spatialAggregateEachYear;
static constexpr uint8_t spatialAggregatePostProcessing = Category::
spatialAggregatePostProcessingPrice;
//! Intermediate values
static constexpr uint8_t hasIntermediateValues = 1;
//! Can this variable be non applicable (0 : no, 1 : yes)
static constexpr uint8_t isPossiblyNonApplicable = 0;

typedef IntermediateValues IntermediateValuesBaseType;
typedef IntermediateValues* IntermediateValuesType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -661,7 +661,7 @@ BOOST_AUTO_TEST_CASE(loadAdditionalConstraints_ValidRhs)
iniFile.close();

std::ofstream rhsFile(testPath / "rhs_constraint1.txt");
for (int i = 0; i < HOURS_PER_YEAR; ++i)
for (unsigned int i = 0; i < HOURS_PER_YEAR; ++i)
{
rhsFile << i * 1.0 << "\n";
}
Expand Down Expand Up @@ -704,7 +704,7 @@ BOOST_AUTO_TEST_CASE(Load2ConstraintsFromIniFile)
iniFile.close();

std::ofstream rhsFile(testPath / "rhs_constraint1.txt");
for (int i = 0; i < HOURS_PER_YEAR; ++i)
for (unsigned int i = 0; i < HOURS_PER_YEAR; ++i)
{
rhsFile << i * 1.0 << "\n";
}
Expand Down Expand Up @@ -882,7 +882,7 @@ BOOST_DATA_TEST_CASE(Validate_AllVariableOperatorCombinationsFromFile,

// Write the `rhs_constraint1.txt` file
std::ofstream rhsFile(testPath / "rhs_constraint1.txt");
for (int i = 0; i < HOURS_PER_YEAR; ++i)
for (unsigned int i = 0; i < HOURS_PER_YEAR; ++i)
{
rhsFile << i * 1.0 << "\n";
}
Expand Down Expand Up @@ -911,7 +911,7 @@ BOOST_DATA_TEST_CASE(Validate_AllVariableOperatorCombinationsFromFile,
BOOST_CHECK_EQUAL(loadedConstraint.operatorType, op);
BOOST_REQUIRE_EQUAL(loadedConstraint.rhs.size(), HOURS_PER_YEAR);

int i = 0;
unsigned int i = 0;
do
{
BOOST_CHECK_CLOSE(loadedConstraint.rhs[i], i * 1.0, 0.001);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ void LinearProblemBuildingFixture::createModel(string modelId,
{
Antares::Solver::NodeRegistry node_registry(node, move(nodes));
Expression expression("expression", move(node_registry));
return move(expression);
return expression;
};
vector<Parameter> parameters;
for (auto parameter_id: parameterIds)
Expand Down

0 comments on commit 600b914

Please sign in to comment.