In this repository, we (Jasper and Tian Yi) show our solution for the programming exercise of the Dynamic Programming and Optimal Control (DPOC) course at ETH Zurich.
We are meant to solve the following problem: (problem statement).
A sample map of the problem.
The robot needs to travel from B in the upper world to M in the lower world through one of the portals P in order to collect gems. It then needs to go to L in the upper world, again through a portal P, using gems.
While in the lower world, it can be attacked by aliens A with a chance of its gems being stolen. It can also be buffetted around (disturbed) from its intended actions.
This problem formulation is an example of a Stochastic Shortest Path (SSP) problem, which we are can solve with three methods.
- Value Iteration
- Policy Iteration
- Linear Programming
We implement Value Iteration and Linear Programming solutions here in Matlab.
- Open up
main.m
- Choose whether to generate a random world or not with
generateRandomWorld
- If a predefined world is chosen, choose which map to load with
predefined_map
. Accepted values areexampleWorld_1.mat
,exampleWorld_2.mat
,exampleWorld_3.mat
.
- If a predefined world is chosen, choose which map to load with
- Choose which solution in
sol_choice
- Valid options are
"LP"
for Linear Programming and"VI"
for Value Iteration
- Valid options are
A map of the routes chosen by the policy will then pop up. Enjoy!