Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
JasonMarechal25 committed Jan 11, 2023
2 parents 5711f82 + 24e8d5b commit fac708a
Show file tree
Hide file tree
Showing 94 changed files with 989 additions and 986 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/centos7.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ jobs:
- name: Solver archive creation
run: |
cd _build
tar czf solver_ubuntu20.04.tar.gz solver/antares-*-solver solver/libsirius_solver.so
tar czf antares-solver_centos7.tar.gz solver/antares-*-solver solver/libsirius_solver.so
- name: .tar.gz creation
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ jobs:
- name: Solver archive creation
run: |
cd _build
tar czf solver_centos7.tar.gz solver/antares-*-solver solver/libsirius_solver.so
tar czf antares-solver_ubuntu20.04.tar.gz solver/antares-*-solver solver/libsirius_solver.so
- name: Installer archive upload push
uses: actions/upload-artifact@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/windows-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ jobs:
shell: bash
run: |
cd _build
zip -r solver_win.zip solver/Release/antares-*-solver.exe solver/Release/*.dll
zip -r antares-solver_windows.zip solver/Release/antares-*-solver.exe solver/Release/*.dll
- name: NSIS Installer creation
shell: bash
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/windows-vcpkg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ jobs:
shell: bash
run: |
cd _build
zip -r solver_win.zip solver/Release/antares-*-solver.exe solver/Release/*.dll
zip -r antares-solver_windows.zip solver/Release/antares-*-solver.exe solver/Release/*.dll
- name: NSIS Installer creation
shell: bash
Expand Down
3 changes: 2 additions & 1 deletion src/ext/yuni/src/yuni/core/string/iterator.inc.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,8 @@ struct Model
{
do
{
if (pChar == (uint)' ' || pChar == (uint)'\t' || pChar == (uint)'\n' || pChar == (uint)'\r')
if (pChar == (uint)' ' || pChar == (uint)'\t' || pChar == (uint)'\n'
|| pChar == (uint)'\r')
{
forward();
if (pOffset >= end)
Expand Down
1 change: 0 additions & 1 deletion src/ext/yuni/src/yuni/thread/utility.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ class Taskgroup;

namespace Yuni
{

/*!
** \brief Convenient wrapper for executing some code every X milliseconds
**
Expand Down
2 changes: 0 additions & 2 deletions src/libs/antares/array/matrix.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -1267,7 +1267,6 @@ void Matrix<T, ReadWriteT>::resizeWithoutDataLost(uint x, uint y, const T& defVa

for (uint j = minH; j < y; ++j)
column[j] = defVal;

}

if (defVal == T())
Expand Down Expand Up @@ -1423,7 +1422,6 @@ void Matrix<T, ReadWriteT>::copyFrom(const Matrix<U, V>& rhs)
// optimisations
if (Yuni::Static::Type::StrictlyEqual<T, U>::Yes)
{

(void)::memcpy((void*)column, (void*)src, sizeof(T) * height);
}
else
Expand Down
298 changes: 150 additions & 148 deletions src/libs/antares/benchmarking/info_collectors.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,161 +8,163 @@ using namespace Antares::Data;

namespace Benchmarking
{
// Collecting data study
// ---------------------------
void StudyInfoCollector::toFileContent(FileContent& file_content)
{
areasCountToFileContent(file_content);
linksCountToFileContent(file_content);
performedYearsCountToFileContent(file_content);
enabledThermalClustersCountToFileContent(file_content);
enabledBindingConstraintsCountToFileContent(file_content);
unitCommitmentModeToFileContent(file_content);
maxNbYearsInParallelToFileContent(file_content);
solverVersionToFileContent(file_content);
ORToolsUsed(file_content);
ORToolsSolver(file_content);
}

void StudyInfoCollector::areasCountToFileContent(FileContent& file_content)
{
file_content.addItemToSection("study", "areas", study_.areas.size());
}

void StudyInfoCollector::linksCountToFileContent(FileContent& file_content)
{
file_content.addItemToSection("study", "links", study_.areas.areaLinkCount());
}

void StudyInfoCollector::performedYearsCountToFileContent(FileContent& file_content)
{
// Computing the number of performed years
unsigned int nbPerformedYears = 0;
for (uint i = 0; i < study_.parameters.nbYears; i++)
{
if (study_.parameters.yearsFilter[i])
nbPerformedYears++;
}

// Adding an item related to number of performed years to the file content
file_content.addItemToSection("study", "performed years", nbPerformedYears);
}

void StudyInfoCollector::enabledThermalClustersCountToFileContent(FileContent& file_content)
{
// Computing the number of enabled thermal clusters
unsigned int nbEnabledThermalClusters = 0;

auto end = study_.areas.end();
for (auto i = study_.areas.begin(); i != end; ++i)
{
Area& area = *(i->second);
auto end = area.thermal.list.end();
for (auto i = area.thermal.list.begin(); i != end; ++i)
{
auto& cluster = i->second;
if (cluster->enabled)
nbEnabledThermalClusters++;
}
}

// Adding an item related to number of enabled thermal clusters to the file content
file_content.addItemToSection("study", "enabled thermal clusters", nbEnabledThermalClusters);
}

void StudyInfoCollector::enabledBindingConstraintsCountToFileContent(FileContent& file_content)
{
unsigned int nbEnabledBC = study_.runtime->bindingConstraintCount;
unsigned int nbEnabledHourlyBC(0), nbEnabledDailyBC(0), nbEnabledWeeklyBC(0);

for (uint i = 0; i < nbEnabledBC; i++)
{
switch (study_.runtime->bindingConstraint[i].type)
{
case BindingConstraint::Type::typeHourly:
nbEnabledHourlyBC++;
break;
case BindingConstraint::Type::typeDaily:
nbEnabledDailyBC++;
break;
case BindingConstraint::Type::typeWeekly:
nbEnabledWeeklyBC++;
break;
default:
break;
}
}

file_content.addItemToSection("study", "enabled BC", nbEnabledBC);
file_content.addItemToSection("study", "enabled hourly BC", nbEnabledHourlyBC);
file_content.addItemToSection("study", "enabled daily BC", nbEnabledDailyBC);
file_content.addItemToSection("study", "enabled weekly BC", nbEnabledWeeklyBC);
}

void StudyInfoCollector::unitCommitmentModeToFileContent(FileContent& file_content)
{
const char* unitCommitment = UnitCommitmentModeToCString(study_.parameters.unitCommitment.ucMode);
file_content.addItemToSection("study", "unit commitment", unitCommitment);
}

void StudyInfoCollector::maxNbYearsInParallelToFileContent(FileContent& file_content)
{
file_content.addItemToSection("study", "max parallel years", study_.maxNbYearsInParallel);
}

void StudyInfoCollector::solverVersionToFileContent(FileContent& file_content)
{
// Example : 8.3.0 -> 830
const unsigned int version
= 100 * ANTARES_VERSION_HI + 10 * ANTARES_VERSION_LO + ANTARES_VERSION_BUILD;

file_content.addItemToSection("study", "antares version", version);
}

void StudyInfoCollector::ORToolsUsed(FileContent& file_content)
// Collecting data study
// ---------------------------
void StudyInfoCollector::toFileContent(FileContent& file_content)
{
areasCountToFileContent(file_content);
linksCountToFileContent(file_content);
performedYearsCountToFileContent(file_content);
enabledThermalClustersCountToFileContent(file_content);
enabledBindingConstraintsCountToFileContent(file_content);
unitCommitmentModeToFileContent(file_content);
maxNbYearsInParallelToFileContent(file_content);
solverVersionToFileContent(file_content);
ORToolsUsed(file_content);
ORToolsSolver(file_content);
}

void StudyInfoCollector::areasCountToFileContent(FileContent& file_content)
{
file_content.addItemToSection("study", "areas", study_.areas.size());
}

void StudyInfoCollector::linksCountToFileContent(FileContent& file_content)
{
file_content.addItemToSection("study", "links", study_.areas.areaLinkCount());
}

void StudyInfoCollector::performedYearsCountToFileContent(FileContent& file_content)
{
// Computing the number of performed years
unsigned int nbPerformedYears = 0;
for (uint i = 0; i < study_.parameters.nbYears; i++)
{
const bool& ortoolsUsed = study_.parameters.ortoolsUsed;
file_content.addItemToSection("study", "ortools used", ortoolsUsed ? "true" : "false");
if (study_.parameters.yearsFilter[i])
nbPerformedYears++;
}

void StudyInfoCollector::ORToolsSolver(FileContent& file_content)
// Adding an item related to number of performed years to the file content
file_content.addItemToSection("study", "performed years", nbPerformedYears);
}

void StudyInfoCollector::enabledThermalClustersCountToFileContent(FileContent& file_content)
{
// Computing the number of enabled thermal clusters
unsigned int nbEnabledThermalClusters = 0;

auto end = study_.areas.end();
for (auto i = study_.areas.begin(); i != end; ++i)
{
const bool& ortoolsUsed = study_.parameters.ortoolsUsed;
std::string ortoolsSolver = "none";
if (ortoolsUsed)
Area& area = *(i->second);
auto end = area.thermal.list.end();
for (auto i = area.thermal.list.begin(); i != end; ++i)
{
ortoolsSolver = study_.parameters.ortoolsSolver;
auto& cluster = i->second;
if (cluster->enabled)
nbEnabledThermalClusters++;
}
file_content.addItemToSection("study", "ortools solver", ortoolsSolver);
}

// Collecting data optimization problem
// -------------------------------------
void SimulationInfoCollector::toFileContent(FileContent& file_content)
{
file_content.addItemToSection("optimization problem", "variables", opt_info_.nbVariables);
file_content.addItemToSection("optimization problem", "constraints", opt_info_.nbConstraints);
file_content.addItemToSection("optimization problem", "non-zero coefficients", opt_info_.nbNonZeroCoeffs);
}

// Collecting durations from simulation
// -------------------------------------
void DurationCollector::toFileContent(FileContent& file_content)
{
for (const auto& element : duration_items_)
{
const std::string& name = element.first;
const auto& durations = element.second;
const int64_t duration_sum = accumulate(durations.begin(), durations.end(), (int64_t)0);

file_content.addDurationItem(name, (unsigned int)duration_sum, (int)durations.size());
}
}

void DurationCollector::addDuration(const std::string& name, int64_t duration)
{
const std::lock_guard<std::mutex> lock(mutex_);
duration_items_[name].push_back(duration);
}
// Adding an item related to number of enabled thermal clusters to the file content
file_content.addItemToSection("study", "enabled thermal clusters", nbEnabledThermalClusters);
}

void StudyInfoCollector::enabledBindingConstraintsCountToFileContent(FileContent& file_content)
{
unsigned int nbEnabledBC = study_.runtime->bindingConstraintCount;
unsigned int nbEnabledHourlyBC(0), nbEnabledDailyBC(0), nbEnabledWeeklyBC(0);

for (uint i = 0; i < nbEnabledBC; i++)
{
switch (study_.runtime->bindingConstraint[i].type)
{
case BindingConstraint::Type::typeHourly:
nbEnabledHourlyBC++;
break;
case BindingConstraint::Type::typeDaily:
nbEnabledDailyBC++;
break;
case BindingConstraint::Type::typeWeekly:
nbEnabledWeeklyBC++;
break;
default:
break;
}
}

file_content.addItemToSection("study", "enabled BC", nbEnabledBC);
file_content.addItemToSection("study", "enabled hourly BC", nbEnabledHourlyBC);
file_content.addItemToSection("study", "enabled daily BC", nbEnabledDailyBC);
file_content.addItemToSection("study", "enabled weekly BC", nbEnabledWeeklyBC);
}

void StudyInfoCollector::unitCommitmentModeToFileContent(FileContent& file_content)
{
const char* unitCommitment
= UnitCommitmentModeToCString(study_.parameters.unitCommitment.ucMode);
file_content.addItemToSection("study", "unit commitment", unitCommitment);
}

void StudyInfoCollector::maxNbYearsInParallelToFileContent(FileContent& file_content)
{
file_content.addItemToSection("study", "max parallel years", study_.maxNbYearsInParallel);
}

void StudyInfoCollector::solverVersionToFileContent(FileContent& file_content)
{
// Example : 8.3.0 -> 830
const unsigned int version
= 100 * ANTARES_VERSION_HI + 10 * ANTARES_VERSION_LO + ANTARES_VERSION_BUILD;

file_content.addItemToSection("study", "antares version", version);
}

void StudyInfoCollector::ORToolsUsed(FileContent& file_content)
{
const bool& ortoolsUsed = study_.parameters.ortoolsUsed;
file_content.addItemToSection("study", "ortools used", ortoolsUsed ? "true" : "false");
}

void StudyInfoCollector::ORToolsSolver(FileContent& file_content)
{
const bool& ortoolsUsed = study_.parameters.ortoolsUsed;
std::string ortoolsSolver = "none";
if (ortoolsUsed)
{
ortoolsSolver = study_.parameters.ortoolsSolver;
}
file_content.addItemToSection("study", "ortools solver", ortoolsSolver);
}

// Collecting data optimization problem
// -------------------------------------
void SimulationInfoCollector::toFileContent(FileContent& file_content)
{
file_content.addItemToSection("optimization problem", "variables", opt_info_.nbVariables);
file_content.addItemToSection("optimization problem", "constraints", opt_info_.nbConstraints);
file_content.addItemToSection(
"optimization problem", "non-zero coefficients", opt_info_.nbNonZeroCoeffs);
}

// Collecting durations from simulation
// -------------------------------------
void DurationCollector::toFileContent(FileContent& file_content)
{
for (const auto& element : duration_items_)
{
const std::string& name = element.first;
const auto& durations = element.second;
const int64_t duration_sum = accumulate(durations.begin(), durations.end(), (int64_t)0);

file_content.addDurationItem(name, (unsigned int)duration_sum, (int)durations.size());
}
}

void DurationCollector::addDuration(const std::string& name, int64_t duration)
{
const std::lock_guard<std::mutex> lock(mutex_);
duration_items_[name].push_back(duration);
}

} // namespace Benchmarking
6 changes: 3 additions & 3 deletions src/libs/antares/constants.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@

#include "constants.h"

namespace Antares::Constants {

namespace Antares::Constants
{
const std::array<unsigned int, 12> daysPerMonth = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

} // namespace constants
} // namespace Antares::Constants
Loading

0 comments on commit fac708a

Please sign in to comment.