Echtzeitsysteme / gips

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

`notEmpty()` throws an exception while generating code #28

Open maxkratz opened 2 years ago

maxkratz commented 2 years ago

constraint -> global { // mappings.n2n->count() >= 1 mappings.n2n->notEmpty() }

produces an error while generating code:

15:07:46 ERROR [build.GipsProjectBuilder::49] - java.lang.IllegalArgumentException: Some constrains contain invalid values within arithmetic expressions, e.g., boolean values instead of arithmetic values.

(See the code example: https://github.com/Echtzeitsysteme/gips-tests/blob/feature/add-notempty-tests/gipsl.all.build.notempty/src/gipsl/all/build/notempty/Model.gipsl#L42)

maxkratz commented 2 years ago

Another example: https://github.com/Echtzeitsysteme/gips/projects/1#card-85330230

maxkratz commented 2 years ago

This also happens with the hello-world example: https://github.com/Echtzeitsysteme/gips-examples/blob/main/org.emoflon.gips.gipsl.examples.helloworld/src/org/emoflon/gips/gipsl/examples/helloworld/Model.gipsl

java.lang.IllegalArgumentException: Some constrains contain invalid values within arithmetic expressions, e.g., boolean values instead of arithmetic values.
    at org.emoflon.gips.build.transformation.transformer.AttributeInConstraintTransformer.transform(AttributeInConstraintTransformer.java:43)
    at org.emoflon.gips.build.transformation.transformer.AttributeExpressionTransformer.transform(AttributeExpressionTransformer.java:62)
    at org.emoflon.gips.build.transformation.transformer.BooleanInConstraintTransformer.transform(BooleanInConstraintTransformer.java:44)
    at org.emoflon.gips.build.transformation.GipsToIntermediate.transformConstraint(GipsToIntermediate.java:411)
    at org.emoflon.gips.build.transformation.GipsToIntermediate.transformConstraints(GipsToIntermediate.java:349)
    at org.emoflon.gips.build.transformation.GipsToIntermediate.transform(GipsToIntermediate.java:86)
    at org.emoflon.gips.build.GipsProjectBuilder.build(GipsProjectBuilder.java:46)
    at org.emoflon.gips.gipsl.generator.GipslGenerator$1.accept(GipslGenerator.java:63)
    at org.emoflon.gips.gipsl.generator.GipslGenerator$1.accept(GipslGenerator.java:1)
    at java.base/java.util.ArrayDeque.forEach(ArrayDeque.java:888)
    at org.emoflon.gips.gipsl.generator.GipslGenerator$2.run(GipslGenerator.java:121)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
    at org.emoflon.gips.gipsl.generator.GipslGenerator.runBuilderExtensions(GipslGenerator.java:124)
    at org.emoflon.gips.gipsl.generator.GipslGenerator.doGenerate(GipslGenerator.java:66)
    at org.eclipse.xtext.generator.GeneratorDelegate.doGenerate(GeneratorDelegate.java:44)
    at org.eclipse.xtext.generator.GeneratorDelegate.generate(GeneratorDelegate.java:35)
    at org.eclipse.xtext.builder.BuilderParticipant.handleChangedContents(BuilderParticipant.java:597)
    at org.eclipse.xtext.builder.BuilderParticipant.handleChangedContents(BuilderParticipant.java:578)
    at org.eclipse.xtext.builder.BuilderParticipant.doGenerate(BuilderParticipant.java:563)
    at org.eclipse.xtext.builder.BuilderParticipant.doBuild(BuilderParticipant.java:303)
    at org.eclipse.xtext.builder.BuilderParticipant.build(BuilderParticipant.java:265)
    at org.eclipse.xtext.builder.impl.RegistryBuilderParticipant$DeferredBuilderParticipant.build(RegistryBuilderParticipant.java:164)
    at org.eclipse.xtext.builder.impl.RegistryBuilderParticipant.build(RegistryBuilderParticipant.java:70)
    at org.eclipse.xtext.builder.impl.XtextBuilder.doBuild(XtextBuilder.java:525)
    at org.eclipse.xtext.builder.impl.XtextBuilder.addInfosFromTaskAndBuild(XtextBuilder.java:455)
    at org.eclipse.xtext.builder.impl.XtextBuilder.fullBuild(XtextBuilder.java:562)
    at org.eclipse.xtext.builder.impl.XtextBuilder.build(XtextBuilder.java:333)
    at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:1024)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
    at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:254)
    at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:311)
    at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:400)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
    at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:403)
    at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:514)
    at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:462)
    at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:544)
    at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:161)
    at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:255)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)
maxkratz commented 1 year ago

This is still an issue, see corresponding tests: https://github.com/Echtzeitsysteme/gips-tests/pull/4