Skip to content

Commit

Permalink
Merge remote-tracking branch 'refs/remotes/origin/develop' into relea…
Browse files Browse the repository at this point in the history
…se/1.4.0

# Conflicts:
#	antares-version.json
  • Loading branch information
JasonMarechal25 committed Nov 15, 2024
2 parents 2d3f7c0 + 0468736 commit f22e352
Show file tree
Hide file tree
Showing 26 changed files with 511 additions and 212 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build_centos7.yml
Original file line number Diff line number Diff line change
Expand Up @@ -176,10 +176,10 @@ jobs:
cmake --build _build --config Release -j$(nproc)
- name: Run cucumber on outer_loop tests
- name: Tests with Cucumber
uses: ./.github/workflows/cucumber-tests
with:
feature: "features/outer_loop_tests.feature"
# feature: "features/outer_loop_tests.feature"
mpi_path: ${GITHUB_WORKSPACE}/_build/vcpkg_installed/x64-linux-release/tools/openmpi/bin

- name: Cache vcpkg binary dir
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build_oracle8.yml
Original file line number Diff line number Diff line change
Expand Up @@ -146,10 +146,10 @@ jobs:
cmake --build _build --config Release -j$(nproc)
- name: Run cucumber on outer_loop tests
- name: Tests with Cucumber
uses: ./.github/workflows/cucumber-tests
with:
feature: "features/outer_loop_tests.feature"
# feature: "features/outer_loop_tests.feature"
mpi_path: ${GITHUB_WORKSPACE}/_build/vcpkg_installed/x64-linux-release/tools/openmpi/bin

- name: Running unit tests
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/build_ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -150,13 +150,12 @@ jobs:
run: |
cmake --build _build --config Release -j$(nproc)
- name: Run cucumber on outer_loop tests
- name: Tests with Cucumber
uses: ./.github/workflows/cucumber-tests
with:
feature: "features/outer_loop_tests.feature"
# feature: "features/outer_loop_tests.feature"
mpi_path: ${{ github.workspace }}/_build/vcpkg_installed/x64-linux-release/tools/openmpi/bin


- name: Test
run: |
export PATH=${GITHUB_WORKSPACE}/_build/vcpkg_installed/x64-linux-release/tools/openmpi/bin:$PATH
Expand Down
7 changes: 3 additions & 4 deletions .github/workflows/build_windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
VCPKG_ROOT: ${{ github.workspace }}/vcpkg
VCPKG_BINARY_SOURCES: "clear;files,${{ github.workspace }}/vcpkg_cache,readwrite"
ORTOOLS_DIR: $GITHUB_WORKSPACE/or-tools
ORTOOLS_URL: "https://github.com/rte-france/or-tools-rte/releases/download/v9.11-rte1.1/ortools_cxx_windows-latest_static.zip"
ORTOOLS_URL: "https://github.com/rte-france/or-tools-rte/releases/download/v9.11-rte1.1/ortools_cxx_windows-latest_static_sirius.zip"

outputs:
zip_name: ${{ steps.zip_name.outputs.zip_name }}
Expand Down Expand Up @@ -128,12 +128,11 @@ jobs:
cmake --build _build --config Release -j4
- name: Run cucumber on outer_loop tests
- name: Tests with Cucumber
uses: ./.github/workflows/cucumber-tests
with:
feature: "features/outer_loop_tests.feature"
# feature: "features/outer_loop_tests.feature"
mpi_path: /c/Program Files/Microsoft MPI/Bin


- name: Cache vcpkg binary dir
if: always()
Expand Down
3 changes: 3 additions & 0 deletions CMakeGraphVizOptions.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
set(GRAPHVIZ_GENERATE_PER_TARGET FALSE)
set(GRAPHVIZ_IGNORE_TARGETS ".*test.*")
set(GRAPHVIZ_EXTERNAL_LIBS FALSE)
7 changes: 7 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -407,3 +407,10 @@ endif ()
#version file to define Xpansion and Antares-simulator versions
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/python/antares_xpansion/__version__.py.in ${CMAKE_CURRENT_SOURCE_DIR}/src/python/antares_xpansion/__version__.py)
include(CPack)

add_custom_target(graphviz
COMMAND ${CMAKE_COMMAND} "--graphviz=xpansion.dot" .
COMMAND dot -Tsvg xpansion.dot -o xpansion.svg
COMMAND dot -Tpng xpansion.dot -o xpansion.png
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}"
)
2 changes: 1 addition & 1 deletion antares-version.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"antares_version": "9.2.0-rc4",
"antares_version": "9.2.0-RC5",
"antares_version_executable": "9.2",
"antares_xpansion_version": "1.4.0",
"minizip_ng_version": "3.0.6",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ Alternatively you can install openmpi yourself
## Other dependencies
- Antares Simulator: either build it from source, download precompiled binaries or use the automatic build method
- Or-tools: either build it from source, download precompiled binaries or use the automatic build method
- If you are downloading pre-compiled binaries of or-tools you need to select a version supporting Sirius solver

### Using pre-build dependency
If using built from source or pre-built release of Simulator, Or-tools-rte or other dependency, you can specify the path to the dependency in the CMake configuration.
Expand Down
File renamed without changes.
30 changes: 30 additions & 0 deletions src/cpp/benders/benders_core/BendersMathLogger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,16 @@ LogDestination::LogDestination(const std::filesystem::path& file_path,
std::cerr << err_msg.str();
}
}
void LogDestination::setDelimiter(const std::string& delimiter) {
delimiter_ = delimiter;
}

void MathLoggerBehaviour::write_header() {
setHeadersList();
LogsDestination().InsertDelimiter();
for (const auto& header : Headers()) {
LogsDestination() << header;
LogsDestination().InsertDelimiter();
}
LogsDestination() << std::endl;
}
Expand Down Expand Up @@ -154,36 +159,54 @@ double getDurationNotSolving(double iteration, double master,
void PrintBendersData(LogDestination& log_destination,
const CurrentIterationData& data, const HEADERSTYPE& type,
const BENDERSMETHOD& method) {
log_destination.InsertDelimiter();
log_destination << data.it;
log_destination.InsertDelimiter();
log_destination << std::scientific << std::setprecision(10) << data.lb;
log_destination.InsertDelimiter();
if (method == BENDERSMETHOD::BENDERS) {
log_destination << std::scientific << std::setprecision(10) << data.ub;
log_destination.InsertDelimiter();
log_destination << std::scientific << std::setprecision(10) << data.best_ub;
log_destination.InsertDelimiter();
log_destination << std::scientific << std::setprecision(2)
<< data.best_ub - data.lb;
log_destination.InsertDelimiter();
log_destination << std::scientific << std::setprecision(2)
<< (data.best_ub - data.lb) / data.best_ub;
log_destination.InsertDelimiter();
}
log_destination << data.min_simplexiter;
log_destination.InsertDelimiter();
log_destination << data.max_simplexiter;
log_destination.InsertDelimiter();
if (type == HEADERSTYPE::LONG || method == BENDERSMETHOD::BENDERS_BY_BATCH) {
log_destination << data.number_of_subproblem_solved;
log_destination.InsertDelimiter();
}
if (type == HEADERSTYPE::LONG) {
log_destination << data.cumulative_number_of_subproblem_solved;
log_destination.InsertDelimiter();
}

log_destination << std::setprecision(2) << data.iteration_time;
log_destination.InsertDelimiter();

log_destination << std::setprecision(2) << data.timer_master;
log_destination.InsertDelimiter();

log_destination << std::setprecision(2) << data.subproblems_walltime;
log_destination.InsertDelimiter();

if (type == HEADERSTYPE::LONG) {
log_destination << std::setprecision(2)
<< data.subproblems_cumulative_cputime;
log_destination.InsertDelimiter();
log_destination << std::setprecision(2)
<< getDurationNotSolving(data.iteration_time,
data.timer_master,
data.subproblems_walltime);
log_destination.InsertDelimiter();
}
log_destination << std::endl;
}
Expand All @@ -192,20 +215,27 @@ void PrintExternalLoopData(LogDestination& log_destination,
const CurrentIterationData& data,
const HEADERSTYPE& type,
const BENDERSMETHOD& method) {
log_destination.InsertDelimiter();
log_destination << data.outer_loop_current_iteration_data.benders_num_run;
log_destination.InsertDelimiter();
log_destination << std::scientific << std::setprecision(10)
<< data.outer_loop_current_iteration_data.max_criterion;
log_destination.InsertDelimiter();
log_destination << data.outer_loop_current_iteration_data.max_criterion_area;
log_destination.InsertDelimiter();

log_destination
<< std::scientific << std::setprecision(10)
<< data.outer_loop_current_iteration_data.outer_loop_bilevel_best_ub;
log_destination.InsertDelimiter();
log_destination
<< std::scientific << std::setprecision(10)
<< data.outer_loop_current_iteration_data.external_loop_lambda;
log_destination.InsertDelimiter();
log_destination
<< std::scientific << std::setprecision(10)
<< data.outer_loop_current_iteration_data.external_loop_lambda_min;
log_destination.InsertDelimiter();
log_destination
<< std::scientific << std::setprecision(10)
<< data.outer_loop_current_iteration_data.external_loop_lambda_max;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,16 @@ class LogDestination {

template <class T>
std::ostream& operator<<(const T& obj);
std::ostream& InsertDelimiter() { return *stream_ << delimiter_; }

private:
std::ofstream file_stream_;
std::ostream* stream_;
std::streamsize width_ = 40;
std::string delimiter_ = "\t";

public:
void setDelimiter(const std::string& delimiter);
};
template <class T>
std::ostream& LogDestination::operator<<(const T& obj) {
Expand Down Expand Up @@ -214,10 +219,14 @@ void MathLoggerExternalLoopSpecific<T>::setHeadersList() {
template <class T>
void MathLoggerExternalLoopSpecific<T>::Print(
const CurrentIterationData& data) {
LogsDestination().InsertDelimiter();
LogsDestination() << data.outer_loop_current_iteration_data.benders_num_run;
LogsDestination().InsertDelimiter();
LogsDestination() << data.it;
LogsDestination().InsertDelimiter();
for (const auto& t : data.outer_loop_current_iteration_data.*ptr_) {
LogsDestination() << std::scientific << std::setprecision(10) << t;
LogsDestination().InsertDelimiter();
}
LogsDestination() << std::endl;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ struct OuterLoopCurrentIterationData{
double external_loop_lambda = 0.;
double external_loop_lambda_min = 0.;
double external_loop_lambda_max = 0.;
std::string max_criterion_area;
std::string max_criterion_area_best_it;
std::string max_criterion_area = "N/A";
std::string max_criterion_area_best_it = "N/A";
};
/*! \struct
* struct that hold current Benders iteration
Expand Down
4 changes: 3 additions & 1 deletion src/cpp/benders/factories/BendersFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,9 @@ BendersMainFactory::ProcessCriterionInput() {
const auto fpath = std::filesystem::path(options_.INPUTROOT) /
options_.OUTER_LOOP_OPTION_FILE;
// if adequacy_criterion.yml is provided read it
if (std::filesystem::exists(fpath)) {
if ((method_ == BENDERSMETHOD::BENDERS_OUTERLOOP ||
method_ == BENDERSMETHOD::BENDERS_BY_BATCH_OUTERLOOP) &&
std::filesystem::exists(fpath)) {
return Benders::Criterion::OuterLoopInputFromYaml().Read(fpath);
}
// else compute criterion for all areas!
Expand Down
2 changes: 1 addition & 1 deletion src/python/antares_xpansion/problem_generator_driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ def create_lp_dir(self):
def lp_namer_options(self):
is_relaxed = 'relaxed' if self.is_relaxed else 'integer'
if self.memory:
ret = ["--study", str(self.study_path), "-f", is_relaxed] # study/output/xpansion_output_dir
ret = ["--study", str(os.path.normpath(self.study_path)), "-f", is_relaxed] # study/output/xpansion_output_dir
else:
ret = ["-a", str(self.output_path), "-f", is_relaxed]
if self.weight_file_name_for_lp:
Expand Down
Loading

0 comments on commit f22e352

Please sign in to comment.