Skip to content

Commit

Permalink
Named MPS - fix duplicated "ranged" binding constraints (#1569)
Browse files Browse the repository at this point in the history
* 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 102583d.

* 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 837e6f5.
  • Loading branch information
a-zakir authored Nov 20, 2023
1 parent 121f947 commit 9c2546a
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
8 changes: 6 additions & 2 deletions src/libs/antares/study/binding_constraint/BindingConstraint.h
Original file line number Diff line number Diff line change
Expand Up @@ -143,13 +143,17 @@ class BindingConstraint final : public Yuni::NonCopyable<BindingConstraint>
** \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
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,10 +184,10 @@ std::vector<std::shared_ptr<BindingConstraint>> BindingConstraintLoader::load(En
{
auto greater_bc = std::make_shared<BindingConstraint>();
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()))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ std::shared_ptr<BindingConstraint> BindingConstraintsRepository::add(const AnySt
{
auto bc = std::make_shared<BindingConstraint>();
bc->name(name);
bc->pId(name);
constraints_.push_back(bc);
std::sort(constraints_.begin(), constraints_.end(), compareConstraints);
return bc;
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit 9c2546a

Please sign in to comment.