extract the different phases and amplitudes to get the maximum possible gain

Hello guys some know how to extract the different phases and amplitudes that I should set up in an antenna array to get the maximum possible gain.
When you use the multiport simulation, there is an option called "maximum gain", but it just gives the maximum gain displayed in the viewer. I would like to know how to get the phases to get such maximum gain.
Does somebody know about it?

There is a genericpurpose Optimizer in Sim4Life: you could perhaps try to use that to get the phases that maximize the gain?
The "Maximum Gain" algorithm does exactly what you need but, you are right, it does not return the actual maximizing phase values. This algorithm is intended for showing what the "theoretically optimum gain" could be, so that, if the maximum gain is not "good enough" (peak value or coverage efficiency), one knows that the antenna design needs to be improved. The phase values that yield the maximum (ideal) gain will, however, probably not be those that maximize the realized gain in the actual device. The reason is due to the practical constraints in the feeding network (losses, phase shifters, etc...). Admittedly, the "optimum ideal phases" could, in some cases, provide a good starting point. 
Thank you for your answer @Sylvain . Actually, I'm not only interested in getting the phases and amplitudes for maximizing the gain, but also I would like to know how to get a more symmetrical radiation pattern because my current radiation pattern is a bit coarse and not enough for my purposes.
I like what the "maximum gain realized tool" shows, and now, I know that my array is capable to get such radiation pattern and gain. The point is to know which phrases and amplitudes I should set up to achieve that.The optimizer has also some options to play with the radiation pattern?

sorry @eduumorenoo, I was actually mistaken. The "Maximum Gain" algorithm does return the optimum phases and amplitudes.
The "Max Realized Gain Weights" output of the algorithm shows the optimum phases and amplitudes, as 2d fields of the form phases(theta, phi) and amplitudes(theta, phi).
Just to clarify: the "maximum gain" tool shows what Gain could be achieved in each direction, but it does not show what the radiation pattern would look like. It is a "pointwise" maximization algorithm, in the sense that the bestcase Gain is computed for each direction (theta, phi) independently. So the 3D pattern you see from the "maximum gain" tool is the envelope of all possible Gain patterns. And the "Max Realized Gain Weights(theta, phi)" is a Ndimensional vector with the complex weights (amplitude * exp(1j*phase)) of all N independent elements that achieves the maximum gain in direction (theta, phi).
As for the "generic" optimizer in Sim4Life, it is a generalpurpose tool and allows you to define your own objective function  as an analytical function of quantities computed by the postprocessing pipeline. There are several tutorials for the Optimizer, in case you want to know more.

So definitely max gain it is not useful for my purposes. I wanna construct a more symmetrical radiation pattern and maximize the gain in a certain direction. And of course, I would like to know which parameters I should set up to get such purposes.