From 9c2546a75d78f30d73762b79097fcc59314f75ec Mon Sep 17 00:00:00 2001 From: abdoulbari zakir <32519851+a-zakir@users.noreply.github.com> Date: Mon, 20 Nov 2023 13:50:57 +0100 Subject: [PATCH] Named MPS - fix duplicated "ranged" binding constraints (#1569) * fix: bc opBoth -->2 contraints * update & disable "mps" test * force run ALL tests * run ub ci * split name & ID * separate Id & series filename * Revert "separate Id & series filename" This reverts commit 102583d7ebaae047eb28c25581ecc65c92199781. * fix bc comparison * workflows: pick up develop version * test updated simtest * refactor bc comparison * disable named-mps until ref are regenerated * back to original * small changes * update function's doc * plural * X=X * tidy * Revert "disable named-mps until ref are regenerated" This reverts commit 837e6f5cf42c1e755c7d4c7a040f17c749cd4b36. --- .../study/binding_constraint/BindingConstraint.cpp | 6 +++++- .../antares/study/binding_constraint/BindingConstraint.h | 8 ++++++-- .../study/binding_constraint/BindingConstraintLoader.cpp | 4 ++-- .../binding_constraint/BindingConstraintsRepository.cpp | 2 ++ 4 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/libs/antares/study/binding_constraint/BindingConstraint.cpp b/src/libs/antares/study/binding_constraint/BindingConstraint.cpp index 8cf038d78f..c0ac15af0d 100644 --- a/src/libs/antares/study/binding_constraint/BindingConstraint.cpp +++ b/src/libs/antares/study/binding_constraint/BindingConstraint.cpp @@ -133,8 +133,12 @@ BindingConstraint::~BindingConstraint() void BindingConstraint::name(const AnyString& newname) { pName = newname; +} + +void BindingConstraint::pId(const AnyString& name) +{ pID.clear(); - Antares::TransformNameIntoID(pName, pID); + Antares::TransformNameIntoID(name, pID); } void BindingConstraint::weight(const AreaLink* lnk, double w) diff --git a/src/libs/antares/study/binding_constraint/BindingConstraint.h b/src/libs/antares/study/binding_constraint/BindingConstraint.h index 98f2b4dc1c..4ab74f57bb 100644 --- a/src/libs/antares/study/binding_constraint/BindingConstraint.h +++ b/src/libs/antares/study/binding_constraint/BindingConstraint.h @@ -143,13 +143,17 @@ class BindingConstraint final : public Yuni::NonCopyable ** \brief Get the name of the binding constraint */ const ConstraintName& name() const; + /*! ** \brief Set the name of the binding constraint - ** - ** The ID will be changed in the same time */ void name(const AnyString& newname); + /*! + ** \brief Set the pId of the binding constraint + */ + void pId(const AnyString& name); + /*! ** \brief Get the ID of the binding constraint */ diff --git a/src/libs/antares/study/binding_constraint/BindingConstraintLoader.cpp b/src/libs/antares/study/binding_constraint/BindingConstraintLoader.cpp index 6858d9c036..2fc30e1b82 100644 --- a/src/libs/antares/study/binding_constraint/BindingConstraintLoader.cpp +++ b/src/libs/antares/study/binding_constraint/BindingConstraintLoader.cpp @@ -184,10 +184,10 @@ std::vector> BindingConstraintLoader::load(En { auto greater_bc = std::make_shared(); greater_bc->copyFrom(bc.get()); - greater_bc->name(bc->name()); + greater_bc->name(bc->name() + "_sup"); greater_bc->pID = bc->pID; greater_bc->operatorType(BindingConstraint::opGreater); - + bc->name(bc->name() + "_inf"); bc->operatorType(BindingConstraint::opLess); if (loadTimeSeries(env, bc.get()) && loadTimeSeries(env, greater_bc.get())) diff --git a/src/libs/antares/study/binding_constraint/BindingConstraintsRepository.cpp b/src/libs/antares/study/binding_constraint/BindingConstraintsRepository.cpp index 1f1cad3bd4..2de4a6cb59 100644 --- a/src/libs/antares/study/binding_constraint/BindingConstraintsRepository.cpp +++ b/src/libs/antares/study/binding_constraint/BindingConstraintsRepository.cpp @@ -90,6 +90,7 @@ std::shared_ptr BindingConstraintsRepository::add(const AnySt { auto bc = std::make_shared(); bc->name(name); + bc->pId(name); constraints_.push_back(bc); std::sort(constraints_.begin(), constraints_.end(), compareConstraints); return bc; @@ -122,6 +123,7 @@ bool BindingConstraintsRepository::rename(BindingConstraint *bc, const AnyString return false; } bc->name(name); + bc->pId(name); JIT::Invalidate(bc->RHSTimeSeries().jit); return true; }