From 6e0e94f3dd80ec49c8d86cd25ebbe01f81d7ad30 Mon Sep 17 00:00:00 2001 From: abdoulbari zaher <32519851+a-zakir@users.noreply.github.com> Date: Fri, 31 May 2024 17:28:28 +0200 Subject: [PATCH] Fix circular dependencies on CMake targets (#2140) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit close #2137 --------- Co-authored-by: Florian Omnès --- src/solver/optimisation/CMakeLists.txt | 1 - .../solver/optimisation/opt_fonctions.h | 2 +- .../opt_period_string_generator_base.h | 34 ------------------- src/solver/utils/CMakeLists.txt | 1 - src/solver/utils/filename.cpp | 4 --- .../include/antares/solver/utils/filename.h | 2 +- .../utils/opt_period_string_generator.h | 8 ++++- 7 files changed, 9 insertions(+), 43 deletions(-) delete mode 100644 src/solver/optimisation/include/antares/solver/optimisation/opt_period_string_generator_base.h diff --git a/src/solver/optimisation/CMakeLists.txt b/src/solver/optimisation/CMakeLists.txt index 0b5783ae92..2e3f257932 100644 --- a/src/solver/optimisation/CMakeLists.txt +++ b/src/solver/optimisation/CMakeLists.txt @@ -72,7 +72,6 @@ set(RTESOLVER_OPT include/antares/solver/optimisation/adequacy_patch_csr/constraints/CsrBindingConstraintHour.h adequacy_patch_csr/constraints/CsrBindingConstraintHour.cpp - include/antares/solver/optimisation/opt_period_string_generator_base.h include/antares/solver/optimisation/opt_rename_problem.h opt_rename_problem.cpp diff --git a/src/solver/optimisation/include/antares/solver/optimisation/opt_fonctions.h b/src/solver/optimisation/include/antares/solver/optimisation/opt_fonctions.h index 308616f1c4..8aad20d799 100644 --- a/src/solver/optimisation/include/antares/solver/optimisation/opt_fonctions.h +++ b/src/solver/optimisation/include/antares/solver/optimisation/opt_fonctions.h @@ -22,13 +22,13 @@ #define __SOLVER_OPTIMISATION_FUNCTIONS_H__ #include +#include #include #include "antares/config/config.h" #include "antares/solver/optimisation/opt_structure_probleme_a_resoudre.h" #include "antares/study/parameters/adq-patch-params.h" #include "adequacy_patch_csr/hourly_csr_problem.h" -#include "opt_period_string_generator_base.h" using AdqPatchParams = Antares::Data::AdequacyPatch::AdqPatchParams; using OptimizationOptions = Antares::Solver::Optimization::OptimizationOptions; diff --git a/src/solver/optimisation/include/antares/solver/optimisation/opt_period_string_generator_base.h b/src/solver/optimisation/include/antares/solver/optimisation/opt_period_string_generator_base.h deleted file mode 100644 index 217d95db0c..0000000000 --- a/src/solver/optimisation/include/antares/solver/optimisation/opt_period_string_generator_base.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright 2007-2024, RTE (https://www.rte-france.com) - * See AUTHORS.txt - * SPDX-License-Identifier: MPL-2.0 - * This file is part of Antares-Simulator, - * Adequacy and Performance assessment for interconnected energy networks. - * - * Antares_Simulator is free software: you can redistribute it and/or modify - * it under the terms of the Mozilla Public Licence 2.0 as published by - * the Mozilla Foundation, either version 2 of the License, or - * (at your option) any later version. - * - * Antares_Simulator is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * Mozilla Public Licence 2.0 for more details. - * - * You should have received a copy of the Mozilla Public Licence 2.0 - * along with Antares_Simulator. If not, see . - */ - -#pragma once - -#include - -// --------------------------------------------- -// Optimization period as string : base class -// -------------------------------------------- -class OptPeriodStringGenerator -{ -public: - virtual std::string to_string() const = 0; - virtual ~OptPeriodStringGenerator() = default; -}; diff --git a/src/solver/utils/CMakeLists.txt b/src/solver/utils/CMakeLists.txt index e5ad63c05e..16cf2a96e5 100644 --- a/src/solver/utils/CMakeLists.txt +++ b/src/solver/utils/CMakeLists.txt @@ -35,7 +35,6 @@ target_link_libraries(utils Antares::result_writer #ortools_utils.h Antares::optimization-options antares-core #enum.h - model_antares #opt_period_string_generator.h -> antares/solver/optimisation/opt_period_string_generator_base.h ) target_include_directories(utils diff --git a/src/solver/utils/filename.cpp b/src/solver/utils/filename.cpp index 4e8b9e0482..cc71083350 100644 --- a/src/solver/utils/filename.cpp +++ b/src/solver/utils/filename.cpp @@ -22,10 +22,6 @@ #include -#include "antares/solver/optimisation/opt_period_string_generator_base.h" - -#include "include/antares/solver/utils/opt_period_string_generator.h" - // ------------------------------------ // Optimization period factory // ------------------------------------ diff --git a/src/solver/utils/include/antares/solver/utils/filename.h b/src/solver/utils/include/antares/solver/utils/filename.h index 0ce354bfab..472d8f8477 100644 --- a/src/solver/utils/include/antares/solver/utils/filename.h +++ b/src/solver/utils/include/antares/solver/utils/filename.h @@ -23,7 +23,7 @@ #include #include -#include "antares/solver/optimisation/opt_period_string_generator_base.h" +#include "opt_period_string_generator.h" std::shared_ptr createOptPeriodAsString(bool isOptimizationWeekly, unsigned int day, diff --git a/src/solver/utils/include/antares/solver/utils/opt_period_string_generator.h b/src/solver/utils/include/antares/solver/utils/opt_period_string_generator.h index 36b5630211..f19a65bcfa 100644 --- a/src/solver/utils/include/antares/solver/utils/opt_period_string_generator.h +++ b/src/solver/utils/include/antares/solver/utils/opt_period_string_generator.h @@ -19,6 +19,7 @@ ** along with Antares_Simulator. If not, see . */ #pragma once +#include /* MPS and criterion generated files wear the same time interval sequence in their names. @@ -35,7 +36,12 @@ called. */ -#include "antares/solver/optimisation/opt_period_string_generator_base.h" +class OptPeriodStringGenerator +{ +public: + virtual std::string to_string() const = 0; + virtual ~OptPeriodStringGenerator() = default; +}; // ------------------------------------ // Daily optimization