2

I have to solve a problem with permutations. The function takes vector a with n elements as a parameter. I declare b as @variable - there should be the permutation 1:n that gives the best result after finding the solution of a problem. The error appears when I want to create @constraint. I have to use a[b[1]], so it takes the first element from vector which is a variable. It gives my error, that I can't use type VariableRef as a index of an array. But how can I get around this when I have to use it?

jakub1998
  • 400
  • 2
  • 13
  • 1
    can you please provide a reproducible code (or specification). It looks like that what you try to do is not an integer programming problem, so it probably requires some transformation, but in order to assess it for sure I would need more details. – Bogumił Kamiński Apr 10 '20 at 17:30

1 Answers1

0

I sounds as if you have two optimisation problems one of which is an integer programming problem. You might think about separating the two.

(Sorry for not writing a comment, my reputation is still too low ;-) )

HHFox
  • 311
  • 2
  • 7