Re: Modelling symmetry in AMPL

55 views
Message has been deleted

Paul

Feb 23, 2012, 11:30:20 AM2/23/12
If x is a variable, something like the following:

set N; # index set
var x{N,N};
s.t. Symmetry {i in N, j in N : i <> j}: x[i,j] = x[j,i];

Paul
Message has been deleted

Robert Fourer

Feb 28, 2012, 10:49:40 AM2/28/12

You could declare

param x {N,N} default 0;

and read whatever values are given in the Excel file.  Then after your "read table", to fill in the missing values you could use an assignment statement like this:

let {i in N, j in N: x[i,j] = 0} x[i,j] := x[j,i];

Of course any other default value will work as well.

Bob Fourer

From:

On Behalf Of Yimo Yang
Sent: Thursday, February 23, 2012 11:35 AM
Subject: Re: [AMPL 5508] Re: Modelling symmetry in AMPL

Hi Paul,

Thanks for your response. What if x [i, j] is a parameter?

for example, x [i, j] indicates the distance from i to j. In the excel file, there are only values for x [i, j]. How can I tell AMPL to read the value of x [j, i]  assuming that x [i, j] = x [j, i]?

2012/2/23 Paul <paru...@gmail.com>