Based on previous works, we have constructed a model of cortical network  in order to generalize the application of adaptive algorithm, from single cell  to the activity of populations of cortical neurons. The network is controlled by afferent connectivity from thalamus. This connectivity is described by a Poisson process with a rate depending on time. The procedure of off-line optimization of sensory stimuli is applied both to cortical network model and experimental data of sensory cortex (activity of single units from somatosensory cortex and multi-units from auditory cortex). In all cases, the stimulus has two control parameters: modulation and amplitude of external input for network model, frequency and locations for tactile stimulus and intensity and frequency for auditory stimulus.