Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c5bcd83

Browse files
committed
remove extra var, check a couple invariants
1 parent e61d3d4 commit c5bcd83

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

include/LoopBlock.hpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include "Math/NormalForm.hpp"
1414
#include "Math/Simplex.hpp"
1515
#include "Utilities/Allocators.hpp"
16+
#include "Utilities/Invariant.hpp"
1617
#include "Utilities/Optional.hpp"
1718
#include "Utilities/Valid.hpp"
1819
#include <algorithm>
@@ -848,7 +849,7 @@ class LinearProgramLoopBlock {
848849
-> Optional<Simplex *> {
849850
auto omniSimplex =
850851
Simplex::create(allocator, numConstraints + numSlack,
851-
1 + numBounding + numActiveEdges + numPhiCoefs +
852+
numBounding + numActiveEdges + numPhiCoefs +
852853
numOmegaCoefs + numSlack + numLambda);
853854
auto C{omniSimplex->getConstraints()};
854855
C << 0;
@@ -976,6 +977,7 @@ class LinearProgramLoopBlock {
976977
}
977978
}
978979
}
980+
invariant(size_t(c), size_t(numConstraints));
979981
addIndependentSolutionConstraints(omniSimplex, g, d);
980982
return omniSimplex->initiateFeasible() ? nullptr : (Simplex *)omniSimplex;
981983
}
@@ -1126,7 +1128,7 @@ class LinearProgramLoopBlock {
11261128
C(i++, ++s) = -1; // for >=
11271129
}
11281130
}
1129-
assert(omniSimplex->getNumCons() == i);
1131+
invariant(size_t(omniSimplex->getNumCons()), i);
11301132
assert(!allZero(omniSimplex->getConstraints()(last, _)));
11311133
}
11321134
[[nodiscard]] static auto nonZeroMask(const AbstractVector auto &x)

0 commit comments

Comments
 (0)