Question: Help with optimization

I've got this huge chunk of code which leads to an optimiazation at the very last line (Bestangles:=minimize(maximize()-minimize))). This minization is taking a very long time (havent solved it yet) and I would very much like to reduce that time. As I've understood maple does optimization by differentiating and then finding all extremes and comparing. Would this mean that since I minimize and optimize within a minimization command, it differentiates a ton of times? And if this is the case, can I somehow do the differentiation beforehand, since it is the same function being differentiate all the time? Or is there some other way I can improve the code? 
Thanks alot!

Heres the full code:

Please Wait...