Echtzeitsysteme / gips

Graph-Based (M)ILP Problem Specification Tool
https://gips.dev
GNU General Public License v3.0
3 stars 1 forks source link

Possible bug: Missing matches in some tests of `gipsl.all.build.filter` #61

Closed maxkratz closed 1 year ago

maxkratz commented 2 years ago

See: https://github.com/Echtzeitsysteme/gips-tests/blob/main/gipsl.all.build.filter/src/gipsl/all/build/filter/Model.gipsl

Sometimes, the test testMap2to1NoIsDoubled() (https://github.com/Echtzeitsysteme/gips-tests/blob/main/test.suite.gips/src/test/suite/gipsl/all/build/GipslAllBuildFilterTest.java#L46-L56) fails because some of the matches are missing.

ILP solver output if test passes:

\ LP format - for model browsing. Use MPS format to capture full model detail.
Maximize
  n2n#0 + n2n#1
Subject To
 PatternConstraint1OnvnodeNotMapped_0: n2n#0 = 1
 PatternConstraint1OnvnodeNotMapped_1: n2n#1 = 1
 PatternConstraint0OnvnodeNotMapped_0: n2n#0 + n2n#1 = 1
 PatternConstraint0OnvnodeNotMapped_1: n2n#0 + n2n#1 = 1
Bounds
Binaries
 n2n#0 n2n#1
End

ILP solver output if test fails:

\ LP format - for model browsing. Use MPS format to capture full model detail.
Maximize
  n2n#0 + n2n#1
Subject To
 PatternConstraint0OnvnodeNotMapped_0: n2n#0 + n2n#1 = 1
 PatternConstraint0OnvnodeNotMapped_1: n2n#0 + n2n#1 = 1
Bounds
Binaries
 n2n#0 n2n#1
End

AFAIK, this behaviour is independent from the used pattern matcher (I've also tested it with Democles) and the used ILP solver (GUROBI and GLPK show the same error).

maxkratz commented 2 years ago

See tests: https://github.com/Echtzeitsysteme/gips-tests/blob/main/test.suite.gips/src/test/suite/gipsl/all/build/GipslAllBuildFilterTest.java

maxkratz commented 2 years ago

Should be unrelated to https://github.com/eMoflon/emoflon-ibex-updatesite/commit/3515a60c3550f6277f4accd6c6da9d21c21b3285.

Flipy91 commented 2 years ago

I also observed this behavior - it seems to be a concurrency issue in the GipslEngine l.37:

constraints.values().parallelStream().forEach(constraint -> constraint.buildConstraints());

Workaround is building the constraints serial instead of parallel:

constraints.values().stream().forEach(constraint -> constraint.buildConstraints());