From b022393c45456fdbb4a19b38adf02202db030b9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20Omn=C3=A8s?= <26088210+flomnes@users.noreply.github.com> Date: Fri, 8 Mar 2024 15:11:47 +0100 Subject: [PATCH] cherry pick 9cbf137 --- src/tools/batchrun/main.cpp | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/src/tools/batchrun/main.cpp b/src/tools/batchrun/main.cpp index 34635bfe07..d937c8325d 100644 --- a/src/tools/batchrun/main.cpp +++ b/src/tools/batchrun/main.cpp @@ -32,12 +32,16 @@ #include #include #include +#include #include #include #include #include "../../ui/common/winmain.hxx" #include #include +#include +#include + #ifdef YUNI_OS_WINDOWS #include #endif @@ -84,7 +88,8 @@ int main(int argc, char* argv[]) Antares::Resources::Initialize(argc, argv, true); // options - String optInput; + std::string optInput; + std::string ortoolsSolver; bool optNoTSImport = false; bool optIgnoreAllConstraints = false; bool optForceExpansion = false; @@ -95,6 +100,7 @@ int main(int argc, char* argv[]) bool optNoOutput = false; bool optParallel = false; bool optVerbose = false; + bool ortoolsUsed = false; Nullable optYears; Nullable optSolver; Nullable optName; @@ -143,6 +149,20 @@ int main(int argc, char* argv[]) ' ', "force-parallel", "Override the max number of years computed simultaneously"); + + // add option for ortools use + // --use-ortools + options.addFlag(ortoolsUsed, ' ', "use-ortools", "Use ortools library to launch solver"); + + //--ortools-solver + options.add(ortoolsSolver, + ' ', + "ortools-solver", + "Ortools solver used for simulation (only available with use-ortools " + "option)\nAvailable solver list : " + + availableOrToolsSolversString()); + + options.remainingArguments(optInput); // Version options.addParagraph("\nMisc."); @@ -276,8 +296,11 @@ int main(int argc, char* argv[]) cmd << " --no-constraints"; if (optParallel) cmd << " --parallel"; - if (!(!optForceParallel)) + if (optForceParallel) cmd << " --force-parallel=" << *optForceParallel; + if (ortoolsUsed) + cmd << " --ortools-solver=" << ortoolsSolver; + cmd << " \"" << studypath << "\""; if (!optVerbose) cmd << sendToNull();