[AMPL 2933] AMPL/CPLEX from Matlab

View: New views
2 Messages — Rating Filter:   Alert me  

[AMPL 2933] AMPL/CPLEX from Matlab

by Mohapatra :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Hello
Can any body plaease help me how to interface matlab with AMPL/CPLEX.

model file:

set N;                           # N denotes the set of nodes
set L within {N,N};          # L denotes the set of links
set T := 1..NP;              # T denotes the set all paths
set P{T} within {N,N};     # P[p] denotes the arcs in path p That is,
paths are directed.
set Q{N,N} within T;       # Q[a,b] denotes the paths that can be used
to satisfy demand pair (a,b)

param d{N,N} default 0.0; #  d[a,b] denotes the demand between node a
& b
set lamda := 1..36;

var y{T,lamda} binary;
var c{L} >= 0;

minimize WorkingCapacity: sum {(i,j) in L}  c[i,j];
subject to WorkingDemand {(i,j) in D}:
  sum {b in lamda,p in Q[i,j]} y[p,b] = d[i,j];

data file:
param d :=
2 4 10
3 5 10
1 5 10
;

I try to route the above traffic and optimize, which is a static one.

But I need these demand/traffic modelling as per poissons distribution
and comes with randomly and optimize the result. I think this may be
done using matlab.

thanks & regards,
bm


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "AMPL Modeling Language" group.
To post to this group, send email to ampl@...
To unsubscribe from this group, send email to ampl+unsubscribe@...
For more options, visit this group at http://groups.google.com/group/ampl?hl=en
-~----------~----~----~----~------~----~------~--~---


RE: [AMPL 2940] AMPL/CPLEX from Matlab

by Robert Fourer-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


There is a random Poisson function built into AMPL -- see Table A-3 on page
459 of the AMPL book (2nd edition).

If for some reason you need to generate the random values of d in MATLAB,
you will need to communicate them to AMPL through a text file.  You can use
MATLAB's formatted printing statements to create an AMPL data file (which
can be separate from the file that contains all the other data -- just use
two "data" statements).  Or you can write just the values into the file and
use AMPL's "read" command to process them as described on page 163 of the
book.

Bob Fourer
4er@...


> -----Original Message-----
> From: ampl@... [mailto:ampl@...]
> On Behalf Of Mohapatra [bmohapatra9@...]
> Sent: Thursday, October 29, 2009 11:50 AM
> To: AMPL Modeling Language
> Subject: [AMPL 2933] AMPL/CPLEX from Matlab
>
>
> Hello
> Can any body plaease help me how to interface matlab with AMPL/CPLEX.
>
> model file:
>
> set N;                           # N denotes the set of nodes
> set L within {N,N};          # L denotes the set of links
> set T := 1..NP;              # T denotes the set all paths
> set P{T} within {N,N};     # P[p] denotes the arcs in path p That is,
> paths are directed.
> set Q{N,N} within T;       # Q[a,b] denotes the paths that can be used
> to satisfy demand pair (a,b)
>
> param d{N,N} default 0.0; #  d[a,b] denotes the demand between node a
> & b
> set lamda := 1..36;
>
> var y{T,lamda} binary;
> var c{L} >= 0;
>
> minimize WorkingCapacity: sum {(i,j) in L}  c[i,j];
> subject to WorkingDemand {(i,j) in D}:
>   sum {b in lamda,p in Q[i,j]} y[p,b] = d[i,j];
>
> data file:
> param d :=
> 2 4 10
> 3 5 10
> 1 5 10
> ;
>
> I try to route the above traffic and optimize, which is a static one.
>
> But I need these demand/traffic modelling as per poissons distribution
> and comes with randomly and optimize the result. I think this may be
> done using matlab.
>
> thanks & regards,
> bm
>
>
> --~--~---------~--~----~------------~-------~--~----~
> You received this message because you are subscribed to the Google Groups
> "AMPL Modeling Language" group.
> To post to this group, send email to ampl@...
> To unsubscribe from this group, send email to
> ampl+unsubscribe@...
> For more options, visit this group at
> http://groups.google.com/group/ampl?hl=en
> -~----------~----~----~----~------~----~------~--~---


--

You received this message because you are subscribed to the Google Groups "AMPL Modeling Language" group.
To post to this group, send email to ampl@....
For more options, visit this group at http://groups.google.com/group/ampl?hl=en.