  Plasma-based acceleration has emerged as a promising candidate as an
accelerator technology for a future linear collider or a next-generation light
source. For a linear collider, the energy transfer efficiency from the drive
beam to the wake and from the wake to the trailing beam must be large, while
the emittance and energy spread of the trailing bunch must be preserved. One
way to simultaneously achieve this when accelerating electrons is to use
longitudinally shaped bunches and nonlinear wakes. In the linear regime, there
is an analytical formalism to obtain the optimal shapes. In the nonlinear
regime, however, the optimal shape of the driver to maximize the energy
transfer efficiency cannot be precisely obtained because currently no theory
describes the wake structure and excitation process for all degrees of
nonlinearity. In addition, the ion channel radius is not well defined at the
front of the wake where the plasma electrons are not fully blown out by the
drive beam. We present results using a novel optimization method to effectively
determine a current profile for the drive and trailing beam in PWFA that
provides low energy spread, low emittance, and high acceleration efficiency. We
parameterize the longitudinal beam current profile as a piecewise-linear
function and define optimization objectives. For the trailing beam, the
algorithm converges quickly to a nearly inverse trapezoidal trailing beam
current profile similar to that predicted by the ultrarelativistic limit of the
nonlinear wakefield theory. For the drive beam, the beam profile found by the
optimization in the nonlinear regime that maximizes the transformer ratio also
resembles that predicted by linear theory. The current profiles found from the
optimization method provide higher transformer ratios compared with the linear
ramp predicted by the relativistic limit of the nonlinear theory.
