Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
DALSim
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Thibaut DEMARE
DALSim
Commits
c15d7fbd
Commit
c15d7fbd
authored
6 years ago
by
ThibautDemare
Browse files
Options
Downloads
Patches
Plain Diff
Clean code
parent
85e55d7b
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
models/Main.gaml
+18
-17
18 additions, 17 deletions
models/Main.gaml
with
18 additions
and
17 deletions
models/Main.gaml
+
18
−
17
View file @
c15d7fbd
...
@@ -83,34 +83,36 @@ global {
...
@@ -83,34 +83,36 @@ global {
bool second_init_bool <- true;
bool second_init_bool <- true;
init {
init {
// Graphstream connections
if(use_gs){
if(use_gs){
// Init senders in order to create nodes/edges when we create agent
// Init senders in order to create nodes/edges when we create agent
do init_senders;
do init_senders;
}
}
// Road network creation
// Transportation networks
// Road
create Road from: roads_shapefile with: [speed::read("speed") as float, length::read("length") as float];
create Road from: roads_shapefile with: [speed::read("speed") as float, length::read("length") as float];
road_network <- as_edge_graph(Road);
road_network <- as_edge_graph(Road);
// Maritime
// Maritime network creation
create MaritimeLine from: maritime_shapefile with: [speed::read("speed") as float, length::read("length") as float];
create MaritimeLine from: maritime_shapefile with: [speed::read("speed") as float, length::read("length") as float];
maritime_network <- as_edge_graph(MaritimeLine);
maritime_network <- as_edge_graph(MaritimeLine);
// River
// Maritime network creation
create RiverLine from: river_shapefile with: [speed::read("speed") as float, length::read("length") as float];
create RiverLine from: river_shapefile with: [speed::read("speed") as float, length::read("length") as float];
river_network <- as_edge_graph(RiverLine);
river_network <- as_edge_graph(RiverLine);
//
Creation of
Providers
// Providers
create Provider from: provider_shapefile with: [port::read("Port") as string];
create Provider from: provider_shapefile with: [port::read("Port") as string];
// Warehouses
// Warehouses
create Warehouse from: warehouse_shapefile returns: lw with: [totalSurface::read("surface") as float];
create Warehouse from: warehouse_shapefile returns: lw with: [totalSurface::read("surface") as float];
// Transporters
create RoadTransporter number:1;
create RoadTransporter number:1;
create RiverTransporter number:1;
create RiverTransporter number:1;
create MaritimeTransporter number:1;
create MaritimeTransporter number:1;
// Maritime Terminals
// Terminals
// Maritime and river
create MaritimeRiverTerminal from: terminal_LH_shapefile with: [handling_time_to_road::read("TO_ROAD") as float,
create MaritimeRiverTerminal from: terminal_LH_shapefile with: [handling_time_to_road::read("TO_ROAD") as float,
handling_time_to_river::read("TO_RIVER") as float,
handling_time_to_river::read("TO_RIVER") as float,
handling_time_to_maritime::read("TO_MARITIM") as float,
handling_time_to_maritime::read("TO_MARITIM") as float,
...
@@ -118,27 +120,30 @@ global {
...
@@ -118,27 +120,30 @@ global {
handling_time_from_river::read("FROM_RIVER") as float,
handling_time_from_river::read("FROM_RIVER") as float,
handling_time_from_maritime::read("FROM_MARIT") as float
handling_time_from_maritime::read("FROM_MARIT") as float
];
];
// River
create RiverTerminal from: river_terminals with: [handling_time_to_road::read("TO_ROAD") as float,
create RiverTerminal from: river_terminals with: [handling_time_to_road::read("TO_ROAD") as float,
handling_time_to_river::read("TO_RIVER") as float,
handling_time_to_river::read("TO_RIVER") as float,
handling_time_from_road::read("FROM_ROAD") as float,
handling_time_from_road::read("FROM_ROAD") as float,
handling_time_from_river::read("FROM_RIVER") as float
handling_time_from_river::read("FROM_RIVER") as float
];
];
// Maritime
create MaritimeTerminal from: terminal_A_shapefile with: [handling_time_to_road::read("TO_ROAD") as float,
create MaritimeTerminal from: terminal_A_shapefile with: [handling_time_to_road::read("TO_ROAD") as float,
handling_time_to_maritime::read("TO_MARITIM") as float,
handling_time_to_maritime::read("TO_MARITIM") as float,
handling_time_from_road::read("FROM_ROAD") as float,
handling_time_from_road::read("FROM_ROAD") as float,
handling_time_from_maritime::read("FROM_MARIT") as float
handling_time_from_maritime::read("FROM_MARIT") as float
];
];
// Forwarding agent
// Forwarding agent
create ForwardingAgent number:1 returns:fas;
create ForwardingAgent number:1 returns:fas;
forwardingAgent <- fas[0];
forwardingAgent <- fas[0];
// Create a vehicle to init_networks
// Create a vehicle to
call "
init_networks
"
create Vehicle number:1;
create Vehicle number:1;
// Warehouses
// Warehouses
create Warehouse from: warehouse_shapefile returns: lw with: [totalSurface::read("surface") as float];
create Warehouse from: warehouse_shapefile returns: lw with: [totalSurface::read("surface") as float];
// Logistic providers
// Logistic
Service
providers
create LogisticsServiceProvider from: logistic_provider_shapefile;
create LogisticsServiceProvider from: logistic_provider_shapefile;
/*
/*
...
@@ -156,7 +161,6 @@ global {
...
@@ -156,7 +161,6 @@ global {
}
}
/**/
/**/
// Final destinations
// Final destinations
create FinalDestinationManager from: destination_shapefile with: [huffValue::float(read("huff")), surface::float(read("surface"))];
create FinalDestinationManager from: destination_shapefile with: [huffValue::float(read("huff")), surface::float(read("surface"))];
/*
/*
...
@@ -179,12 +183,10 @@ global {
...
@@ -179,12 +183,10 @@ global {
do init_cost;
do init_cost;
do init_threshold;
do init_threshold;
}
}
/*
/*
* A part of the initialization of the final destinations managers must be made here.
* A part of the initialization of some agents must be made here once every agent have been fully initilized.
* Indeed, we must schedule the FDM according to their surface (larger before). But the scheduling can't be made in the classic init.
*/
*/
reflex second_init when: second_init_bool {
reflex second_init when: second_init_bool {
second_init_bool <- false;
second_init_bool <- false;
...
@@ -209,8 +211,7 @@ global {
...
@@ -209,8 +211,7 @@ global {
AntP <- self;
AntP <- self;
}
}
}
}
ask ForwardingAgent {
ask ForwardingAgent {
do add_network network:road_network mode:'road' nodes:
do add_network network:road_network mode:'road' nodes:
buildingOfFDM + (Warehouse as list) + (MaritimeTerminal as list) + (RiverTerminal as list) + (MaritimeRiverTerminal as list);
buildingOfFDM + (Warehouse as list) + (MaritimeTerminal as list) + (RiverTerminal as list) + (MaritimeRiverTerminal as list);
...
@@ -219,7 +220,7 @@ global {
...
@@ -219,7 +220,7 @@ global {
do add_network network:river_network mode:'river' nodes:
do add_network network:river_network mode:'river' nodes:
(RiverTerminal as list) + (MaritimeRiverTerminal as list);
(RiverTerminal as list) + (MaritimeRiverTerminal as list);
}
}
LHAttractiveness <- 1.0;
LHAttractiveness <- 1.0;
AntAttractiveness <- 3.0;
AntAttractiveness <- 3.0;
do update_proba_to_choose_provider;
do update_proba_to_choose_provider;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment