policies package#

Submodules#

policies.fcfs_policy module#

class policies.fcfs_policy.FCFSPolicy#

Bases: Policy

FCFS Policy (First Come First Serve Policy)

Elevator will (directly) go to the first floor that was requested, then then it will go to the closest destination in the same direction and carries out until done.

name() str#

To be overwritten by sublcasses

policies.look_policy module#

class policies.look_policy.LOOKPolicy#

Bases: Policy

LOOK Policy

Move up and down, stop at every floor if someone is waiting Change direction if no requests in current direction

name() str#

To be overwritten by sublcasses

policies.policy module#

class policies.policy.Action(value, names=None, *values, module=None, qualname=None, type=None, start=1, boundary=None)#

Bases: Enum

MOVE_DOWN = -2#
MOVE_UP = 2#
WAIT = 0#
WAIT_DOWN = -1#
WAIT_OPEN = 3#
WAIT_UP = 1#
class policies.policy.Policy#

Bases: object

Base class for all policies, contains the interface for the policy without logic.

get_action(current_floor, floor_list, elevator_buttons, elevators, elevator, time)#

Returns the action the elevator should take

name() str#

To be overwritten by sublcasses

policies.pwdp_policy module#

class policies.pwdp_policy.PWDPPolicy(elevator_button_weight=1, elevator_button_time_weight=1, floor_button_weight=1, floor_button_time_weight=1, competitor_weight=1, distance_weight=1, distance_exponent=1)#

Bases: Policy

PWDP Policy (Parameterized Weighted Decision Policy)

Policy which evaluates each floor by giving it a score using input parameters (see below).

The score for the i-th floor advertising [Up/Down] is calculated as follows:

s1 = elevator_button_weight * elevator_buttons[i]
s2 = elevator_buttons[i] * elevator_button_weight * elevator_button_time_weight * (target_button_time / max(1, max_elevator_button_time))
s3 = floor_button_weight * button_pressed
s4 = floor_button_weight * floor_button_time_weight * (max_floor_button_time[i] / max(max_all_floor_button_time, 1))
s5 = sum(elevator_distances) * competitor_weight
s6 = distance_weight^(distance_exponent) * abs(current_floor - i)
Score = (s1 + s2 + s3 + s4) / max(1, (s5 + s6))

The elevator will then choose the highest scored floor, set it as target, and move to it. Along the way, it will stop at each floor if someone wants to enter or exit the elevator on that floor.

Parameters:
  • elevator_button_weight (float) – Award elevator button pressed on floor i.

  • elevator_button_time_weight (float) – Award elevator buttons which were pressed a long time ago.

  • floor_button_weight (float) – Award floor buttons which were pressed.

  • floor_button_time_weight (float) – Award floor buttons which were pressed a long time ago.

  • competitor_weight (float) – Penalize if other elevators are heading to floor i.

  • distance_weight (float) – Penalize high distance to target.

  • distance_exponent (float) – Exponent for distance penalty.

name() str#

To be overwritten by sublcasses

policies.pwdp_policy_Enhanced module#

class policies.pwdp_policy_Enhanced.PWDPPolicyEnhanced(people_in_elevator_button_weight=1, elevator_button_time_weight=1, people_floor_weight=1, floor_button_time_weight=1, competitor_weight=1, distance_weight=1, distance_exponent=1)#

Bases: PWDPPolicy

PWDP Policy Enhanced (Enhanced Parameterized Weighted Decision Policy)

Similar to PWDP Policy, but this time the elevator knows the direction of the passengers and the amount of passengers Policy which evaluates each floor by giving it a score using the input parameters (see below).

The score for the i-th floor advertising [Up/Down] is calculated as follows (changes are marked with x):

s1x = people_in_elevator_button_weight * amount_of_people_in_elevator_going_to_floor(i)
s2  = elevator_buttons[i] * elevator_button_weight * elevator_button_time_weight * (target_button_time / max(1, max_elevator_button_time))
s3x = people_floor_weight * amount_of_people_in_floor(i).moving[Up/Down]
s4  = floor_button_weight * floor_button_time_weight * (max_floor_button_time[i] / max(max_all_floor_button_time, 1))
s5  = sum(elevator_distances) * competitor_weight
s6  = distance_weight^(distance_exponent) * abs(current_floor - i)

Additionally s3 = 0 if elevator capacity is reached

Then the i-th floor advertising [Up/Down] will have score:

Score = (s1 + s2 + s3 + s4) / max(1, (s5 + s6))

The elevator will then choose the highest scored floor, set it as target, and move to it. Along the way, it will stop at each floor if someone wants to enter or exit the elevator on that floor.

Parameters:
  • people_in_elevator_button_weight (float) – (changed) Award high amount of people that pressed elevator button for floor i

  • elevator_button_time_weight (float) – Award elevator buttons which were pressed a long time ago

  • people_floor_weight (float) – (changed) Award high amount of people waiting on floor i

  • floor_button_time_weight (float) – Award floor buttons which were pressed a long time ago

  • competitor_weight (float) – Penalize if other elevators are heading to floor i

  • distance_weight (float) – Penalize high distance to target

  • distance_exponent (float) – Exponent for distance penalty

name() str#

To be overwritten by sublcasses

policies.pwdp_policy_optimized module#

class policies.pwdp_policy_optimized.PWDPPolicyOptimized(loadPath='param_optimizer/save_params.txt')#

Bases: Policy

PWDP Policy Optimized (Parameterized Weighted Decision Policy Optimized)

PWDPPolicyOptimized is an optimized version of PWDPPolicy. Policy which evaluates each floor by giving it a score using input parameters (see below).

The score for the i-th floor advertising [Up/Down] is calculated as follows:

s1 = elevator_button_weight * elevator_buttons[i]
s2 = elevator_buttons[i] * elevator_button_weight * elevator_button_time_weight * (target_button_time / max(1, max_elevator_button_time))
s3 = floor_button_weight * button_pressed
s4 = floor_button_weight * floor_button_time_weight * (max_floor_button_time[i] / max(max_all_floor_button_time, 1))
s5 = sum(elevator_distances) * competitor_weight
s6 = distance_weight^(distance_exponent) * abs(current_floor - i)
Score = (s1 + s2 + s3 + s4) / max(1, (s5 + s6))

The elevator will then choose the highest scored floor, set it as target, and move to it. Along the way, it will stop at each floor if someone wants to enter or exit the elevator on that floor.

Parameters:

loadPath (str, optional) – Path to load parameters from.

name() str#

To be overwritten by sublcasses

policies.scan_policy module#

class policies.scan_policy.SCANPolicy#

Bases: Policy

SCAN Policy

Move up and down, stop at every floor if someone is waiting Change direction if reached top or bottom floor

name() str#

To be overwritten by sublcasses

policies.sstf_policy module#

class policies.sstf_policy.SSTFPolicy(prefers_elevator_buttons=True)#

Bases: Policy

SSTF Policy (Shortest Seek Time First)

Move to the closest target in the same direction

name() str#

To be overwritten by sublcasses

Module contents#