help-glpk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Fwd: Re: [Help-glpk] slow matrix generation compared to AMPL]


From: Kendall Bailey
Subject: [Fwd: Re: [Help-glpk] slow matrix generation compared to AMPL]
Date: Mon, 16 Aug 2004 14:25:00 -0500
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.3.1) Gecko/20030428


I am now able to post the full model. The size of the data sets are

L 185
T 169
D 29
C 6
LC 639
LTD 31265
LTDC 107991
DEMANDLANES 7409
DEMANDMOVES 63206
LOADMOVES 27812
EMPTYMOVES 527993

The model represents a time/space network transportation model. Hopefully the comments make the meaning clear. I'm interested in ways to speed up the matrix generation phase of MathProg. I think I understand the earlier advice, which applies mostly to the set C. Since the constraints specify c = 'SO', then it should be possible to reduce the work by 5/6. However I'm looking at reducing a 24 hour generation phase to a few minutes at most.

Thanks,
Kendall




# Dynamic Operational Time space network model

#Nodes
set C; # Capacity types in the network
set L; # Locations in the network-Trade Areas
set T; # Time intervals in the network
set D; # Days in the network
set LC within {L,C}; # Location, Capacity Nodes
set LTD within {L,T,D}; # Location, Period, Day Nodes
set LTDC within {L,T,D,C}; # Location, Period, Day, Capacity type Nodes


#Arcs
set DEMANDLANES within {L,L,C}; # Lanes representing movements between nodes
set DEMANDMOVES within {LTD,L}; # Loaded Arcs representing movements between 
nodes without the capacity type index
set LOADMOVES within {LTD,LTD,C}; # Loaded Arcs representing movements between 
nodes with the capacity type index
set EMPTYMOVES within {LTD,LTD,C}; # Loaded Arcs representing movements between 
nodes with the capacity type index

param StartDay:=0;
param EndDay:=28;
param StartInterval:=0;
param EndInterval:=168;
param StartCutInterval:=12;
param EndCutInterval:=149;
param Acceptance:=0.0;
param DemandFactor:=1.05;

param SODemand{DEMANDMOVES}; # Max Demand on each lane in each time period
param TMDemand{DEMANDMOVES}; # Max Demand on each lane in each time period
param SEDemand{DEMANDMOVES}; # Max Demand on each lane in each time period
param NEDemand{DEMANDMOVES}; # Max Demand on each lane in each time period
param WRDemand{DEMANDMOVES}; # Max Demand on each lane in each time period
param CNDemand{DEMANDMOVES}; # Max Demand on each lane in each time period
param SOTMDemand{DEMANDMOVES}; # Max Demand on each lane in each time period
param SOSEDemand{DEMANDMOVES}; # Max Demand on each lane in each time period
param SONEDemand{DEMANDMOVES}; # Max Demand on each lane in each time period
param SOWRDemand{DEMANDMOVES}; # Max Demand on each lane in each time period
param SOCNDemand{DEMANDMOVES}; # Max Demand on each lane in each time period
param TMWRDemand{DEMANDMOVES}; # Max Demand on each lane in each time period
param SOTMWRDemand{DEMANDMOVES}; # Max Demand on each lane in each time period
param TotalDemand{DEMANDMOVES}; # Max Demand on each lane in each time period

param AddCapacity{LTDC}; # Starting Capacity at each location at each Time 
period
param DeleteCapacity{LTDC}; # Ending Capacity at each location at each Time 
period

param LaneRevenue{DEMANDLANES}; # Revenue associated with each loaded move
param LaneCost{DEMANDLANES}; # So Cost associated with each loaded move
param EmptyCost{EMPTYMOVES}; # Cost associated with each empty move

var LOAD{(i,j,k,l,m,n,c) in LOADMOVES}; # Number of loaded moves
var EMPTY{(i,j,k,l,m,n,c) in EMPTYMOVES}; # Number of empty moves

maximize PROFIT:
        sum{(i,j,k,l,m,n,c) in LOADMOVES: c = 
'SO'}(LOAD[i,j,k,l,m,n,c]*LaneRevenue[i,l,c])
        -sum{(i,j,k,l,m,n,c) in LOADMOVES: c = 
'SO'}(LOAD[i,j,k,l,m,n,c]*LaneCost[i,l,c])
        - sum{(i,j,k,l,m,n,c) in EMPTYMOVES: c = 
'SO'}(EMPTY[i,j,k,l,m,n,c]*EmptyCost[i,j,k,l,m,n,c]);

#Loads moved on a lane cannot exceed available demand
subject to SOLOADS{(i,j,k,l) in DEMANDMOVES}:
        sum{(i,j,k,l,m,n,c) in LOADMOVES:c='SO'}LOAD[i,j,k,l,m,n,c] <= 
DemandFactor*SODemand[i,j,k,l];

#Loads moved out of time period 0 must satisfy all demand
subject to INITIALSO{(i,j,k,l) in DEMANDMOVES:j = StartInterval}:
        sum{(i,j,k,l,m,n,c) in LOADMOVES:c='SO'}LOAD[i,j,k,l,m,n,c] >= 
SODemand[i,j,k,l];

#Flow in + Adds = Flow Out + Deletes
subject to BALANCE {(i,j,k,c) in LTDC: j <> EndInterval and c = 'SO'}:
        sum{(i,j,k,l,m,n,c) in LOADMOVES}LOAD[i,j,k,l,m,n,c] + 
sum{(i,j,k,l,m,n,c) in EMPTYMOVES}EMPTY[i,j,k,l,m,n,c] + 
DeleteCapacity[i,j,k,c]=        
        sum{(l,m,n,i,j,k,c) in LOADMOVES}LOAD[l,m,n,i,j,k,c] + 
sum{(l,m,n,i,j,k,c) in EMPTYMOVES}EMPTY[l,m,n,i,j,k,c] + AddCapacity[i,j,k,c];

subject to MINACCEPTANCELEVEL:
        sum{(i,j,k,l,m,n,c) in LOADMOVES: c = 'SO'}LOAD[i,j,k,l,m,n,c] >= 
Acceptance*sum{(i,j,k,l) in DEMANDMOVES}SODemand[i,j,k,l];


subject to LB1{(i,j,k,l,m,n,c) in LOADMOVES: c = 'SO'}: LOAD[i,j,k,l,m,n,c]>=0;
subject to LB2{(i,j,k,l,m,n,c) in EMPTYMOVES: c = 'SO'}: 
EMPTY[i,j,k,l,m,n,c]>=0;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]