conjure-cp / conjure

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

Can't pass a returned matrix back in #549

Closed ChrisJefferson closed 1 year ago

ChrisJefferson commented 1 year ago

1-indexed matrices are returned like:

y = {'1': 1,
  '10': 10,
  '2': 1,
  '3': 1,
  '4': 1,
  '5': 1,
  '6': 1,
  '7': 1,
  '8': 8,
  '9': 10}

but if I try to pass that back in, for example as:

%%conjure
given y : matrix indexed by [int(1..10)] of int(1..10)
find x : matrix indexed by [int(1..10)] of int(1..10)
such that
  sum(x) <= sum(y)

then I get:

Exception: Error:
    Expecting a matrix, but got:
        function(1 --> 1, 2 --> 1, 3 --> 1, 4 --> 1, 5 --> 1, 6 --> 1, 7 --> 1, 8 --> 8, 9 --> 10, 10 --> 10)

I'm not positive if this is a notebook issue, or a conjure issue.

ozgurakgun commented 1 year ago

Thanks Chris. This came up last week in a different context coincidentally. I’ll fix it.

On Tue, 14 Feb 2023 at 10:28 am, Christopher Jefferson < @.***> wrote:

1-indexed matrices are returned like:

y = {'1': 1, '10': 10, '2': 1, '3': 1, '4': 1, '5': 1, '6': 1, '7': 1, '8': 8, '9': 10}

but if I try to pass that back in, for example as:

%%conjure given y : matrix indexed by [int(1..10)] of int(1..10) find x : matrix indexed by [int(1..10)] of int(1..10) such that sum(x) <= sum(y)

then I get:

Exception: Error: Expecting a matrix, but got: function(1 --> 1, 2 --> 1, 3 --> 1, 4 --> 1, 5 --> 1, 6 --> 1, 7 --> 1, 8 --> 8, 9 --> 10, 10 --> 10)

I'm not positive if this is a notebook issue, or a conjure issue.

— Reply to this email directly, view it on GitHub https://github.com/conjure-cp/conjure/issues/549, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABNEUTWBVSQNYMS4P7KDMLWXNM3FANCNFSM6AAAAAAU3L6X44 . You are receiving this because you are subscribed to this thread.Message ID: @.***>

-- Özgür Akgün

ChrisJefferson commented 1 year ago

(Possibly similar) issue: given f: function (int(1..10), int(1..10)) --> int(1..10) is returned as 'f': [[[2, 3], 4]] , but I can't pass it back in (sorry to keep piling these on!)