Skip to content

Bug in sum function when input contains repeated integer values #69

Description

@HuaJin16

In model m, both c1 and c2 have a utilization of 10. We expect "query m utilSum" to return true since the total utilization is 20, but the query returns false. If we modify the utilSum rule and set s = 10, "query m utilSum" returns true.

domain Mapping
{
  Component ::= new (id: Integer, utilization: Real).
  Processor ::= new (id: Integer).
  Mapping   ::= new (c: Component, p: Processor).

  // The utilization must be > 0
  invalidUtilization :- c is Component, c.utilization <= 0.

  badMapping :- p is Processor, 
    s = sum(0.0, { c.utilization |
              c is Component, Mapping(c, p) }), s > 100.

  utilSum :- s = sum(0.0, { c.utilization | c is Component }), s = 20.

  conforms no badMapping, no invalidUtilization.
}

model m of Mapping
{
  c1 is Component(0, 10).
  c2 is Component(1, 10).
  p1 is Processor(0).
  Mapping(c1, p1).
  Mapping(c2, p1).
}

partial model pm of Mapping
{
  c1 is Component(0, x).
  c2 is Component(1, y).
  p1 is Processor(0).
  Mapping(c1, p1).
  Mapping(c2, p1).
}

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

Fields

No fields configured for Bug.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions