Skip to content

Commit

Permalink
Remove Sirius direct call : all developments in one
Browse files Browse the repository at this point in the history
  • Loading branch information
guilpier-code committed Oct 2, 2024
1 parent 2d77d87 commit 54d88cb
Show file tree
Hide file tree
Showing 24 changed files with 126 additions and 226 deletions.
30 changes: 15 additions & 15 deletions .github/workflows/ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -150,14 +150,14 @@ jobs:
run: |
git submodule update --init --remote --recursive src/tests/resources/Antares_Simulator_Tests_NR
- name: Run named mps tests
if: ${{ env.RUN_SIMPLE_TESTS == 'true' && !cancelled() }}
uses: ./.github/workflows/run-tests
with:
simtest-tag: ${{ env.SIMTEST }}
batch-name: valid-named-mps
os: ${{ env.os }}
variant: "named-mps"
#- name: Run named mps tests
# if: ${{ env.RUN_SIMPLE_TESTS == 'true' && !cancelled() }}
# uses: ./.github/workflows/run-tests
# with:
# simtest-tag: ${{ env.SIMTEST }}
# batch-name: valid-named-mps
# os: ${{ env.os }}
# variant: "named-mps"

- name: Run unfeasibility-related tests
if: ${{ env.RUN_SIMPLE_TESTS == 'true' && !cancelled() }}
Expand Down Expand Up @@ -240,13 +240,13 @@ jobs:
with:
feature: "features/short_tests.feature"

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

- name: Run tests for adequacy patch (CSR)
if: ${{ env.RUN_SIMPLE_TESTS == 'true' && !cancelled() }}
Expand Down
46 changes: 23 additions & 23 deletions .github/workflows/windows-vcpkg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,14 @@ jobs:
- name: Install pip dependencies if necessary
run: pip install -r src/tests/examples/requirements.txt

- name: Init submodule Antares_Simulator_Tests
run: |
git submodule update --init --remote src/tests/resources/Antares_Simulator_Tests
- name: Init submodule Antares_Simulator_Tests_NR
run: |
git submodule update --init --remote src/tests/resources/Antares_Simulator_Tests_NR
- name: Enable git longpaths
run: git config --system core.longpaths true

Expand Down Expand Up @@ -144,22 +152,14 @@ jobs:
run: |
echo "SIMTEST=${{ fromJson(env.SIMTEST_JSON).version }}" >> $GITHUB_ENV
- name: Init submodule Antares_Simulator_Tests
run: |
git submodule update --init --remote src/tests/resources/Antares_Simulator_Tests
- name: Init submodule Antares_Simulator_Tests_NR
run: |
git submodule update --init --remote src/tests/resources/Antares_Simulator_Tests_NR
- name: Run named mps tests
if: ${{ env.RUN_SIMPLE_TESTS == 'true' && ! cancelled() }}
uses: ./.github/workflows/run-tests
with:
simtest-tag: ${{ env.SIMTEST }}
batch-name: valid-named-mps
os: ${{ env.os }}
variant: "named-mps"
# - name: Run named mps tests
# if: ${{ env.RUN_SIMPLE_TESTS == 'true' && ! cancelled() }}
# uses: ./.github/workflows/run-tests
# with:
# simtest-tag: ${{ env.SIMTEST }}
# batch-name: valid-named-mps
# os: ${{ env.os }}
# variant: "named-mps"

- name: Run unfeasibility-related tests
if: ${{ env.RUN_SIMPLE_TESTS == 'true' && ! cancelled() }}
Expand Down Expand Up @@ -250,13 +250,13 @@ jobs:
with:
feature: "features/short_tests.feature"

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

- name: Run parallel tests
if: ${{ env.RUN_EXTENDED_TESTS == 'true' && !cancelled() }}
Expand Down
16 changes: 2 additions & 14 deletions src/libs/antares/InfoCollection/StudyInfoCollector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ void StudyInfoCollector::toFileContent(FileContent& file_content)
unitCommitmentModeToFileContent(file_content);
maxNbYearsInParallelToFileContent(file_content);
solverVersionToFileContent(file_content);
ORToolsUsed(file_content);
ORToolsSolver(file_content);
}

Expand Down Expand Up @@ -144,21 +143,10 @@ void StudyInfoCollector::solverVersionToFileContent(FileContent& file_content)
file_content.addItemToSection("study", "antares version", version);
}

void StudyInfoCollector::ORToolsUsed(FileContent& file_content)
{
const bool& ortoolsUsed = study_.parameters.optOptions.ortoolsUsed;
file_content.addItemToSection("study", "ortools used", ortoolsUsed ? "true" : "false");
}

void StudyInfoCollector::ORToolsSolver(FileContent& file_content)
{
const bool& ortoolsUsed = study_.parameters.optOptions.ortoolsUsed;
std::string ortoolsSolver = "none";
if (ortoolsUsed)
{
ortoolsSolver = study_.parameters.optOptions.ortoolsSolver;
}
file_content.addItemToSection("study", "ortools solver", ortoolsSolver);
std::string solverName = study_.parameters.optOptions.ortoolsSolver;
file_content.addItemToSection("study", "ortools solver", solverName);
}

// Collecting data optimization problem
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ class StudyInfoCollector
void maxNbYearsInParallelToFileContent(FileContent& file_content);
void solverVersionToFileContent(FileContent& file_content);

void ORToolsUsed(FileContent& file_content);
void ORToolsSolver(FileContent& file_content);

// Member data
Expand Down
13 changes: 2 additions & 11 deletions src/libs/antares/checks/checkLoadedInputData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,21 +30,12 @@
namespace Antares::Check
{
void checkOrtoolsUsage(Antares::Data::UnitCommitmentMode ucMode,
bool ortoolsUsed,
const std::string& solverName)
{
using namespace Antares::Data;
if (ucMode == UnitCommitmentMode::ucMILP)
if (ucMode == UnitCommitmentMode::ucMILP && solverName == "sirius")
{
if (!ortoolsUsed)
{
throw Error::IncompatibleMILPWithoutOrtools();
}

if (solverName == "sirius")
{
throw Error::IncompatibleMILPOrtoolsSolver();
}
throw Error::IncompatibleMILPOrtoolsSolver();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ namespace Antares::Check
{

void checkOrtoolsUsage(Antares::Data::UnitCommitmentMode ucMode,
bool ortoolsUsed,
const std::string& solverName);

void checkStudyVersion(const AnyString& optStudyFolder);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ namespace Antares::Solver::Optimization

struct OptimizationOptions
{
//! Force ortools use
bool ortoolsUsed = false;
//! The solver name, sirius is the default
std::string ortoolsSolver = "sirius";
bool solverLogs = false;
Expand Down
8 changes: 1 addition & 7 deletions src/libs/antares/study/parameters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1230,7 +1230,6 @@ bool Parameters::loadFromINI(const IniFile& ini, const StudyVersion& version)
void Parameters::handleOptimizationOptions(const StudyLoadOptions& options)
{
// Options only set from the command-line
optOptions.ortoolsUsed = options.optOptions.ortoolsUsed;
optOptions.ortoolsSolver = options.optOptions.ortoolsSolver;
optOptions.solverParameters = options.optOptions.solverParameters;

Expand Down Expand Up @@ -1730,12 +1729,7 @@ void Parameters::prepareForSimulation(const StudyLoadOptions& options)
logs.info() << " :: ignoring hurdle costs";
}

// Indicate ortools solver used
if (options.optOptions.ortoolsUsed)
{
logs.info() << " :: ortools solver " << options.optOptions.ortoolsSolver
<< " used for problem resolution";
}
logs.info() << " :: solver " << options.optOptions.ortoolsSolver << " is used for problem resolution";

// indicated that Problems will be named
if (namedProblems)
Expand Down
1 change: 0 additions & 1 deletion src/solver/application/application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,6 @@ void Application::postParametersChecks() const
{ // Some more checks require the existence of pParameters, hence of a study.
// Their execution is delayed up to this point.
checkOrtoolsUsage(pParameters->unitCommitment.ucMode,
pParameters->optOptions.ortoolsUsed,
pParameters->optOptions.ortoolsSolver);

checkSimplexRangeHydroPricing(pParameters->simplexOptimizationRange,
Expand Down
31 changes: 10 additions & 21 deletions src/solver/misc/options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,19 +76,11 @@ 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,
' ',
"ortools-solver",
"Ortools solver used for simulation (only available with use-ortools "
"option)\nAvailable solver list : "
"solver",
"Solver used for simulation\nAvailable solver list : "
+ availableOrToolsSolversString());

//--xpress-parameters
Expand Down Expand Up @@ -266,18 +258,15 @@ void checkAndCorrectSettingsAndOptions(Settings& settings, Data::StudyLoadOption

void checkOrtoolsSolver(const Antares::Solver::Optimization::OptimizationOptions& optOptions)
{
if (optOptions.ortoolsUsed)
{
const std::string& solverName = optOptions.ortoolsSolver;
const std::list<std::string> availableSolverList = getAvailableOrtoolsSolverName();
const std::string& solverName = optOptions.ortoolsSolver;
const std::list<std::string> availableSolverList = getAvailableOrtoolsSolverName();

// Check if solver is available
bool found = (std::find(availableSolverList.begin(), availableSolverList.end(), solverName)
!= availableSolverList.end());
if (!found)
{
throw Error::InvalidSolver(optOptions.ortoolsSolver, availableOrToolsSolversString());
}
// Check if solver is available
bool found = (std::find(availableSolverList.begin(), availableSolverList.end(), solverName)
!= availableSolverList.end());
if (!found)
{
throw Error::InvalidSolver(optOptions.ortoolsSolver, availableOrToolsSolversString());
}
}

Expand Down
Loading

0 comments on commit 54d88cb

Please sign in to comment.