fksato / RideShare

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

RideShare

Usage

python main_driver.py <scenario.in>

provided scenario files by Google Hashcode team

a_example.in

b_should_be_easy.in

c_no_hurry.in

d_metroplis.in

e_high_bonus.in

main_driver.py:

  • environment initialization

RiderDispatcher.py

  • Simulates time
  • Scheduler for cars
  • Maximizes bonus points and number of fares

Rider.py

  • Rider object

  • properties:

    pos: position of rider

    end_pos: fare destination

    start_time: earliest time for pick-up

    end_time: latest time for pick-up

    travel_time: time required to go from rider position to destination

    pickedUp: flag to distinguish if rider has been picked up by car

    bonus: flag if bonus has been collected for the rider

    b_point: value of bonus

    rider_id: identification for rider

  • methods:

    getRiderID: getter for rider ID

    isBonus: getter for whether fare was within time bonus

    pickupRider: setter for pickedUp

    getBonus: setter for bonus flag

    removeBonus: setter for bonus flag

    totalPoints: calculates potential fare points on fare completion

Car.py

  • Car object:

  • properties:

    rider_dispatcher: connection to ride scheduler

    time_limit: time limit of trial

    pos: current position of car

    time_step: current time position

    in_operation: availability of car given time constraint

  • methods:

    curTime: getter for car time

    inOpertaion: getter for in_operation

    finish: seeter for in_opertaion

    updatePosition: update car posiiton

    updateTimeStep: increment car time by time_step

    setTimeStep: set car time to time

About


Languages

Language:Python 100.0%