Question

I have been working on modelling competing airlines in a flight leg. So, the agents that I have modelled are the passengers, which I have modelled as different agents for each time frame they want to fly in. The airlines and the actual time slots of an airport. The idea is that the airlines will vary their fares and schedule to fly on different times depending on their previous flight(iteration) to attract the highest number of passengers or be profitable. The costs are linked to what time slot they want to fly in (higher demand- higher costs). I have allready modelled more or less the passenger choice model using a utility function:

to flightchoice2

let potential-destinations out-link-neighbors

let best-patch max-one-of potential-destinations [utility-for1 myself]


ifelse random-float 1 > q 

[move-to best-patch][move-to one-of potential-destinations]


end  



to-report utility-for2 [businessman89] ;; Schedule Choice

let beta1 1

let beta2 1


let utility (beta1 * (1 / airfare) + beta2 * abs(time - time1))


report utility


end 

"where the (time-time1) basically represents the time difference between what the airline offers and what the passengers want.

My problem comes with actually making the payment so that the turnover of the airlines increases and the agents for the passengers are eliminated. I have followed the sheep-wolf model a-bit and I've got to the point of getting rid of the passengers, but the turnover to the airlines will just not add on right:"

to airfare-payment  ;; payment procedure


let customers1 business1-here      

if customers1 != nobody           

[ ask customers1 [ die ]             

set turnover turnover + airfare ] 



let customers2 business2-here     

 if customers2 != nobody             

[ ask customers2 [ die ]          

  set turnover turnover + airfare ] 



 let customers01 leisure1-here     

 if customers01 != nobody            

[ ask customers01 [ die ]            

  set turnover turnover + airfare ] 



  let customers02 leisure2-here   

 if customers02 != nobody           

[ ask customers02 [ die ]      

  set turnover turnover + airfare ] 



end

Can anyone help with why does the turnover for the airlines is not adding itself correctly?

EDIT 1- A very simplified version my model is uploaded to show the precise problem

Agents are Loaded, links are created to the airplanes from the passengers Agents are Loaded, links are created to the airplanes from the passengers

Airplanes move to their " departure time slots" which are represented by the houses, and then based on the time slot and airfare the passengers make their choice of airplane

Airplanes move to their " departure time slots" which are represented by the houses, and then based on the time slot and airfare the passengers make their choice of airplane

From this figure it is possible to see that the passengers are placed at the same position of the airplane, but when the [airfare-payment] procedure runs (described before), somehow the turnover doesn't add up correctly.

From this figure it is possible to see that the passengers are placed at the same position of the airplane, but when the [airfare-payment] procedure runs (described before), somehow the turnover doesn't add up correctly.

This image shows the count of turnover before the go procedure and after, even though the turnover increases for the airlines it does not do so by the right count. This image shows the count of turnover before the go procedure and after, even though the turnover increases for the airlines it does not do so by the right count

I'm pretty sure that the problem comes from the way the variables are set-up when creating the agents. Turnover is set to be a "turtle-own" variable and airfare is set as an variable for each of the airlines.

breed [business1 businessman78]  ;; business is its own plural, so we use "businessman" as the singular.
breed [business2 businessman89]

breed [Airline1 airplane1] 
breed [Airline2 airplane2]

breed [leisure1 leisureman78]
breed [leisure2 leisureman89]

breed [Runway1 r78] 
breed [Runway2 r89] 

airline1-own [ start-patch time1 airfare capacity turnover]
airline2-own [ start-patch time1 airfare capacity turnover] 
turtles-own [ time cost ]

Then the value for airfare and turnover is set when creating the airplanes in the setup. Airfare for A1 is 100, 1000 for A2

Was it helpful?

Solution

This code is incorrect:

let customers2 business2-here     
if customers2 != nobody

The if condition is always true, because customers2 is an agent set, and nobody isn't, so they are never equal to each other. nobody represents the lack of a single agent; it is not an empty agentset.

(Think of it this way: just because I don't have an apple, that doesn't mean I have an empty bag of apples. I might have nothing at all, not even a bag.)

I think you mean:

let customers2 business2-here
if any? customers2

I don't know if this is the cause of your bug or not, but in any case, you'll want to fix it.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top