This paper presents a general methodology for the optimal design of stimulation patterns applied to neuronal ensembles in order to elicit a desired effect. The methodology follows a variant of the hierarchical Volterra modeling approach that utilizes input-output data to construct predictive models that describe the effects of interactions among multiple input events in an ascending order of interaction complexity. The illustrative example presented in this paper concerns the multi-unit activity of CA1 neurons in the hippocampus of a rodent performing a learned delayed-nonmatch-to-sample (DNMS) task. The multi-unit activity of the hippocampal CA1 neurons is recorded via chronically implanted multi-electrode arrays during this task. The obtained model quantifies the likelihood of having correct performance of the specific task for a given multi-unit (spatiotemporal) activity pattern of a CA1 neuronal ensemble during the 'sample presentation' phase of the DNMS task. The model can be used to determine computationally (off-line) the 'optimal' multi-unit stimulation pattern that maximizes the likelihood of inducing the correct performance of the DNMS task. Our working hypothesis is that application of this optimal stimulation pattern will enhance performance of the DNMS task due to enhancement of memory formation and storage during the 'sample presentation' phase of the task.