Skip to content

Commit

Permalink
cherry pick 9cbf137
Browse files Browse the repository at this point in the history
  • Loading branch information
flomnes authored and payetvin committed Jul 15, 2024
1 parent d65a918 commit b022393
Showing 1 changed file with 25 additions and 2 deletions.
27 changes: 25 additions & 2 deletions src/tools/batchrun/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,16 @@
#include <yuni/core/nullable.h>
#include <map>
#include <iostream>
#include <string>
#include <yuni/core/string.h>
#include <yuni/core/getopt.h>
#include <antares/study/finder.h>
#include "../../ui/common/winmain.hxx"
#include <antares/version.h>
#include <antares/locale.h>
#include <antares/args/args_to_utf8.h>
#include <antares/solver/utils/ortools_utils.h>

#ifdef YUNI_OS_WINDOWS
#include <process.h>
#endif
Expand Down Expand Up @@ -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;
Expand All @@ -95,6 +100,7 @@ int main(int argc, char* argv[])
bool optNoOutput = false;
bool optParallel = false;
bool optVerbose = false;
bool ortoolsUsed = false;
Nullable<uint> optYears;
Nullable<String> optSolver;
Nullable<String> optName;
Expand Down Expand Up @@ -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.");
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit b022393

Please sign in to comment.