Skip to content

Commit

Permalink
Rebase 8.8.11 on develop : try to make code compile + make CI work
Browse files Browse the repository at this point in the history
  • Loading branch information
guilpier-code committed Nov 29, 2024
1 parent b76f1a6 commit bda8344
Show file tree
Hide file tree
Showing 16 changed files with 70 additions and 102 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/centos7.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
run: |
git clone $GITHUB_SERVER_URL/$GITHUB_REPOSITORY.git -b ${{ env.REF }} .
- name: Install gcc 11
- name: Install gcc 10
run: |
# update mirrors, official centos7 is deprecated
sed -i s/mirror.centos.org/vault.centos.org/g /etc/yum.repos.d/*.repo &&\
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/install-cmake-328/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ runs:
- name: Build cmake
shell: bash
run: |
source /opt/rh/devtoolset-11/enable
source /opt/rh/devtoolset-10/enable || true # Ignore error if devtoolset-10 is not available
yum -y install openssl-devel
wget https://github.com/Kitware/CMake/releases/download/v3.28.2/cmake-3.28.2.tar.gz
tar -xvf cmake-3.28.2.tar.gz
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/new_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,4 @@ jobs:
uses: ./.github/workflows/build-userguide.yml
with:
run-tests: ${{ inputs.run-tests }}
target_branch: ${{ inputs.target_branch }}
52 changes: 34 additions & 18 deletions .github/workflows/ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,6 @@ jobs:
cd src/api_client_example
cmake -B _build -S . \
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
-DVCPKG_ROOT="${{env.VCPKG_ROOT}}" \
-DVCPKG_TARGET_TRIPLET=${{ env.triplet }} \
-DCMAKE_C_COMPILER=/usr/bin/gcc-10 \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DCMAKE_CXX_COMPILER=/usr/bin/g++-10 \
Expand Down Expand Up @@ -172,30 +170,48 @@ jobs:
run: |
cd _build
ctest -C Release --output-on-failure -L "unit|end-to-end"

- name: Upload logs for failed tests
if: ${{ failure() }}
uses: actions/upload-artifact@v4
with:
name: test-log
path: ${{ github.workspace }}/_build/Testing/Temporary/LastTest.log

- name: Run tests about infinity on BCs RHS
if: ${{ env.RUN_SIMPLE_TESTS == 'true' && !cancelled() }}
uses: ./.github/workflows/run-tests
with:
simtest-tag: ${{ env.SIMTEST }}
batch-name: valid-v830
os: ${{ env.os }}

- name: Run MILP with CBC
if: ${{ env.RUN_SIMPLE_TESTS == 'true' && !cancelled() }}
uses: ./.github/workflows/run-tests
with:
simtest-tag: ${{ env.SIMTEST }}
batch-name: valid-milp
variant: "milp-cbc"
os: ${{ env.os }}

- name: Run tests on adequacy patch
if: ${{ env.RUN_SIMPLE_TESTS == 'true' }}
uses: ./.github/workflows/run-tests
with:
simtest-tag: ${{steps.simtest-version.outputs.prop}}
batch-name: adequacy-patch-CSR
os: ${{ env.os }}

- name: Run parallel tests
if: ${{ env.RUN_EXTENDED_TESTS == 'true' }}
uses: ./.github/workflows/run-tests
with:
simtest-tag: ${{steps.simtest-version.outputs.prop}}
batch-name: valid-parallel
os: ${{ env.os }}
variant: "parallel"
- name: Run tests on adequacy patch
if: ${{ env.RUN_SIMPLE_TESTS == 'true' }}
uses: ./.github/workflows/run-tests
with:
simtest-tag: ${{steps.simtest-version.outputs.prop}}
batch-name: adequacy-patch-CSR
os: ${{ env.os }}
- name: Run parallel tests
if: ${{ env.RUN_EXTENDED_TESTS == 'true' }}
uses: ./.github/workflows/run-tests
with:
simtest-tag: ${{steps.simtest-version.outputs.prop}}
batch-name: valid-parallel
os: ${{ env.os }}
variant: "parallel"

- name: Run tests introduced in 8.6.0
if: ${{ env.RUN_SIMPLE_TESTS == 'true' && !cancelled() }}
Expand Down
18 changes: 8 additions & 10 deletions .github/workflows/windows-vcpkg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,6 @@ jobs:
cd _build
ctest -C Release --output-on-failure -L "unit|end-to-end" -LE ortools
<<<<<<< HEAD
- name: Upload build on failure
if: ${{ failure() }}
uses: actions/upload-artifact@v4
Expand All @@ -188,15 +187,14 @@ jobs:
simtest-tag: ${{ env.SIMTEST }}
batch-name: adequacy-patch-CSR
os: ${{ env.os }}
=======
- name: Run tests about infinity on BCs RHS
if: ${{ env.RUN_SIMPLE_TESTS == 'true' }}
uses: ./.github/workflows/run-tests
with:
simtest-tag: ${{steps.simtest-version.outputs.prop}}
batch-name: valid-v830
os: ${{ env.test-platform }}
>>>>>>> 8dbf5c11e (Adequacy patch CSR - revamp output variables [ANT-1932] (#2421))

- name: Run tests about infinity on BCs RHS
if: ${{ env.RUN_SIMPLE_TESTS == 'true' }}
uses: ./.github/workflows/run-tests
with:
simtest-tag: ${{steps.simtest-version.outputs.prop}}
batch-name: valid-v830
os: ${{ env.test-platform }}

- name: Run tests about infinity on BCs RHS
if: ${{ env.RUN_SIMPLE_TESTS == 'true' && !cancelled() }}
Expand Down
6 changes: 3 additions & 3 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
cmake_minimum_required(VERSION 3.14) # FetchContent_MakeAvailable

# Version
set(ANTARES_VERSION_HI 8)
set(ANTARES_VERSION_LO 8)
set(ANTARES_VERSION_REVISION 11)
set(ANTARES_VERSION_HI 9)
set(ANTARES_VERSION_LO 2)
set(ANTARES_VERSION_REVISION 0)

# Beta release
set(ANTARES_BETA 0)
Expand Down
5 changes: 2 additions & 3 deletions src/libs/antares/exception/LoadingError.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,8 @@ InvalidSolverSpecificParameters::InvalidSolverSpecificParameters(const std::stri
{
}

InvalidStudy::InvalidStudy(const Yuni::String& study):
LoadingError(std::string("The folder `") + study.c_str()
+ "` does not seem to be a valid study")
InvalidStudy::InvalidStudy(const std::string& study) :
LoadingError(std::string("The folder `") + study + "` does not seem to be a valid study")
{
}

Expand Down
7 changes: 0 additions & 7 deletions src/solver/misc/options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,6 @@ std::unique_ptr<Yuni::GetOpt::Parser> CreateParser(Settings& settings, StudyLoad
"force-parallel",
"Override the max number of years computed simultaneously");

// add option for ortools use
// --use-ortools
parser->addFlag(options.optOptions.ortoolsUsed,
' ',
"use-ortools",
"Use ortools library to launch solver");

//--ortools-solver
parser->add(options.optOptions.ortoolsSolver,
' ',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

#include "antares/solver/optimisation/adequacy_patch_csr/count_constraints_variables.h"
#include "antares/solver/optimisation/adequacy_patch_csr/csr_quadratic_problem.h"
#include "antares/solver/optimisation/opt_fonctions.h"
#include "solve_problem.h"
#include "antares/solver/simulation/adequacy_patch_runtime_data.h"

using namespace Yuni;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,11 @@ void HourlyCSRProblem::setRHSnodeBalanceValue()
if (problemeHebdo_->adequacyPatchRuntimeData->areaMode[Area]
== Data::AdequacyPatch::physicalAreaInsideAdqPatch)
{
std::map<int, int>::iterator it = numberOfConstraintCsrAreaBalance_.find(Area);
if (it != numberOfConstraintCsrAreaBalance_.end())
std::map<int, int>::iterator it = numberOfConstraintCsrAreaBalance.find(Area);
if (it != numberOfConstraintCsrAreaBalance.end())
{
int Cnt = it->second;
problemeAResoudre_.SecondMembre[Cnt] = rhsAreaBalanceValues_[Area];
problemeAResoudre_.SecondMembre[Cnt] = rhsAreaBalanceValues[Area];
logs.debug() << Cnt << ": Area Balance: RHS[" << Cnt
<< "] = " << problemeAResoudre_.SecondMembre[Cnt]
<< " (Area = " << Area << ")";
Expand Down
4 changes: 2 additions & 2 deletions src/solver/optimisation/adequacy_patch_csr/solve_problem.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

#include "antares/study/parameters/adq-patch-params.h"

#include "../opt_structure_probleme_a_resoudre.h"
#include "hourly_csr_problem.h"
#include "antares/solver/optimisation/opt_structure_probleme_a_resoudre.h"
#include "antares/solver/optimisation/adequacy_patch_csr/hourly_csr_problem.h"

using namespace Antares::Data::AdequacyPatch;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ class HourlyCSRProblem
public:
// TODO [gp] : try to make these members private
double belowThisThresholdSetToZero;
std::map<int, int> numberOfConstraintCsrAreaBalance;
std::set<int> ensVariablesInsideAdqPatch; // place inside only ENS inside adq-patch
std::set<int> varToBeSetToZeroIfBelowThreshold; // place inside only ENS and Spillage variable
int triggeredHour;
Expand All @@ -145,38 +146,6 @@ class HourlyCSRProblem
std::map<int, double> rhsAreaBalanceValues;


struct LinkVariable
{
LinkVariable():
directVar(-1),
indirectVar(-1)
{
}

LinkVariable(int direct, int indirect):
directVar(direct),
indirectVar(indirect)
{
}

inline bool check() const
{
if (directVar < 0)
{
Antares::logs.warning() << "directVar < 0 detected, this should not happen";
}
if (indirectVar < 0)
{
Antares::logs.warning() << "indirectVar < 0 detected, this should not happen";
}

return (directVar >= 0) && (indirectVar >= 0);
}

int directVar;
int indirectVar;
};

// links between two areas inside the adq-patch domain
std::map<int, LinkVariable> linkInsideAdqPatch;
};
Original file line number Diff line number Diff line change
Expand Up @@ -69,19 +69,6 @@ class RemixHydroPostProcessCmd: public basePostProcessCommand
SimplexOptimization splx_optimization_;
};

class DTGmarginForAdqPatchPostProcessCmd: public basePostProcessCommand
{
public:
UpdateMrgPriceAfterCSRcmd(PROBLEME_HEBDO* problemeHebdo,
AreaList& areas,
unsigned int thread_number);
void execute(const optRuntimeData&) override;

private:
const AreaList& area_list_;
unsigned int thread_number_ = 0;
};

class UpdateMrgPriceAfterCSRcmd: public basePostProcessCommand
{
public:
Expand Down
4 changes: 3 additions & 1 deletion src/solver/variable/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ set(SRC_VARIABLE_ECONOMY
include/antares/solver/variable/economy/links.h

# Variables for Economy
include/antares/solver/variable/economy/max-mrg-utils.h
max-mrg-utils.cpp
include/antares/solver/variable/economy/max-mrg.h
include/antares/solver/variable/economy/price.h
include/antares/solver/variable/economy/balance.h
Expand Down Expand Up @@ -126,7 +128,7 @@ set(SRC_VARIABLE_ECONOMY
include/antares/solver/variable/economy/links/congestionFeeAbs.h
include/antares/solver/variable/economy/links/marginalCost.h
include/antares/solver/variable/economy/links/congestionProbability.h
include/antares/solver/variable/economy/overallCostCsr.h
include/antares/solver/variable/economy/overallCostCsr.h

# Binding constraints
include/antares/solver/variable/economy/bindingConstraints/bindingConstraintsMarginalCost.h
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#pragma once

#include "../state.h"
#include <antares/series/series.h>

namespace Antares::Solver::Variable::Economy
{
Expand All @@ -10,9 +11,10 @@ struct MaxMRGinput
double* spillage = nullptr;
double* dens = nullptr;
double* hydroGeneration = nullptr;
double* hydroMaxPower = nullptr;
Antares::Data::TimeSeries* maxHourlyGenPower = nullptr;
double* dtgMargin = nullptr;
unsigned int hourInYear = 0;
unsigned int year = 0;
Date::Calendar* calendar = nullptr;
std::string areaName;
};
Expand Down
13 changes: 7 additions & 6 deletions src/solver/variable/max-mrg-utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,10 @@

#include <yuni/yuni.h>

#include <antares/solver/variable/economy/max-mrg-utils.h>
#include <antares/study/area/scratchpad.h>
#include <antares/study/study.h>

#include "max-mrg.h"

using namespace Yuni;

const unsigned int nbHoursInWeek = 168;
Expand All @@ -45,9 +44,10 @@ MaxMrgDataFactory::MaxMrgDataFactory(const State& state, unsigned int numSpace):
weeklyResults_(state.problemeHebdo->ResultatsHoraires[state.area->index])
{
maxMRGinput_.hydroGeneration = weeklyResults_.TurbinageHoraire.data();
maxMRGinput_.hydroMaxPower = state_.area->hydro.maxPower[Data::PartHydro::genMaxP];
maxMRGinput_.maxHourlyGenPower = &state_.area->hydro.series->maxHourlyGenPower;
maxMRGinput_.dtgMargin = state_.area->scratchpad[numSpace].dispatchableGenerationMargin;
maxMRGinput_.hourInYear = state.hourInTheYear;
maxMRGinput_.year = state.problemeHebdo->year;
maxMRGinput_.calendar = &state.study.calendar;
maxMRGinput_.areaName = state_.area->name.c_str();
}
Expand Down Expand Up @@ -135,9 +135,10 @@ void computeMaxMRG(double* maxMrgOut, const MaxMRGinput& in)
assert(h < HOURS_PER_YEAR && "calendar overflow");
if (niveau > OI[h])
{
uint dayYear = in.calendar->hours[h + in.hourInYear].dayYear;
maxMrgOut[h] = Math::Min(niveau,
OI[h] + in.hydroMaxPower[dayYear] - in.hydroGeneration[h]);
maxMrgOut[h] = Math::Min(
niveau,
OI[h] + in.maxHourlyGenPower->getCoefficient(in.year, h + in.hourInYear)
- in.hydroGeneration[h]);
SM += maxMrgOut[h] - OI[h];
}
else
Expand Down

0 comments on commit bda8344

Please sign in to comment.