Homework: Fixed Final Time Optimal Control
Problem 1: Conversion of Hard Constraints to Soft Constraints - Analytic Solution
Given the performance index J = 0∫8 ½u2 dt and the state constraints x·1 = x2 and x·2 = u, with x1(0) = 0 and x2(0) = 0.
Some students asked about the difference between having soft constraints versus hard constraints. So, let's modify the problem where we change the hard constraint requirements x1(8) = 100 and x2(8) = 0 into soft constraints, resulting in a modified performance index J = ½W1(x1-100)2 + ½W2x22 + 0∫8 ½u2 dt. The scale factors W1 and W2 give us the ability to weight each constraint independently and influence the amount of control needed to accomplish the objective to a point where the final states might be 'good enough.'
So you can see the change in the solution, solve this problem analytically by forming the Hamiltonian and implementing the necessary conditions for optimality. Leave the scale factors (W1 and W2) as variables until you come up with a system of two equations that relate the two final states and the scale factors. Then, set W1 = W2 = 1 and solve for x1f and x2f. With those values, write the final equations for x1(t), x2(t), and u(t).
Problem 2: Conversion of Hard Constraints to Soft Constraints - Numeric Solution
Knowing what to expect in your final result, implement the state dynamics in Simulink using a fixed step size of 0.1 seconds and use fminunc to determine the optimal state and control time histories for the system and constraints described above, breaking the control into 81 parameters that you optimize. You will be experimenting with different values W1 and W2.