Diffractive variable beam splitter: optimal design