When you add this constraint,
subject to estado_chave {(i,j) in Ol}:
NR[i,j] = NB+1;
the following error message appears:
error processing constraint estado_chave[14,13]:
no value for NR[14,13]
You are getting this error message because NR is a parameter of your model, but in your data file you do not give any data for NR. In fact there are no variables in the expression for estado_chave, so it is not a meaningful constraint. If you are trying to assign the value of NB+1 to NR[i,j] for every (i,j) in OI, then you should instead write this assignment statement in your .run file after reading the model and data files:
let {(i,j) in Ol} NR[i,j] := NB+1;
However, I am only guessing at this, and it is possible you are trying to do something else. Currently you are not using NR or NB anywhere else in your model, so it is hard to see the reason for defining them.
When estado_chave is commented out, then the Knitro solver reports the following result:
Knitro 12.3.0: Current infeasible solution estimate cannot be improved.
objective 78651161.37; feasibility error 5.76e+11
96 iterations; 143 function evaluations
So Knitro is unable to find any feasible solution to your other constraints. In this situation, Knitro returns the last infeasible solution that it reached. As you have seen, that infeasible solution is often not very meaningful. In fact, there is no simple and general way to deal with an infeasibility error like this; you may need to study the model and data for a while before you can understand the cause of the infeasibility. It is possible to suggest some good ways to get started, however.
As an initial troubleshooting step, it is often helpful to use AMPL's
expand command to see see whether AMPL generated the constraints that you expected. By itself,
expand; shows all of the constraints. If there are many of them, you can use, for example,
expand C1; to expand all of the constraints that have a particular name. Also you can write, for instance,
expand >listing.txt; or
expand C1 >listing.txt; to send all of the output to the file listing.txt.
You should also consider using AMPL's
drop and restore commands to narrow your search for the cause of the infeasibility. If you drop some constraints and the resulting problem is still infeasible, then you don't need to consider the dropped constraints in looking for the cause of infeasibility. By trying a series of drops, you may be able to determine that infeasibility is being caused by only a small subset of the constraints.