You can write, for example,
var x {i in I, j in J: i <> j} >= 0;
to specify that only x[i,j] with i <> j should be defined. Then in your model you must not refer to variables like x[1,1] or x[4,4]. If you have a linear model, then alternatively you can index x over {i in I, j in J} and then add a constraint to zero out the variables that should not be used:
subj to Noii {i in I}: x[i,i] = 0;
Then AMPL's presolve phase will remove these variables from the problem before it is sent to the solver.
Bob Fourer
am...@googlegroups.com
=======