An example of a system for programming a neurostimulator may include storage device and a pattern generator. The storage device may store a pattern library and one or more neuronal network models. The pattern library may include fields and waveforms of neuromodulation. The one or more neuronal network models may each be configured to allow for evaluating effects of one or more fields in combination with one or more waveforms in treating one or more indications for neuromodulation. The pattern generator may be configured to construct and approximately optimize a spatio-temporal pattern of neurostimulation and/or its building blocks for a specified range of varying conditions using at least one neuronal network model.