Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

In n car_rental_synchronous.py, update np.int and bounds for additional parking cost #165

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions chapter04/car_rental_synchronous.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def __init__(self, truncate, parallel_processes, delta=1e-2, gamma=0.9, solve_4_
self.actions = np.arange(-MAX_MOVE, MAX_MOVE + 1)
self.inverse_actions = {el: ind[0] for ind, el in np.ndenumerate(self.actions)}
self.values = np.zeros((MAX_CARS + 1, MAX_CARS + 1))
self.policy = np.zeros(self.values.shape, dtype=np.int)
self.policy = np.zeros(self.values.shape, dtype=np.int32)
self.delta = delta
self.gamma = gamma
self.solve_extension = solve_4_5
Expand Down Expand Up @@ -151,9 +151,9 @@ def bellman(self, values, action, state):
reward = (real_rental_first_loc + real_rental_second_loc) * RENT_REWARD

if self.solve_extension:
if num_of_cars_first_loc >= 10:
if num_of_cars_first_loc > 10:
reward += ADDITIONAL_PARK_COST
if num_of_cars_second_loc >= 10:
if num_of_cars_second_loc > 10:
reward += ADDITIONAL_PARK_COST

num_of_cars_first_loc -= real_rental_first_loc
Expand Down