Echtzeitsysteme / gips

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

Serial `filter(...)` expression: Missing filter operations in generated code #128

Open maxkratz opened 1 year ago

maxkratz commented 1 year ago

(This issue may be related to https://github.com/Echtzeitsysteme/gips/issues/90, but maybe it is a duplicate and I did not get the issue right the first time.)

At least in some cases, concatenated filter(...) expressions do not produce correct generated code:

objective formerValue -> mapping::move {
    patterns.findComponentInFormerSystem
        ->filter(m | m.nodes().s == self.nodes().newSystem)
        ->filter(m | m.nodes().c1 == self.nodes().component)
        ->count()
        * self.value()
}

Generated code:

@Override
protected void buildTerms(final MoveMapping context) {
terms.add(new ILPTerm(context, engine.getEMoflonAPI().findComponentInFormerSystem().findMatches(false).parallelStream()
            .filter(itr_0 -> itr_0.getS().equals(context.getNewSystem()))
            .map(itr_0 -> 1.0 * 1.0)
            [...]
}

TODO: