CST - Optimize the antenna parameters to have a specific radiation pattern

Hi,

 In various articles, authors define specific pattern equations (such as the Fourier series) and optimize antenna parameters to achieve desired results.

  1. If I want to optimize my antenna pattern based on a specific pattern equation, how can I define this equation in the optimizer within CST Studio Suite  ?
  2. Alternatively, if I need to optimize my antenna so that its radiation pattern meets specific values at certain angles, how can I accomplish this using the optimizer in CST Studio?

Thank you