We want to generate a report about sales made each day, write a history() method in OD…
- User
We want to generate a report about sales made each day, write a
history()method inODclass that returns alist of data point, each data point is a three elements array: [day_x, cumulative number of bookings, cumulative
revenue].
generte python type
- Assistant
- User
7. In the final solution, we have a demand matrix estimated using machine learning that gives us the estimated demand for any day_x and price
The goal of this question is to write an algorithm that find the optimal path to maximize the revenue through this matrix
Given a MxN matrix of integers superior to 0, where (0,0) is the top left corner and (m-1,n-1) is the bottom right corner,
we want to write a program that gives the path that maximizes the sum of integers along it.
Only permitted move are to the right or bottom. Each position can only be visited once.
The function that solves the problem should looks something like this
matrix = 1 1 8
3 2 1
#assert max_path_finder([[1, 1, 8], [3, 2, 1]]) == 11, [(0,0) (0,1) (0,2) (1,2)]
You code should pass all the following asserts
assert max_path_finder([[1, 2, 3], [3, 4, 5]]) == (13, [(0, 0), (1, 0), (1, 1), (1, 2)]) assert max_path_finder([[1, 2, 25], [3, 4, 5]]) == (33, [(0, 0), (0, 1), (0, 2), (1, 2)]) assert max_path_finder([[1, 0, 0], [1, 0, 0], [1, 0, 0], [1, 0, 0], [1, 0, 0]]) == (5, [(0, 0), (1, 0), (2, 0), (3, 0), (4, 0), (4, 1), (4, 2)]) assert max_path_finder([[1, 0, 5], [1, 0, 0], [1, 0, 0], [1, 0, 0], [1, 0, 0]]) == (6, [(0, 0), (0, 1), (0, 2), (1, 2), (2, 2), (3, 2), (4, 2)]) assert max_path_finder([[1, 0, 5], [1, 0, 0], [1, 10, 1], [1, 0, 1], [1, 0, 0]]) == (15, [(0, 0), (1, 0), (2, 0), (2, 1), (2, 2), (3, 2), (4, 2)])
- Assistant
- User
wrong it gives (13, [(0, 0), (1, 0), (1, 1), (1, 2), (1, 1), (1, 2), (1, 2)])
- Assistant