Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/issue 688 #695

Closed
wants to merge 13 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions .github/workflows/build_windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ jobs:
# The key includes: hash of the vcpkg.json file, the hash of the vcpkg Git commit id, and the used vcpkg's triplet. The vcpkg's commit id would suffice, but computing an hash out it does not harm.
# Note: given a key, the cache content is immutable. If a cache entry has been created improperly, in order the recreate the right content the key must be changed as well, and it must be brand new (i.e. not existing already).
key: |
${{ hashFiles( 'vcpkg_manifest/vcpkg.json' ) }}-${{ hashFiles( '.git/modules/vcpkg/HEAD' )}}-${{ matrix.triplet }}
${{ hashFiles( 'vcpkg.json' ) }}-${{ hashFiles( '.git/modules/vcpkg/HEAD' )}}-${{ matrix.triplet }}

- name: Install dependencies
run: |
Expand Down Expand Up @@ -103,12 +103,17 @@ jobs:
run: |
cd vcpkg
./bootstrap-vcpkg.sh
vcpkg install jsoncpp gtest boost-mpi boost-program-options tbb zlib --triplet ${{matrix.triplet}}
vcpkg install --triplet ${{matrix.triplet}}
rm -rf buildtrees
rm -rf packages
rm -rf downloads
shell: bash

- name: Compile tbb
uses: ./.github/workflows/compile-tbb
with:
cmake: 'cmake'

- name: Download pre-compiled librairies
uses: ./.github/workflows/download-extract-precompiled-libraries-zip
with:
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/centos7-system-deps-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,10 @@ jobs:
prefix: "../rte-antares-deps-Release/"

- name: Compile tbb
uses: ./.github/workflows/compile-tbb

uses: ./.github/workflows/compile-tbb
with:
cmake: 'cmake3'

- name: Configure
run: |
source /opt/rh/devtoolset-9/enable
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/compile-tbb/action.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
name: "Download and compile tbb"
description: "tbb is required for execution policy (parallelization c++)."
inputs:
cmake:
description: 'cmake version'
required: true
runs:
using: "composite"
steps:
Expand All @@ -8,5 +12,5 @@ runs:
run: |
git clone https://github.com/wjakob/tbb.git
cd tbb/build
cmake3 ..
cmake3 --build . --target install -j8
${{ inputs.cmake }} ..
${{ inputs.cmake }} --build . --target install -j8
1 change: 1 addition & 0 deletions .github/workflows/ubuntu-system.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
- main
- develop
- ci/*
- fix/Issue-688
workflow_dispatch:
release:
types: [ created ]
Expand Down
9 changes: 7 additions & 2 deletions .github/workflows/windows-vcpkg-deps-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:
# The key includes: hash of the vcpkg.json file, the hash of the vcpkg Git commit id, and the used vcpkg's triplet. The vcpkg's commit id would suffice, but computing an hash out it does not harm.
# Note: given a key, the cache content is immutable. If a cache entry has been created improperly, in order the recreate the right content the key must be changed as well, and it must be brand new (i.e. not existing already).
key: |
${{ hashFiles( 'vcpkg_manifest/vcpkg.json' ) }}-${{ hashFiles( '.git/modules/vcpkg/HEAD' )}}-${{ matrix.triplet }}-invalidate
${{ hashFiles( 'vcpkg.json' ) }}-${{ hashFiles( '.git/modules/vcpkg/HEAD' )}}-${{ matrix.triplet }}-invalidate

- name: Install dependencies
run: |
Expand All @@ -76,12 +76,17 @@ jobs:
run: |
cd vcpkg
./bootstrap-vcpkg.sh
vcpkg install jsoncpp gtest boost-mpi boost-program-options tbb zlib --triplet ${{matrix.triplet}}
vcpkg install --triplet ${{matrix.triplet}}
rm -rf buildtrees
rm -rf packages
rm -rf downloads
shell: bash

- name: Compile tbb
uses: ./.github/workflows/compile-tbb
with:
cmake: 'cmake'

- name: Configure
run: |
$pwd=Get-Location
Expand Down
10 changes: 8 additions & 2 deletions .github/workflows/windows-vcpkg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
- main
- develop
- ci/*
- fix/Issue-688
workflow_dispatch:
release:
types: [ created ]
Expand Down Expand Up @@ -102,7 +103,7 @@ jobs:
# The key includes: hash of the vcpkg.json file, the hash of the vcpkg Git commit id, and the used vcpkg's triplet. The vcpkg's commit id would suffice, but computing an hash out it does not harm.
# Note: given a key, the cache content is immutable. If a cache entry has been created improperly, in order the recreate the right content the key must be changed as well, and it must be brand new (i.e. not existing already).
key: |
${{ hashFiles( 'vcpkg_manifest/vcpkg.json' ) }}-${{ hashFiles( '.git/modules/vcpkg/HEAD' )}}-${{ matrix.triplet }}-invalidate
${{ hashFiles( 'vcpkg.json' ) }}-${{ hashFiles( '.git/modules/vcpkg/HEAD' )}}-${{ matrix.triplet }}-invalidate

- name: Install dependencies
run: |
Expand Down Expand Up @@ -142,12 +143,17 @@ jobs:
run: |
cd vcpkg
./bootstrap-vcpkg.sh
vcpkg install jsoncpp gtest boost-mpi boost-program-options tbb zlib --triplet ${{matrix.triplet}}
vcpkg install --triplet ${{matrix.triplet}}
rm -rf buildtrees
rm -rf packages
rm -rf downloads
shell: bash

- name: Compile tbb
uses: ./.github/workflows/compile-tbb
with:
cmake: 'cmake'

- name: Download pre-compiled librairies
uses: ./.github/workflows/download-extract-precompiled-libraries-zip
with:
Expand Down
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ CMAKE_MINIMUM_REQUIRED(VERSION 3.0)
# Project configuration
# ===========================================================================

PROJECT(antaresXpansion VERSION 1.1.0)
set(ANTARES_XPANSION_RC 4)
PROJECT(antaresXpansion VERSION 1.1.1)
#set(ANTARES_XPANSION_RC 5)

# ===========================================================================
# Default parameters
Expand Down
6 changes: 3 additions & 3 deletions antares-version.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"antares_version": "8.5.1",
"antares_version_executable": "8.5",
"antares_xpansion_version": "1.1.0-rc4",
"antares_version": "8.6.3",
"antares_version_executable": "8.6",
"antares_xpansion_version": "1.1.0",
"antares_deps_version": "2.0.6",
"minizip_ng_version": "3.0.6"
}
4 changes: 2 additions & 2 deletions docker/centos7-bare
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM centos:7

# Install requirements : update repo
# Install requirements: update repo
RUN yum update -y

# Install requirements : install epel
Expand Down Expand Up @@ -30,4 +30,4 @@ RUN yum install -y python3-pip &&\

#create user
RUN useradd user
# USER user
# USER user
9 changes: 8 additions & 1 deletion docs/changelog/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
Antares-Xpansion changelog
=================
v1.1 (TBA)
v1.1.0 (09/2023)
--------------------

### Fix

- Update performance graph in the documentation

v1.1.0 (09/2023)
--------------------

### Features
Expand Down
6 changes: 2 additions & 4 deletions docs/user-guide/performance-history/perf-graphs.ipynb

Large diffs are not rendered by default.

28 changes: 28 additions & 0 deletions docs/user-guide/performance-history/perf_data.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,13 @@
"antares": 368,
"problem_generation": 440,
"benders": 2129
},
{
"version": 1.1,
"batch_size": 96,
"antares": 363,
"problem_generation": 453,
"benders": 1111
}
]
},
Expand Down Expand Up @@ -71,6 +78,13 @@
"antares": 436,
"problem_generation": 425,
"benders": 1805
},
{
"version": 1.1,
"batch_size": 96,
"antares": 434,
"problem_generation": 444,
"benders": 980
}
]
},
Expand Down Expand Up @@ -108,6 +122,13 @@
"antares": 364,
"problem_generation": 441,
"benders": 1497
},
{
"version": 1.1,
"batch_size": 96,
"antares": 383,
"problem_generation": 435,
"benders": 1014
}
]
},
Expand Down Expand Up @@ -145,6 +166,13 @@
"antares": 556,
"problem_generation": 472,
"benders": 859
},
{
"version": 1.1,
"batch_size": 96,
"antares": 517,
"problem_generation": 569,
"benders": 521
}
]
}
Expand Down
6 changes: 2 additions & 4 deletions src/cpp/benders/benders_core/Worker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,9 @@ void Worker::init(VariableMap const &variable_map,
_path_to_mps = path_to_mps;
SolverFactory factory;
if (_is_master) {
_solver =
factory.create_solver(solver_name, SOLVER_TYPE::INTEGER, log_name);
_solver = factory.create_solver(solver_name, SOLVER_TYPE::INTEGER);
} else {
_solver =
factory.create_solver(solver_name, SOLVER_TYPE::CONTINUOUS, log_name);
_solver = factory.create_solver(solver_name, SOLVER_TYPE::CONTINUOUS);
}

_solver->init();
Expand Down
20 changes: 20 additions & 0 deletions src/cpp/lpnamer/helper/common_lpnamer.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#pragma once

#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <filesystem>
#include <fstream>
#include <iomanip>
#include <iostream>
Expand Down Expand Up @@ -45,4 +47,22 @@ inline std::vector<std::string> split(const std::string& original,
}
return strings;
}

inline FILE* OpenLogPtr(const std::filesystem::path& log_file) {
FILE* log_file_ptr = NULL;
if (log_file.empty()) {
return log_file_ptr;
}
#ifdef __linux__
if ((log_file_ptr = fopen(log_file.string().c_str(), "a+")) == nullptr)
#elif _WIN32
if ((log_file_ptr = _fsopen(log_file.string().c_str(), "a+", _SH_DENYNO)) ==
nullptr)
#endif
{
std::cerr << "Invalid log file name passed as parameter: " << log_file
<< std::endl;
}
return log_file_ptr;
}
} // namespace common_lpnamer
1 change: 1 addition & 0 deletions src/cpp/lpnamer/model/Problem.h
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ class Problem : public SolverAbstract {
void read_basis(const std::filesystem::path &filename) override {
solver_abstract_->read_basis(filename);
}
void set_fp(FILE *fp) override { solver_abstract_->set_fp(fp); }
};

#endif // ANTARESXPANSION_SRC_CPP_LPNAMER_MODEL_PROBLEM_H_
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,10 @@
std::shared_ptr<Problem>
AntaresProblemToXpansionProblemTranslator::translateToXpansionProblem(
const LpsFromAntares& lps, unsigned int year, unsigned int week,
const std::string& solver_name,
const std::filesystem::path& log_file_path) {
const std::string& solver_name, FILE* log_file_ptr) {
SolverFactory factory;
auto problem = std::make_shared<Problem>(
factory.create_solver(solver_name, log_file_path));
auto problem = std::make_shared<Problem>(factory.create_solver(solver_name));
problem->set_fp(log_file_ptr);
problem->init();
const auto& constant = lps._constant;
const auto& hebdo = lps._hebdo.at({year, week});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@

#pragma once

#include <cstdio>

#include "../model/Problem.h"
#include "LpsFromAntares.h"

class AntaresProblemToXpansionProblemTranslator {
public:
[[nodiscard]] static std::shared_ptr<Problem> translateToXpansionProblem(
const LpsFromAntares& lps, unsigned int year, unsigned int week,
const std::string& solver_name,
const std::filesystem::path& log_file_path);
const std::string& solver_name, FILE* log_file_ptr);
static std::vector<char> convertSignToLEG(char* data);
};
5 changes: 3 additions & 2 deletions src/cpp/lpnamer/problem_modifier/IProblemProviderPort.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@

#pragma once

#include <cstdio>

#include "../../lpnamer/model/Problem.h"

class IProblemProviderPort {
public:
virtual ~IProblemProviderPort() = default;
[[nodiscard]] virtual std::shared_ptr<Problem> provide_problem(
const std::string& solver_name,
const std::filesystem::path& log_file_path) const = 0;
const std::string& solver_name, FILE* log_file_ptr) const = 0;
};
16 changes: 13 additions & 3 deletions src/cpp/lpnamer/problem_modifier/IXpansionProblemsProvider.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,23 @@

#pragma once

#include <cstdio>
#include <filesystem>

#include "../model/Problem.h"
#include "LpsFromAntares.h"

class IXpansionProblemsProvider {
public:
virtual ~IXpansionProblemsProvider() = default;
virtual ~IXpansionProblemsProvider() {
if (log_file_ptr != NULL) {
fclose(log_file_ptr);
log_file_ptr = NULL;
}
}
[[nodiscard]] virtual std::vector<std::shared_ptr<Problem>> provideProblems(
const std::string& solver_name,
const std::filesystem::path& log_file_path) const = 0;
const std::filesystem::path& log_file_path) = 0;

public:
FILE* log_file_ptr = NULL;
};
9 changes: 5 additions & 4 deletions src/cpp/lpnamer/problem_modifier/LinkProblemsGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,11 @@ void LinkProblemsGenerator::treat(
const std::string &problem_name, Couplings &couplings,
std::shared_ptr<IProblemProviderPort> problem_provider,
std::shared_ptr<IProblemVariablesProviderPort> variable_provider,
std::shared_ptr<IProblemWriter> writer) const {
std::shared_ptr<IProblemWriter> writer) {
log_file_ptr_ = common_lpnamer::OpenLogPtr(log_file_path_);
std::shared_ptr<Problem> in_prblm =
problem_provider->provide_problem(_solver_name, log_file_path_);

problem_provider->provide_problem(_solver_name, log_file_ptr_);
in_prblm->set_fp(log_file_ptr_);
treat(problem_name, couplings, in_prblm, std::move(variable_provider),
writer);
}
Expand All @@ -43,7 +44,7 @@ void LinkProblemsGenerator::treat(
const std::string &problem_name, Couplings &couplings,
std::shared_ptr<Problem> problem,
std::shared_ptr<IProblemVariablesProviderPort> variable_provider,
std::shared_ptr<IProblemWriter> writer) const {
std::shared_ptr<IProblemWriter> writer) {
ProblemVariables problem_variables = variable_provider->Provide();

solver_rename_vars(problem, problem_variables.variable_names);
Expand Down
Loading