Initial condition and desired solution in Opt control of heat eq

You need to add a minimal working example for anyone to help you. See Read before posting: How do I get my question answered? on how to set up an MWE