function solve_models(models,paths)

mspec = models.specifications;
mfile = models.modfile;
mpath = paths.model;
vpath = paths.model_variations;
rpath = paths.results;
lpath = paths.local;

for m_nmbr=1:size(mspec,1)   
    aux_str={ 'options_' 'param_values_' 'estim_priors_' 'estim_obs_' 'estim_commands_' };  
            disp(mspec{m_nmbr,2})    
    for jj=1:numel(aux_str)  
        

        
        
        if mspec{m_nmbr,jj+2}
            copyfile([vpath aux_str{jj} mspec{m_nmbr,1} '.inc'],[mpath aux_str{jj}  mfile '.inc']);
        else
            copyfile([vpath aux_str{jj} mfile '_base'   '.inc'],[mpath aux_str{jj}  mfile '.inc']);
        end     
    end    
    cd(mpath)    
    eval( ['dynare ' mfile ' console noclearall']);   
    for jj=1:numel(aux_str)
        copyfile([vpath aux_str{jj} mfile '_base'        '.inc'],[mpath aux_str{jj}  mfile '.inc']);
    end    
    eval( ['load '   mfile '_results.mat']);
    eval( ['delete ' mfile '_results.mat']);
    eval( ['rmdir '  mfile ' s']);
    delete *.eps
    
    cd(rpath)   
    eval(['save results_' mspec{m_nmbr,1} ' oo_ M_ bayestopt_' ]);
    cd(lpath)
end