All problems
Receding Horizon Update
Problem
Shift an MPC state trajectory forward one step after applying the first control.
Drop the first entry of xs and append x_new at the end. Return the new trajectory.
Hint
This is the classic warm start for the next MPC solve.
Test cases
case 1
in: [[1,2,3],4]
expected: [2,3,4]
case 2
in: [[5],6]
expected: [6]
case 3
in: [[0,0],1]
expected: [0,1]
Starter codePython
def receding_horizon_update(xs, x_new):
# Your code here
pass3 test cases · run your code against them in the editor