Skip to content

Commit

Permalink
Release 8.8.7 (#2262)
Browse files Browse the repository at this point in the history
Co-authored-by: Florian Omnès <[email protected]>
  • Loading branch information
payetvin and flomnes authored Jul 17, 2024
1 parent f10fa2b commit 2d9adcb
Show file tree
Hide file tree
Showing 3 changed files with 174 additions and 139 deletions.
2 changes: 1 addition & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.14) # FetchContent_MakeAvailable
# Version
set(ANTARES_VERSION_HI 8)
set(ANTARES_VERSION_LO 8)
set(ANTARES_VERSION_REVISION 6)
set(ANTARES_VERSION_REVISION 7)

# Beta release
set(ANTARES_BETA 0)
Expand Down
6 changes: 3 additions & 3 deletions src/solver/optimisation/post_process_commands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -256,9 +256,9 @@ double CurtailmentSharingPostProcessCmd::calculateDensNewAndTotalLmrViolation()
const auto& scratchpad = area_list_[Area]->scratchpad[thread_number_];
double dtgMrg = scratchpad.dispatchableGenerationMargin[hour];
// write down densNew values for all the hours
problemeHebdo_->ResultatsHoraires[Area].ValeursHorairesDENS[hour]
= std::max(0.0, densNew - dtgMrg);
;
problemeHebdo_->ResultatsHoraires[Area].ValeursHorairesDENS[hour] = std::max(
0.0,
densNew);
// copy spilled Energy values into spilled Energy values after CSR
problemeHebdo_->ResultatsHoraires[Area].ValeursHorairesSpilledEnergyAfterCSR[hour]
= problemeHebdo_->ResultatsHoraires[Area]
Expand Down
305 changes: 170 additions & 135 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 <antares/args/args_to_utf8.h>
#include <antares/study/version.h>
#include <antares/version.h>
#include <antares/locale.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,19 @@ 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 @@ -176,163 +195,179 @@ int main(int argc, char* argv[])
logs.error() << "contradictory options: --economy and --adequacy";
return EXIT_FAILURE;
}
}

// Source Folder
logs.debug() << "Folder : `" << optInput << '`';

String solver;
if (optSolver.empty())
{
Solver::FindLocation(solver);
if (solver.empty())
if (ortoolsUsed)
{
logs.fatal() << "The solver has not been found";
return EXIT_FAILURE;
}
}
else
{
String tmp;
IO::MakeAbsolute(tmp, *optSolver);
IO::Normalize(solver, tmp);
if (not IO::File::Exists(solver))
{
logs.fatal() << "The solver has not been found. specify --solver=" << solver;
return EXIT_FAILURE;
const auto availableSolvers = getAvailableOrtoolsSolverName();
if (auto it
= std::find(availableSolvers.begin(), availableSolvers.end(), ortoolsSolver);
it == availableSolvers.end())
{
logs.error() << "Please specify a solver using --ortools-solver. Available solvers "
<< availableOrToolsSolversString() << "";
return EXIT_FAILURE;
}
}
}

logs.info() << " Solver: '" << solver << "'";
logs.info();
logs.info();
logs.info() << "Searching for studies...";
logs.info();
MyStudyFinder finder;
finder.lookup(optInput);
finder.wait();
// Source Folder
logs.debug() << "Folder : `" << optInput << '`';

if (not finder.list.empty())
{
if (finder.list.size() > 1)
logs.info() << "Found " << finder.list.size() << " studyies";
String solver;
if (optSolver.empty())
{
Solver::FindLocation(solver);
if (solver.empty())
{
logs.fatal() << "The solver has not been found";
return EXIT_FAILURE;
}
}
else
logs.info() << "Found 1 study";
logs.info() << "Starting...";

if (!(!optName))
{
String name;
name = *optName;
name.replace("\"", "\\\"");
*optName = name;
String tmp;
IO::MakeAbsolute(tmp, *optSolver);
IO::Normalize(solver, tmp);
if (not IO::File::Exists(solver))
{
logs.fatal() << "The solver has not been found. specify --solver=" << solver;
return EXIT_FAILURE;
}
}

// The folder that contains the solver
String dirname;
IO::parentPath(dirname, solver);
logs.info() << " Solver: '" << solver << "'";
logs.info();
logs.info();
logs.info() << "Searching for studies...";
logs.info();
MyStudyFinder finder;
finder.lookup(optInput);
finder.wait();

String cmd;

uint studyIndx = 0;
foreach (auto& studypath, finder.list)
if (not finder.list.empty())
{
++studyIndx;

logs.info();
if (optVerbose)
logs.info();

logs.checkpoint() << "Running simulation: `" << studypath << "` (" << studyIndx << '/'
<< (uint)finder.list.size() << ')';
if (optVerbose)
logs.debug();

cmd.clear();
if (not System::windows)
cmd << "nice ";
if (finder.list.size() > 1)
logs.info() << "Found " << finder.list.size() << " studyies";
else
cmd << "call "; // why is it required for working ???
cmd << "\"" << solver << "\"";
if (optForce)
cmd << " --force";
if (optForceExpansion)
cmd << " --economy";
if (optForceEconomy)
cmd << " --economy";
if (optForceAdequacy)
cmd << " --adequacy";
logs.info() << "Found 1 study";
logs.info() << "Starting...";

if (!(!optName))
cmd << " --name=\"" << *optName << "\"";
if (!(!optYears))
cmd << " --year=" << *optYears;
if (optNoOutput)
cmd << " --no-output";
if (optYearByYear)
cmd << " --year-by-year";
if (optNoTSImport)
cmd << " --no-ts-import";
if (optIgnoreAllConstraints)
cmd << " --no-constraints";
if (optParallel)
cmd << " --parallel";
if (!(!optForceParallel))
cmd << " --force-parallel=" << *optForceParallel;
cmd << " \"" << studypath << "\"";
if (!optVerbose)
cmd << sendToNull();

// Changing the current working directory
IO::Directory::Current::Set(dirname);
// Executing the converter
if (optVerbose)
logs.info() << "Executing " << cmd;
{
String name;
name = *optName;
name.replace("\"", "\\\"");
*optName = name;
}

// Execute the command
int cmd_return_code = system(cmd.c_str());
// The folder that contains the solver
String dirname;
IO::parentPath(dirname, solver);

if (cmd_return_code != 0)
logs.error() << "An error occured.";
else
logs.info() << "Success.";
String cmd;

if (cmd_return_code == -1)
uint studyIndx = 0;
foreach (auto& studypath, finder.list)
{
#ifdef YUNI_OS_WINDOWS
switch (errno)
++studyIndx;

logs.info();
if (optVerbose)
logs.info();

logs.checkpoint() << "Running simulation: `" << studypath << "` (" << studyIndx
<< '/' << (uint)finder.list.size() << ')';
if (optVerbose)
logs.debug();

cmd.clear();
if (not System::windows)
cmd << "nice ";
else
cmd << "call "; // why is it required for working ???
cmd << "\"" << solver << "\"";
if (optForce)
cmd << " --force";
if (optForceExpansion)
cmd << " --economy";
if (optForceEconomy)
cmd << " --economy";
if (optForceAdequacy)
cmd << " --adequacy";
if (!(!optName))
cmd << " --name=\"" << *optName << "\"";
if (!(!optYears))
cmd << " --year=" << *optYears;
if (optNoOutput)
cmd << " --no-output";
if (optYearByYear)
cmd << " --year-by-year";
if (optNoTSImport)
cmd << " --no-ts-import";
if (optIgnoreAllConstraints)
cmd << " --no-constraints";
if (optParallel)
cmd << " --parallel";
if (optForceParallel)
cmd << " --force-parallel=" << *optForceParallel;
if (ortoolsUsed)
cmd << " --use-ortools --ortools-solver=" << ortoolsSolver;

cmd << " \"" << studypath << "\"";
if (!optVerbose)
cmd << sendToNull();

// Changing the current working directory
IO::Directory::Current::Set(dirname);
// Executing the converter
if (optVerbose)
logs.info() << "Executing " << cmd;

// Execute the command
int cmd_return_code = system(cmd.c_str());

if (cmd_return_code != 0)
logs.error() << "An error occured.";
else
logs.info() << "Success.";

if (cmd_return_code == -1)
{
case E2BIG:
logs.error() << "Argument list (which is system dependent) is too big";
break;
case ENOENT:
logs.error() << "Command interpreter cannot be found";
break;
case ENOEXEC:
logs.error()
<< "Command-interpreter file has invalid format and is not executable";
break;
case ENOMEM:
logs.error() << "Not enough memory is available to execute command";
break;
}
#ifdef YUNI_OS_WINDOWS
switch (errno)
{
case E2BIG:
logs.error() << "Argument list (which is system dependent) is too big";
break;
case ENOENT:
logs.error() << "Command interpreter cannot be found";
break;
case ENOEXEC:
logs.error()
<< "Command-interpreter file has invalid format and is not executable";
break;
case ENOMEM:
logs.error() << "Not enough memory is available to execute command";
break;
}
#endif
}
}
}

logs.info() << "Done.";
logs.info() << "Done.";

// Time interval
if (optVerbose)
// Time interval
if (optVerbose)
{
logs.debug();
logs.debug();
}
}
else
{
logs.debug();
logs.debug();
logs.fatal() << "No study has been found.";
return 4;
}
}
else
{
logs.fatal() << "No study has been found.";
return 4;
}

return 0;
return 0;
}
}

0 comments on commit 2d9adcb

Please sign in to comment.