Code verification

15 views
Skip to first unread message

Aruho Tinka

unread,
May 18, 2024, 3:54:12 AMMay 18
to netlogo-users
Dear colleagues,
I seek your assistance in correcting my code which is not performing as expected - the 'Operators-Income' accumulation seems astronomical more than
The Operator gathers fare collections into "total-trip-collection", from which he pays the rent for the vehicle as "remittance", and "Operator-costs". If they gather enough to cover these two expenses, they pay themselves with the balance. If they dont gather enough, they meet "Operator-costs" and pay the remainder to the vehicle owner and go without anything.

ask Operators with [any? link-neighbors with [breed = Veh-Owners]] [
    if job? = True and ( ticks = operating-time or ticks mod 720 = 0) and dismissed-tracker <= 3 [remit-target-fee take-balance]

to remit-target-fee
  If ticks mod 720 = 0 [
    setxy start-x start-y
     set actual-collect total-trip-collection - Operator-costs
      let my-Veh-Owner one-of link-neighbors with [ breed = Veh-Owners]

    ifelse actual-collect >= remittance [
       ask my-Veh-Owner [
        set actual-received   [remittance] of myself
        set Owners-Income Owners-Income + actual-received]

        set distance-traveled 0
        set Operator-costs 0
        set operating-time 0
        ] [
     let actual-remittance actual-collect
        ask my-Veh-Owner [
        set actual-received [actual-remittance] of myself
        set Owners-Income Owners-Income + actual-received]
      set Owner-link nobody
      ask my-links [die]
    ]
  ]
end
to take-balance
  if ticks mod 720 = 0 [if actual-collect >= remittance [
  set my-pay actual-collect - remittance
      set Operators-Income Operators-Income + my-pay]
    if my-pay < 0 [
    set my-pay 0
  ]
    set total-trip-collection 0]
end

Thank you

Jacob Kelter

unread,
May 19, 2024, 11:53:15 PMMay 19
to Aruho Tinka, netlogo-users
It would be helpful if you attached your model so people can easily run it and see if they catch the bug. A little more context on the purpose of the model and what it is supposed to do would also be helpful. 

--
You received this message because you are subscribed to the Google Groups "netlogo-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to netlogo-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/netlogo-users/CAE7wW1xqDWT3WMV3gYHsTbKiNP%2B0x%2Bp19Pb0AMC-4LpD%3Dbfg5Q%40mail.gmail.com.


--

Reply all
Reply to author
Forward
0 new messages