Skip to content

Commit

Permalink
Merge branch 'develop' into feature/ramping_model_scalian
Browse files Browse the repository at this point in the history
Merging with latest developements to pass tests
  • Loading branch information
sylvmara committed Feb 5, 2025
2 parents 8b9df3e + a1b7826 commit e51995b
Show file tree
Hide file tree
Showing 134 changed files with 1,962 additions and 801 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/doxygen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
git apply ../docs/antares-simulator-doxygen.patch
- name: Doxygen
uses: mattnotmitt/doxygen-action@v1.9.8
uses: mattnotmitt/doxygen-action@v1.12.0
with:
doxyfile-path: docs/Doxyfile

Expand Down
9 changes: 7 additions & 2 deletions .github/workflows/ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ jobs:
- name: Run cucumber on short-tests
uses: ./.github/workflows/cucumber-tests
with:
feature: "features/short_tests.feature"
feature: "features/solver-features/short_tests.feature"

- name: Run mps tests
if: ${{ env.RUN_SIMPLE_TESTS == 'true' && !cancelled() }}
Expand Down Expand Up @@ -286,7 +286,7 @@ jobs:
- name: Run cucumber on medium-tests
uses: ./.github/workflows/cucumber-tests
with:
feature: "features/medium_tests.feature"
feature: "features/solver-features/medium_tests.feature"

- name: Run long-tests-1
if: ${{ env.RUN_EXTENDED_TESTS == 'true' && !cancelled() }}
Expand All @@ -312,6 +312,11 @@ jobs:
batch-name: long-tests-3
os: ${{ env.os }}

- name: Run cucumber on modeler
uses: ./.github/workflows/cucumber-tests
with:
feature: "features/modeler-features"

- name: Barrier
if: ${{ !success() }}
run: exit 1
Expand Down
9 changes: 7 additions & 2 deletions .github/workflows/windows-vcpkg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ jobs:
- name: Run cucumber on short-tests
uses: ./.github/workflows/cucumber-tests
with:
feature: "features/short_tests.feature"
feature: "features/solver-features/short_tests.feature"

- name: Run mps tests
if: ${{ env.RUN_SIMPLE_TESTS == 'true' && !cancelled() }}
Expand Down Expand Up @@ -287,7 +287,7 @@ jobs:
- name: Run cucumber on medium-tests
uses: ./.github/workflows/cucumber-tests
with:
feature: "features/medium_tests.feature"
feature: "features/solver-features/medium_tests.feature"

- name: Run long-tests-1
if: ${{ env.RUN_EXTENDED_TESTS == 'true' && !cancelled() }}
Expand All @@ -313,6 +313,11 @@ jobs:
batch-name: long-tests-3
os: ${{ env.os }}

- name: Run cucumber on modeler
uses: ./.github/workflows/cucumber-tests
with:
feature: "features/modeler-features"

- name: Barrier
if: ${{ !success() }}
run: exit 1
Expand Down
10 changes: 5 additions & 5 deletions docs/developer-guide/6-Contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -270,8 +270,8 @@ v = w * (x + z);
## Logging functions:
- Use `Antares::logs.[level]() << message` for logging, below is more detailed description for level:
- `logs.info() << msg` - always prints log message
- `logs.debug() << msg` - logs only in DEBUG
- `logs.warning() << msg` - the same as `logs.info()` but catches your attention
- `logs.error()` - the same as `logs.warning()`, but triggers an error when loading a study, with exceptions
- `logs.fatal()` - same as `logs.error()`
- `logs.fatal()`: indicates an error that causes a sudden shutdown of the application (e.g. null pointer exception, stack overflow, etc.). **Must not be used in antares-simulator** (use `error()` instead)
- `logs.error()`: indicates an error that causes unexpected processing behavior or interruption. Use it for anything that causes the simulation to stop (missing or malformed data, optimization error, etc.)
- `logs.warning() << msg`: indicates undesired behavior that is not an error, and that does not interrupt processing or the application. Use if for issues that do not interrupt simulation (obsolete parameter ignored, input data ignored, etc.).
- `logs.info() << msg`: information message explaining how the simulator works, intended for the person or application using it
- `logs.debug() << msg`: information message to facilitate debugging, intended for developers
2 changes: 1 addition & 1 deletion simtest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"version": "v9.2.0h"
"version": "v9.2.0i"
}
2 changes: 1 addition & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ set(ANTARES_VERSION_REVISION 0)

# Beta release
set(ANTARES_BETA 0)
set(ANTARES_RC 8)
set(ANTARES_RC 9)

set(ANTARES_VERSION_YEAR 2024)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,19 @@ ConstantCostProvider::ConstantCostProvider(const ThermalCluster& cluster):
{
}

double ConstantCostProvider::getOperatingCost(uint serieIndex, uint hourInTheYear) const
double ConstantCostProvider::getOperatingCost(uint /*serieIndex*/, uint hourInTheYear) const
{
const auto* modCost = cluster.modulation[thermalModulationCost];
return cluster.marginalCost * modCost[hourInTheYear];
}

double ConstantCostProvider::getMarginalCost(uint serieIndex, uint hourInTheYear) const
double ConstantCostProvider::getMarginalCost(uint /*serieIndex*/, uint hourInTheYear) const
{
const double mod = cluster.modulation[Data::thermalModulationCost][hourInTheYear];
return cluster.marginalCost * mod;
}

double ConstantCostProvider::getMarketBidCost(uint hourInTheYear, uint year) const
double ConstantCostProvider::getMarketBidCost(uint hourInTheYear, uint /*year*/) const
{
const double mod = cluster.modulation[thermalModulationMarketBid][hourInTheYear];
return cluster.marketBidCost * mod;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ bool thermalTSNumberData::reset(const Study& study)
// solver or not.
// WARNING: At this point, the variable pArea->thermal.list.size()
// might not be valid (because not really initialized yet)
uint clusterCount = (study.usedByTheSolver) ? (pArea->thermal.list.enabledCount())
: pArea->thermal.list.allClustersCount();
uint clusterCount = pArea->thermal.list.allClustersCount();

// Resize
pTSNumberRules.reset(clusterCount, nbYears);
Expand Down
1 change: 1 addition & 0 deletions src/packaging/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ set(TARGET_LIBS #No alias
# model_antares
infeasible_problem_analysis
modeler_api
data-series-lib
modeler-ortools-impl

# solver-lib
Expand Down
6 changes: 5 additions & 1 deletion src/solver/modelConverter/modelConverter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ std::vector<Antares::Study::SystemModel::PortType> convertTypes(
{
// Convert portTypes to Antares::Study::SystemModel::PortType
std::vector<Antares::Study::SystemModel::PortType> out;
out.reserve(library.port_types.size());
for (const auto& portType: library.port_types)
{
std::vector<Antares::Study::SystemModel::PortField> fields;
Expand Down Expand Up @@ -77,6 +78,7 @@ std::vector<Antares::Study::SystemModel::Parameter> convertParameters(
{
namespace SM = Antares::Study::SystemModel;
std::vector<SM::Parameter> parameters;
parameters.reserve(model.parameters.size());
for (const auto& parameter: model.parameters)
{
parameters.emplace_back(parameter.id,
Expand Down Expand Up @@ -119,7 +121,7 @@ std::vector<Antares::Study::SystemModel::Variable> convertVariables(const ModelP
namespace SM = Antares::Study::SystemModel;

std::vector<SM::Variable> variables;

variables.reserve(model.variables.size());
for (const auto& variable: model.variables)
{
SM::Expression lb(variable.lower_bound,
Expand Down Expand Up @@ -153,6 +155,7 @@ std::vector<Antares::Study::SystemModel::Constraint> convertConstraints(
const Antares::Solver::ModelParser::Model& model)
{
std::vector<Antares::Study::SystemModel::Constraint> constraints;
constraints.reserve(model.constraints.size());
for (const auto& constraint: model.constraints)
{
auto nodeRegistry = convertExpressionToNode(constraint.expression, model);
Expand All @@ -173,6 +176,7 @@ std::vector<Antares::Study::SystemModel::Model> convertModels(
const Antares::Solver::ModelParser::Library& library)
{
std::vector<Antares::Study::SystemModel::Model> models;
models.reserve(library.models.size());
for (const auto& model: library.models)
{
Antares::Study::SystemModel::ModelBuilder modelBuilder;
Expand Down
10 changes: 6 additions & 4 deletions src/solver/modeler/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
add_subdirectory(api)
add_subdirectory(dataSeries)
add_subdirectory(ortoolsImpl)
add_subdirectory(loadFiles)
add_subdirectory(parameters)
Expand All @@ -22,15 +23,16 @@ target_link_libraries(modeler-lib
INTERFACE
Antares::loadModelerFiles
Antares::modelerParameters
Antares::optim-model-filler
Antares::modeler_api
# TODO FIXME don't depend on implementations
Antares::modeler-ortools-impl
Antares::optim-model-filler
Antares::modeler_api
# TODO FIXME don't depend on implementations
Antares::modeler-ortools-impl
)

target_link_libraries(antares-modeler
PRIVATE
modeler-lib
data-series-lib
modeler-ortools-impl
optim-model-filler
)
Expand Down
7 changes: 3 additions & 4 deletions src/solver/modeler/api/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,12 @@ set(SRC_API
include/antares/solver/modeler/api/hasBounds.h
include/antares/solver/modeler/api/hasName.h

include/antares/solver/modeler/api/ILinearProblemData.h
include/antares/solver/modeler/api/linearProblem.h
include/antares/solver/modeler/api/linearProblemData.h
include/antares/solver/modeler/api/linearProblemFiller.h
include/antares/solver/modeler/api/linearProblemBuilder.h

linearProblemData.cpp
linearProblemBuilder.cpp
linearProblemBuilder.cpp
)

add_library(${PROJ} ${SRC_API})
Expand All @@ -25,5 +24,5 @@ set_target_properties(${PROJ} PROPERTIES LINKER_LANGUAGE CXX)

target_include_directories(${PROJ}
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@

#pragma once

#include <string>

namespace Antares::Solver::Modeler::Api
{

class ILinearProblemData
{
virtual double getData(const std::string& dataSetId,
const std::string& scenarioGroup,
const unsigned scenario,
const unsigned hour)
= 0;
};

} // namespace Antares::Solver::Modeler::Api
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class LinearProblemBuilder
{
public:
explicit LinearProblemBuilder(const std::vector<LinearProblemFiller*>& fillers);
void build(ILinearProblem& pb, LinearProblemData& data, FillContext& ctx);
void build(ILinearProblem& pb, ILinearProblemData& data, FillContext& ctx);

private:
const std::vector<LinearProblemFiller*>& fillers_;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
#include <memory>
#include <unordered_map>

#include <antares/solver/modeler/api/ILinearProblemData.h>
#include <antares/solver/modeler/api/linearProblem.h>
#include <antares/solver/modeler/api/linearProblemData.h>

namespace Antares::Solver::Visitors
{
Expand Down Expand Up @@ -73,9 +73,9 @@ struct FillContext
class LinearProblemFiller
{
public:
virtual void addVariables(ILinearProblem& pb, LinearProblemData& data, FillContext& ctx) = 0;
virtual void addConstraints(ILinearProblem& pb, LinearProblemData& data, FillContext& ctx) = 0;
virtual void addObjective(ILinearProblem& pb, LinearProblemData& data, FillContext& ctx) = 0;
virtual void addVariables(ILinearProblem& pb, ILinearProblemData& data, FillContext& ctx) = 0;
virtual void addConstraints(ILinearProblem& pb, ILinearProblemData& data, FillContext& ctx) = 0;
virtual void addObjective(ILinearProblem& pb, ILinearProblemData& data, FillContext& ctx) = 0;
virtual ~LinearProblemFiller() = default;
};

Expand Down
2 changes: 1 addition & 1 deletion src/solver/modeler/api/linearProblemBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ LinearProblemBuilder::LinearProblemBuilder(const std::vector<LinearProblemFiller
{
}

void LinearProblemBuilder::build(ILinearProblem& pb, LinearProblemData& data, FillContext& ctx)
void LinearProblemBuilder::build(ILinearProblem& pb, ILinearProblemData& data, FillContext& ctx)
{
std::ranges::for_each(fillers_,
[&](const auto& filler) { filler->addVariables(pb, data, ctx); });
Expand Down
53 changes: 0 additions & 53 deletions src/solver/modeler/api/linearProblemData.cpp

This file was deleted.

33 changes: 33 additions & 0 deletions src/solver/modeler/dataSeries/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@

set(SRC_DATA_SERIES
include/antares/solver/modeler/dataSeries/dataSeries.h

include/antares/solver/modeler/dataSeries/timeSeriesSet.h
timeSeriesSet.cpp
timeSeriesSetExceptions.cpp

include/antares/solver/modeler/dataSeries/dataSeriesRepo.h
dataSeriesRepo.cpp
dataSeriesRepoExceptions.cpp

include/antares/solver/modeler/dataSeries/scenarioGroupRepo.h
scenarioGroupRepo.cpp
scenarioGroupRepoExceptions.cpp

include/antares/solver/modeler/dataSeries/linearProblemData.h
linearProblemData.cpp
)

add_library(data-series-lib ${SRC_DATA_SERIES})
set_target_properties(data-series-lib PROPERTIES LINKER_LANGUAGE CXX)

target_link_libraries(data-series-lib
PUBLIC
modeler_api
)

target_include_directories(data-series-lib
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
)

Loading

0 comments on commit e51995b

Please sign in to comment.