Skip to content

Commit

Permalink
Merge branch 'develop' into feature/add-tests-for-named-mps
Browse files Browse the repository at this point in the history
  • Loading branch information
flomnes committed Jul 28, 2023
2 parents fa21ce7 + d6aa849 commit 06ed8d4
Show file tree
Hide file tree
Showing 34 changed files with 335 additions and 269 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/centos7.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
- name: Init submodule
run: |
git submodule update --init --recursive src/antares-deps src/tests/resources/Antares_Simulator_Tests
git submodule update --init --remote src/antares-deps src/tests/resources/Antares_Simulator_Tests
- name: Download & extract precompiled deps at root
run: |
Expand Down Expand Up @@ -68,6 +68,8 @@ jobs:
-DCMAKE_BUILD_TYPE=release \
-DBUILD_TESTING=ON \
-DBUILD_not_system=OFF \
-DBUILD_TOOLS=OFF \
-DBUILD_UI=OFF \
-DCMAKE_PREFIX_PATH=${{ env.ORTOOLSDIR }}/install \
- name: Build
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/oracle8.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
- name: Install libraries
run: |
dnf install -y epel-release git cmake wget rpm-build
dnf install -y epel-release git cmake wget rpm-build redhat-lsb-core
dnf install -y unzip libuuid-devel boost-test boost-devel gcc-toolset-9-toolchain
- name: Checkout
Expand All @@ -47,7 +47,7 @@ jobs:
- name: Init submodule
run: |
git config --global safe.directory '*'
git submodule update --init --recursive src/antares-deps src/tests/resources/Antares_Simulator_Tests
git submodule update --init --remote src/antares-deps src/tests/resources/Antares_Simulator_Tests
- name: Install dependencies
run: |
Expand All @@ -59,6 +59,7 @@ jobs:
cmake -B _build -S src \
-DCMAKE_BUILD_TYPE=release \
-DBUILD_TESTING=ON \
-DBUILD_TOOLS=OFF \
-DBUILD_UI=OFF \
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ jobs:
- name: Init submodule
run: |
git submodule update --init src/antares-deps
git submodule update --init src/tests/resources/Antares_Simulator_Tests
git submodule update --init --remote src/tests/resources/Antares_Simulator_Tests
- name: Configure push
run: |
Expand All @@ -96,6 +96,7 @@ jobs:
-DCMAKE_BUILD_TYPE=release \
-DBUILD_TESTING=ON \
-DBUILD_not_system=OFF \
-DBUILD_TOOLS=ON \
-DCMAKE_PREFIX_PATH=${{ env.ORTOOLS_DIR }}/install \
- name: Build
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/windows-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ jobs:
-DVCPKG_TARGET_TRIPLET=${{ matrix.triplet }} \
-DCMAKE_BUILD_TYPE=release \
-DBUILD_TESTING=ON \
-DBUILD_TOOLS=ON \
-DBUILD_not_system=OFF
- name: Build
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/windows-vcpkg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ jobs:
-DVCPKG_TARGET_TRIPLET=${{ matrix.triplet }} \
-DCMAKE_BUILD_TYPE=release \
-DBUILD_TESTING=ON \
-DBUILD_TOOLS=ON \
-DBUILD_not_system=OFF
- name: Build
Expand Down
3 changes: 2 additions & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
[submodule "src/antares-deps"]
path = src/antares-deps
url = https://github.com/AntaresSimulatorTeam/antares-deps.git
branch = v2.0.2
branch = v2.0.2b
[submodule "src/tests/resources/Antares_Simulator_Tests"]
path = src/tests/resources/Antares_Simulator_Tests
url = https://github.com/AntaresSimulatorTeam/Antares_Simulator_Tests.git
branch = master
[submodule "vcpkg"]
path = vcpkg
url = https://github.com/microsoft/vcpkg.git
11 changes: 6 additions & 5 deletions docker/oraclelinux
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
FROM oraclelinux:8

# update repo
RUN dnf update -y
RUN dnf update -y && \
dnf install redhat-lsb-core

# install python & modules
RUN dnf install -y python3 python3-pip
RUN pip3 install --user pandas numpy pytest
RUN dnf install -y python3 python3-pip && \
pip3 install --user pandas numpy pytest

# Install build tools
RUN dnf install -y epel-release git cmake wget rpm-build
RUN dnf install -y unzip libuuid-devel boost-test boost-devel gcc-toolset-9-toolchain
RUN dnf install -y epel-release git cmake wget rpm-build && \
dnf install -y unzip libuuid-devel boost-test boost-devel gcc-toolset-9-toolchain
29 changes: 29 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,35 @@
Antares Changelog
=================


8.7.0-rc1 (07/2023)
--------------------
## Features
* Implement --mps-export command-line option (#1404)

## Bugfixes
* Fix segfault, add !skipped to enabled constraints (#1441)
* Use local index for thermal cluster instead of global one (#1448)
* Only add "active" thermal clusters in binding constraints (#1447)
* Add cluster name for 6 constraints associated to unit-commitment = accurate (#1426)
* Fix size for assign / resize - too much memory was allocated (#1443)

## Packages
* Give Oracle Linux 8 assets a proper name instead of "unknown" (#1438)
* Don't build tools (study-updater, etc.) by default (#1442)

## For developers
* Clarify logs & code in case of "failed year" (#1450)
* Remove two static functions (#1440)
* Avoid copies using std::move (#1445)
* Memory allocation, use std::vector (#1402)
* Fix critical code smells (#1412)
* Named MPS: factorize variable & constraint namers (#1409)
* Array, logs jit and correlation in makefile (#1410)

## Tests
* Tests for CR20: thermal price definition (#1364)

8.7.0-beta3 (07/2023)
--------------------
## Bugfixes
Expand Down
2 changes: 1 addition & 1 deletion docs/reference-guide/13-file-format.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Add directory **bindingconstraints** to output directory **ts-numbers**. For eve
* For each area, add directory **input/st-storage/clusters/<area id>/list.ini**
* This file contains the multiple sections whose name is ignored. Each section contains these properties:
* `name` [str]
* `group` [str]. Possible values: "PSP_open", "PSP_closed", "Pondage", "Battery", "Other_1", ... , "Other_5". Default Other_1
* `group` [str]. Possible values: "PSP_open", "PSP_closed", "Pondage", "Battery", "Other1", ... , "Other5". Default Other1
* `efficiency` [double] in range 0-1
* `reservoircapacity` [double] > 0
* `initiallevel` [double] in range 0-1
Expand Down
1 change: 0 additions & 1 deletion resources/examples
Submodule examples deleted from a9f766
13 changes: 9 additions & 4 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ set(ANTARES_VERSION_LO 7)
set(ANTARES_VERSION_REVISION 0)

# Beta release
set(ANTARES_BETA 3)
set(ANTARES_RC 0)
set(ANTARES_BETA 0)
set(ANTARES_RC 1)

set(ANTARES_VERSION_YEAR 2023)

Expand Down Expand Up @@ -178,11 +178,14 @@ endif ()
option(BUILD_UI "Build antares ui simulator" ON)
message(STATUS "Build antares ui simulator: ${BUILD_UI}")

option(BUILD_TOOLS "Build antares tools" OFF)
message(STATUS "Build antares tools: ${BUILD_TOOLS}")

option(BUILD_ORTOOLS "Build OR-Tools" OFF)
message(STATUS "Build OR-Tools ${BUILD_ORTOOLS}")
message(STATUS "Build OR-Tools: ${BUILD_ORTOOLS}")

option(BUILD_MINIZIP "Build minizip" OFF)
message(STATUS "Build minizip ${BUILD_MINIZIP}")
message(STATUS "Build minizip: ${BUILD_MINIZIP}")

#Define install directory
if (NOT DEPS_INSTALL_DIR)
Expand Down Expand Up @@ -326,7 +329,9 @@ add_subdirectory(solver) #antares solver and all associated libs
add_subdirectory(analyzer) #antares analyser

# Tools
if (BUILD_TOOLS)
add_subdirectory(tools) #All antares tools
endif()

# Tests
# Not setting BUILD_TESTING as a command line argument is equivalent to use -DBUILD_TESTING=OFF
Expand Down
6 changes: 3 additions & 3 deletions src/libs/antares/benchmarking/info_collectors.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,15 @@ void StudyInfoCollector::enabledThermalClustersCountToFileContent(FileContent& f

void StudyInfoCollector::enabledBindingConstraintsCountToFileContent(FileContent& file_content)
{
auto enabledBindingConstraints = study_.bindingConstraints.enabled();
auto nbEnabledBC = enabledBindingConstraints.size();
auto activeContraints = study_.bindingConstraints.activeContraints();
auto nbEnabledBC = activeContraints.size();
unsigned nbEnabledHourlyBC(0);
unsigned nbEnabledDailyBC(0);
unsigned nbEnabledWeeklyBC(0);

for (uint i = 0; i < nbEnabledBC; i++)
{
switch (enabledBindingConstraints[i]->type())
switch (activeContraints[i]->type())
{
case BindingConstraint::Type::typeHourly:
nbEnabledHourlyBC++;
Expand Down
42 changes: 17 additions & 25 deletions src/libs/antares/study/binding_constraint/BindingConstraint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,17 +153,17 @@ void BindingConstraint::weight(const AreaLink* lnk, double w)
}
}

void BindingConstraint::weight(const ThermalCluster* clstr, double w)
void BindingConstraint::weight(const ThermalCluster* cluster, double w)
{
if (clstr)
if (cluster && cluster->isActive())
{
if (Math::Zero(w))
{
auto i = pClusterWeights.find(clstr);
auto i = pClusterWeights.find(cluster);
if (i != pClusterWeights.end())
pClusterWeights.erase(i);
} else {
pClusterWeights[clstr] = w;
pClusterWeights[cluster] = w;
}
}
}
Expand All @@ -189,29 +189,21 @@ void BindingConstraint::offset(const AreaLink* lnk, int o)
}
}

void BindingConstraint::offset(const ThermalCluster* clstr, int o)
void BindingConstraint::offset(const ThermalCluster* cluster, int o)
{
if (clstr)
if (cluster && cluster->isActive())
{
if (Math::Zero(o))
{
auto i = pClusterOffsets.find(clstr);
auto i = pClusterOffsets.find(cluster);
if (i != pClusterOffsets.end())
pClusterOffsets.erase(i);
}
else
pClusterOffsets[clstr] = o;
pClusterOffsets[cluster] = o;
}
}

uint Antares::Data::BindingConstraint::enabledClusterCount() const
{
return static_cast<uint>(std::count_if(
pClusterWeights.begin(), pClusterWeights.end(), [](const clusterWeightMap::value_type &i) {
return i.first->enabled && !i.first->mustrun;
}));
}

void BindingConstraint::resetToDefaultValues()
{
pEnabled = true;
Expand Down Expand Up @@ -436,7 +428,7 @@ void BindingConstraint::buildFormula(String& s) const
s << " x (t - " << Math::Abs(pClusterOffsets.find(i->first)->second) << ')';
}

if (!(i->first)->enabled || (i->first)->mustrun)
if (!i->first->isActive())
s << " x N/A";

s << ')';
Expand Down Expand Up @@ -472,9 +464,9 @@ bool BindingConstraint::contains(const AreaLink* lnk) const
return (i != pLinkWeights.end());
}

bool BindingConstraint::contains(const ThermalCluster* clstr) const
bool BindingConstraint::contains(const ThermalCluster* cluster) const
{
const auto i = pClusterWeights.find(clstr);
const auto i = pClusterWeights.find(cluster);
return (i != pClusterWeights.end());
}

Expand Down Expand Up @@ -528,11 +520,11 @@ bool BindingConstraint::hasAllWeightedClustersOnLayer(size_t layerID)

for (auto j = pClusterWeights.begin(); j != endWeights; ++j)
{
auto *clstr = j->first;
if (!clstr)
auto *cluster = j->first;
if (!cluster)
continue;

if (!clstr->isVisibleOnLayer(layerID) || j->second == 0)
if (!cluster->isVisibleOnLayer(layerID) || j->second == 0)
{
return false;
}
Expand All @@ -546,9 +538,9 @@ double BindingConstraint::weight(const AreaLink* lnk) const
return (i != pLinkWeights.end()) ? i->second : 0.;
}

double BindingConstraint::weight(const ThermalCluster* clstr) const
double BindingConstraint::weight(const ThermalCluster* cluster) const
{
auto i = pClusterWeights.find(clstr);
auto i = pClusterWeights.find(cluster);
return (i != pClusterWeights.end()) ? i->second : 0.;
}

Expand Down Expand Up @@ -600,7 +592,7 @@ BindingConstraintStructures BindingConstraint::initLinkArrays() const
off = 0;
auto cEnd = pClusterWeights.end();
for (auto i = pClusterWeights.begin(); i != cEnd; ++i) {
if (i->first->enabled && !i->first->mustrun) {
if (i->first->isActive()) {
clusterIndex[off] = (i->first)->index;
clustersAreaIndex[off] = (i->first)->parentArea->index;
clusterWeight[off] = i->second;
Expand Down
12 changes: 3 additions & 9 deletions src/libs/antares/study/binding_constraint/BindingConstraint.h
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ class BindingConstraint final : public Yuni::NonCopyable<BindingConstraint>
//@}

bool skipped() const;
bool isActive() const;

//Ref to prevent copy. const ref to prevent modification.
const Matrix<>& RHSTimeSeries() const;
Expand Down Expand Up @@ -282,14 +283,6 @@ class BindingConstraint final : public Yuni::NonCopyable<BindingConstraint>
** \brief Get how many thermal clusters the binding constraint contains
*/
uint clusterCount() const;

/*!
** \brief Get how many thermal clusters the binding constraint contains
*/
uint enabledClusterCount() const;

//@}

//@}

//! \name Type of the binding constraint
Expand Down Expand Up @@ -419,6 +412,7 @@ class BindingConstraint final : public Yuni::NonCopyable<BindingConstraint>
void clear();

void copyFrom(BindingConstraint const *original);

}; // class BindingConstraint

// class BindConstList
Expand All @@ -433,4 +427,4 @@ struct CompareBindingConstraintName final

} // namespace Antares::Data

#include "BindingConstraint.hxx"
#include "BindingConstraint.hxx"
10 changes: 7 additions & 3 deletions src/libs/antares/study/binding_constraint/BindingConstraint.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,13 @@ inline void BindingConstraint::mutateTypeWithoutCheck(Type t)
pType = t;
}

inline bool BindingConstraint::skipped() const
inline bool BindingConstraint::skipped() const
{
return linkCount() == 0 && enabledClusterCount() == 0;
return linkCount() == 0 && clusterCount() == 0;
}

inline bool BindingConstraint::isActive() const {
return enabled() && !skipped();
}

inline BindingConstraint::iterator BindingConstraint::begin() {
Expand Down Expand Up @@ -117,4 +121,4 @@ inline std::string BindingConstraint::timeSeriesFileName(const Env &env) const {
}
}

} // namespace Antares
} // namespace Antares
Loading

0 comments on commit 06ed8d4

Please sign in to comment.