Getting below error precedence is not a param (or var or constraint or objective) context: param >>> precedence <<< :=

precedence is not a param (or var or constraint or objective)
context: param >>> precedence <<< :=

getting above error message . I am using precedence matrix in the data file like below

param precedence:

1 2 3 4 5 6 7 8 9 10 11 12 :=

1 0 0 1 1 0 0 0 0 0 0 0 0

2 0 0 0 1 1 0 0 0 0 0 0 0

3 0 0 0 0 0 1 1 1 0 0 0 0

4 0 0 0 0 0 0 0 1 0 0 0 0

5 0 0 0 0 0 0 0 0 0 1 0 0

6 0 0 0 0 0 0 0 0 1 0 0 0

7 0 0 0 0 0 0 0 0 1 0 0 0

8 0 0 0 0 0 0 0 0 1 0 0 0

9 0 0 0 0 0 0 0 0 0 0 1 0

10 0 0 0 0 0 0 0 0 0 0 1 0

11 0 0 0 0 0 0 0 0 0 0 0 1

12 0 0 0 0 0 0 0 0 0 0 0 0;

Hi @Amaraba ,

How do you declare precedence in your model? You need to declare the parameter before reading the data to make it more efficiently.

If you are using the API, you could simply declare the parameter (in the model, with “param precedence;”) and pass the data for your matrix in some data structure your programming language provides (pandas, numpy array, lists…), instead of using the “data” format.

Hi @marcos attaching the data file, model file and run file on the assembly line problem i am working on . I am directly working on AMPL

ALB1.mod (443 Bytes)
ALB1.dat (508 Bytes)
ALB1.run (238 Bytes)

Hi @Amaraba ,

When I run your script I get different errors from your model:

ampl: include ALB1.run

ALB1.mod, line 13 (offset 169):
	cannot enforce strict bound
context:  var Tc  >>> >0; <<< 

ALB1.mod, line 15 (offset 183):
	Tc is already defined
context:  minimize  >>> Tc;

You should enforce >= 0 for Tc instead of > 0 (you could adjust an epsilon > 0 and make Tc >= eps).

You have to give a name for your objective and constraints in ampl:

minimize f: Tc;

, would be a valid objective. There are more errors (some forgotten colon in the model). After solving them, I could just run the model. There is no problem with "precedence" in your current example.

Please, feel free to ask something if it is not clear, but try to provide accurate and consistent examples, then it is much easier for others to help you!

You can also take a look at some examples in this Colab repository, they might be helpful to write models.