Skip to content

Commit

Permalink
Hotfix: Removes symptoms of null cnstrs in GLPK + CPLEX solver
Browse files Browse the repository at this point in the history
  • Loading branch information
maxkratz committed Aug 22, 2022
1 parent 81b24c9 commit 0e12046
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,9 @@ private void setUpCnstrs() {
// Iterate over each "sub" constraint (if any)
while (cnstrIt.hasNext()) {
final ILPConstraint cnstr = cnstrIt.next();
if (cnstr == null) {
continue;
}
final IloLinearNumExpr linearNumExpr = cplex.linearNumExpr();
for (final ILPTerm act : cnstr.lhsTerms()) {
linearNumExpr.addTerm(act.weight(), vars.get(act.variable().getName()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,9 @@ private void setUpCnstrs() {
int localCnstrCounter = 0;
while (cnstrIt.hasNext()) {
final ILPConstraint cnstr = cnstrIt.next();
if (cnstr == null) {
continue;
}
final int size = cnstr.lhsTerms().size();
final SWIGTYPE_p_int vars = GLPK.new_intArray(size + 1);
final SWIGTYPE_p_double coeffs = GLPK.new_doubleArray(size + 1);
Expand Down

0 comments on commit 0e12046

Please sign in to comment.