veda1.gms : tests that we can execute gdx2veda


Transport model

Small Model of Type : GAMS

Category : GAMS Test library

Main file : veda1.gms

$title 'tests that we can execute gdx2veda' (VEDA1,SEQ=330)
$call gamslib trnsport
$echo parameter x12345678901234567890123456789012345678901234567890(i,j); x12345678901234567890123456789012345678901234567890(i,j)=x.l(i,j); >> trnsport.gms
$call rm -f t1.gdx
$call gams trnsport gdx=t1.gdx lo 2
$if not exist t1.gdx   $abort 'missing t1.gdx'
$onecho > t1.vdd
* Transport model
* tab-name indices
Attribute attr
Plants     i
Warehouses j
Links      ii jj
not-0 Shipments
* veda_attribute gams_name tab1 tab2 ... for gams index 1, 2, ...
"x(i,j) duals"                                        x.m                                                 i  Warehouses
Shipments                                             x.l                                                 i  j
"Shipments with a very very very very very long name" x12345678901234567890123456789012345678901234567890 i  j
SupplyPrice                                           supply.m                                            i
DemandPrice                                           demand.m                                            j
TransportCost                                         c                                                   i  j
Distance                                              d                                                   ii jj
Supply                                                a                                                   i
Demand                                                b                                                   j
TotalCost                                             z.l
SupplyNodes                                           i                                                   i
DemandNodes                                           j                                                   j
Rate                                                  f

* gams_set tab
i  i

* gams_set tab
j  j

* sub_name gams_name tab
i1 i  Plants
i1 i  i

$call rm -f t1.vd
$call gdx2veda t1 t1.vdd t1

parameter vd(Attribute,Plants,Warehouses,Links) /
$include t1.vd
option vd:3:0:1; display vd;

parameter a(*),b(*),x12345678901234567890123456789012345678901234567890(*,*);
execute_load 't1',a,b,x12345678901234567890123456789012345678901234567890; display a,b;

abort$sum(plants, vd('supply',plants,'-','-') <> a(plants)) 'trouble with supply';
abort$sum(warehouses, vd('demand','-',warehouses,'-') <> b(warehouses)) 'trouble with demand';
abort$sum((plants,warehouses), vd('Shipments with a very very very very very long name',plants,warehouses,'-') <> x12345678901234567890123456789012345678901234567890(plants,warehouses)) 'trouble with shipment';