conjure-cp / conjure

Conjure: The Automated Constraint Modelling Tool
Other
96 stars 20 forks source link

enums with repeated values do crazy things #489

Closed ChrisJefferson closed 1 year ago

ChrisJefferson commented 4 years ago

Given repeated values in an enum, for example:

letting T be new type enum {A,B,A,C}

Weird things happen, for example if you declare a function from T to int you sometimes get two images for A, and sometimes one.

I can then go on to write things like:

letting T be new type enum {A,B,A,C}
letting fullday be function(A-->1, B-->2,A-->1,C-->4)

given the problem:

given T new type enum
given fullday : function(total) T --> int(1..10)
find f : function(total) T --> int(1..10)

such that
forAll t : T. f(t) = fullday(t)

Then 'f' ends up not being a total function

gokberkkocak commented 4 years ago

I also encountered a similar problem with enums on Conjure >v2.2. v2.2 works fine with the same model.

Using the rcpsp model from the EssenceCatalog and any instance:

Generating models for rcpsp.essence
Generated models: model000001.eprime
Saved under: conjure-output
Savile Row: model000001.eprime params/j102_2.mm-essence.param
Error:
    The value is not a member of the domain.
    Value : function(1 --> 29, 2 --> 40)
    Domain: function {Function1D} (size 2, total) int(1..2) --> int(29..40)
    Reason:
        The value is not a member of the domain.
        Name  : nonRenewableLimits
        Value : 1
        Domain: int(1..2)

Model, raw instances and the converter are in the repo folder.