Yes sure.
Here’s the simple program I am trying to run in the AIMSUN NEXT API:
mod file:
"set CITIES;
set LINKS within (CITIES cross CITIES);
param supply {CITIES} >= 0; # amounts available at cities
param demand {CITIES} >= 0; # amounts required at cities
check: sum {i in CITIES} supply[i] = sum {j in CITIES} demand[j];
param cost {LINKS} >= 0; # shipment costs/1000 packages
param capacity {LINKS} >= 0; # max packages that can be shipped
var Ship {(i,j) in LINKS} >= 0, <= capacity[i,j];
# packages to be shipped
minimize Total_Cost:
sum {(i,j) in LINKS} cost[i,j] * Ship[i,j];
subject to Balance {k in CITIES}:
supply[k] + sum {(i,k) in LINKS} Ship[i,k]
= demand[k] + sum {(k,j) in LINKS} Ship[k,j];"
dat file:
"data;
set CITIES := PITT NE SE BOS EWR BWI ATL MCO ;
set LINKS := (PITT,NE) (PITT,SE)
(NE,BOS) (NE,EWR) (NE,BWI)
(SE,EWR) (SE,BWI) (SE,ATL) (SE,MCO);
param supply default 0 := PITT 450 ;
param demand default 0 :=
BOS 90, EWR 120, BWI 120, ATL 70, MCO 50;
param: cost capacity :=
PITT NE 2.5 250
PITT SE 3.5 250
NE BOS 1.7 100
NE EWR 0.7 100
NE BWI 1.3 100
SE EWR 1.3 100
SE BWI 0.8 100
SE ATL 0.2 100
SE MCO 2.1 100 ;
And the API of AIMSUN is:
from AAPI import *
def AAPILoad():
return 0
def AAPIInit():
return 0
def AAPISimulationReady():
return 0
def AAPIManage(time, timeSta, timeTrans, acycle):
return 0
def AAPIPostManage(time, timeSta, timeTrans, acycle):
return 0
def AAPIFinish():
return 0
def AAPIUnLoad():
return 0
def AAPIPreRouteChoiceCalculation(time, timeSta):
return 0
def AAPIEnterVehicle(idveh, idsection):
return 0
def AAPIExitVehicle(idveh, idsection):
return 0
def AAPIEnterPedestrian(idPedestrian, originCentroid):
return 0
def AAPIExitPedestrian(idPedestrian, destinationCentroid):
return 0
def AAPIEnterVehicleSection(idveh, idsection, atime):
return 0
def AAPIExitVehicleSection(idveh, idsection, atime):
return 0
def AAPIVehicleStartParking(idveh, idsection, time):
return 0
I am running program inside AAPIManage function!