1

I have to define an indexed set of matrices in AMPL (every set is a variable).

In particular, from 1 to N i want a variable M[i] that is a 4x4 matrix with elements >= 0.

How can i do it ? Thanks so much

2
  • 2
    Usually we do this by creating a 3 dimensional variable M[i,j,k] where j and k are over 1..4. Commented Dec 24, 2018 at 21:57
  • Remember to accept the answer if it solved your problem. Commented Jan 5, 2019 at 12:52

1 Answer 1

1

As suggested by Erwin in a comment, you do this with a single three-dimensional variable.

param n;
var M{1..n,1..4,1..4} >= 0;
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.