Commit f3e84050 authored by ThibautDemare's avatar ThibautDemare

Update the way to compute timeToBeDeliver (the var is now inside building agents)

parent 69a59dd0
......@@ -34,6 +34,11 @@ species Building {
list<float> nbRiverQuantitiesLastSteps <- [0.0];
list<float> nbMaritimeQuantitiesLastSteps <- [0.0];
// Measures of efficiency
// based on time to deliver some goods (originally in the FinalConsignee agent)
list<int> localTimeToBeDeliveredLastDeliveries <- []; // This variable is used to have an idea of the efficicency of the LP to deliver quickly the goods
float localTimeToBeDelivered <- 0.0;
action removeVehicleFromList(Vehicle vehicle, string networkType) {
list<Vehicle> leavingVehicles;
if(networkType = "road"){
......@@ -152,9 +157,7 @@ species Building {
if(entering_stock.stepOrderMade >= 0){
// Update lists containing the time to deliver some goods in order to measure the efficiency of the actors
(entering_stock.stock.lp as LogisticsServiceProvider).timeToDeliver <- (entering_stock.stock.lp as LogisticsServiceProvider).timeToDeliver + ((int(time/3600)) - entering_stock.stepOrderMade);
if(stockBuilding.fdm.building = self){ // The average time to be delivered is only useful with the building of the FDM and not for every building of the supply chain
stockBuilding.fdm.localTimeToBeDeliveredLastDeliveries <- stockBuilding.fdm.localTimeToBeDeliveredLastDeliveries + ((int(time/3600)) - entering_stock.stepOrderMade);
}
localTimeToBeDeliveredLastDeliveries <- localTimeToBeDeliveredLastDeliveries + ((int(time/3600)) - entering_stock.stepOrderMade);
}
}
j <- j + 1;
......
......@@ -21,8 +21,9 @@ species FinalConsignee { // Used to be called FinalDestinationManager with assoc
list<float> localNbStockShortagesLastSteps <- [];
float localAverageNbStockShortagesLastSteps <- 0.0;
// based on time to deliver some goods to the final consignee
list<int> localTimeToBeDeliveredLastDeliveries <- []; // This variable is used to have an idea of the efficicency of the LP to deliver quickly the goods
float localTimeToBeDelivered <- 0.0;
// These two following variables have moved in the Building agent
// list<int> localTimeToBeDeliveredLastDeliveries <- []; // This variable is used to have an idea of the efficicency of the LP to deliver quickly the goods
// float localTimeToBeDelivered <- 0.0;
// based on costs of deliveries and warehousing
list<float> localTransportationCosts <- [];
float localWarehousingCosts <- 0.0;
......@@ -149,8 +150,8 @@ species FinalConsignee { // Used to be called FinalDestinationManager with assoc
numberOfHoursOfContract <- 0;
localNbStockShortagesLastSteps <- [];
localAverageNbStockShortagesLastSteps <- 0.0;
localTimeToBeDeliveredLastDeliveries <- [];
localTimeToBeDelivered <- 0.0;
building.localTimeToBeDeliveredLastDeliveries <- [];
building.localTimeToBeDelivered <- 0.0;
localTransportationCosts <- [];
localWarehousingCosts <- 0.0;
localAverageCosts <- 0.0;
......@@ -165,7 +166,7 @@ species FinalConsignee { // Used to be called FinalDestinationManager with assoc
}
}
else if(stratMeasureLSPEfficiency = 2){
if(localTimeToBeDelivered > averageTimeToBeDelivered ){
if(building.localTimeToBeDelivered > averageTimeToBeDelivered ){
return true;
}
}
......
......@@ -142,16 +142,16 @@ global {
// Update the average time to deliver (at the LPs level)
int i <- 0;
float sum <- 0;
ask LogisticsServiceProvider {
if(length(customers) > 0){
ask ((Building as list) + (Warehouse as list)) {
if(length(stocks) > 0){
int j <- 0;
loop while: nbDeliveriesConsideredForTimeToDelivered < length(timeToDeliver) {
remove index: 0 from: timeToDeliver;
loop while: nbDeliveriesConsideredForTimeToDelivered < length(localTimeToBeDeliveredLastDeliveries) {
remove index: 0 from: localTimeToBeDeliveredLastDeliveries;
}
loop while: j<length(timeToDeliver) {
sum <- sum + timeToDeliver[j];
loop while: j<length(localTimeToBeDeliveredLastDeliveries) {
sum <- sum + localTimeToBeDeliveredLastDeliveries[j];
j <- j + 1;
i <- i + 1;
}
......@@ -168,22 +168,24 @@ global {
// Update the average time to be delivered (at the FDMs level)
int i <- 0;
float sum <- 0;
ask FinalConsignee {
int j <- 0;
int localSum <- 0;
ask ((Building as list)) {
if(length(stocks) > 0){
int j <- 0;
int localSum <- 0;
loop while: nbDeliveriesConsideredForTimeToDelivered < length(localTimeToBeDeliveredLastDeliveries) {
remove index: 0 from: localTimeToBeDeliveredLastDeliveries;
}
loop while: nbDeliveriesConsideredForTimeToDelivered < length(localTimeToBeDeliveredLastDeliveries) {
remove index: 0 from: localTimeToBeDeliveredLastDeliveries;
}
loop while: j<length(localTimeToBeDeliveredLastDeliveries) {
sum <- sum + localTimeToBeDeliveredLastDeliveries[j];
localSum <- localSum + localTimeToBeDeliveredLastDeliveries[j];
j <- j + 1;
i <- i + 1;
}
if( length(localTimeToBeDeliveredLastDeliveries) > 0){
localTimeToBeDelivered <- localSum / length(localTimeToBeDeliveredLastDeliveries);
loop while: j<length(localTimeToBeDeliveredLastDeliveries) {
sum <- sum + localTimeToBeDeliveredLastDeliveries[j];
localSum <- localSum + localTimeToBeDeliveredLastDeliveries[j];
j <- j + 1;
i <- i + 1;
}
if( length(localTimeToBeDeliveredLastDeliveries) > 0){
localTimeToBeDelivered <- localSum / length(localTimeToBeDeliveredLastDeliveries);
}
}
}
if(i > 0){
......
......@@ -34,7 +34,7 @@ global {
list<int> possibleLSPSwitcStrats <- [1, 2, 3]; // 1 : NbStockShortages - 2 : TimeToBeDelivered - 3 : Costs
int globalLSPSwitchStrat <- 3;
int nbStepsConsideredForLPEfficiency <- 96; // 4 days // The number of steps considered to compute the logistic provider efficiency
int nbDeliveriesConsideredForTimeToDelivered <- 50;
int nbDeliveriesConsideredForTimeToDelivered <- 1000;
// Attractiveness parameters
float LHAttractiveness;
......
......@@ -68,7 +68,6 @@ species Vehicle skills:[MovingOnNetwork] {
if(location = destination.location){
int j <- 0;
loop while: j < length(transportedCommodities) {
transportedCommodities[j].location <- location;
transportedCommodities[j].incomingDate <- current_date;
ask destination {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment