Re: Modelling symmetry in AMPL

54 views
Skip to first unread message
Message has been deleted

Paul

unread,
Feb 23, 2012, 11:30:20 AM2/23/12
to am...@googlegroups.com
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

unread,
Feb 28, 2012, 10:49:40 AM2/28/12
to am...@googlegroups.com

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

4...@ampl.com

 

 

From: am...@googlegroups.com [mailto:am...@googlegroups.com]

On Behalf Of Yimo Yang
Sent: Thursday, February 23, 2012 11:35 AM
To: am...@googlegroups.com
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>

Reply all
Reply to author
Forward
0 new messages