def solve(self, warmstart=False):
        """
        Args:
            warmstart : (default False) re-solve an updated model
                        instance

        Returns: None

        """
        m = self.m
        cr = self.config_run
        solver_kwargs = {}
        if not warmstart:
            solver_io = cr.get_key('solver_io', default=False)
            if solver_io:
                self.opt = popt.SolverFactory(cr.solver, solver_io=solver_io)
            else:
                self.opt = popt.SolverFactory(cr.solver)
            # Set solver options from run_settings file, if it exists
            try:
                for k in cr.solver_options.keys_nested():
                    self.opt.options[k] = cr.solver_options.get_key(k)
            except KeyError:
                pass
            if cr.get_key('debug.symbolic_solver_labels', default=False):
                solver_kwargs['symbolic_solver_labels'] = True
        if cr.get_key('debug.keep_temp_files', default=False):
            solver_kwargs['keepfiles'] = True
            if self.mode == 'plan':
                logdir = os.path.join('Logs', self.run_id)
            elif self.mode == 'operate':
                logdir = os.path.join('Logs', self.run_id
                                      + '_' + str(self.t_start))
            if (cr.get_key('debug.overwrite_temp_files', default=False)
                    and os.path.exists(logdir)):
                shutil.rmtree(logdir)
            os.makedirs(logdir)
            TempfileManager.tempdir = logdir

        def _solve(warmstart, solver_kwargs):
            warning = None
            if warmstart:
                try:
                    results = self.opt.solve(self.m, warmstart=True,
                                             tee=True, **solver_kwargs)
                except __HOLE__ as e:
                    if 'warmstart' in e.args[0]:
                        warning = ('The chosen solver, {}, '
                                   'does not support warmstart, '
                                   'which may impact performance.').format(cr.get_key('solver'))
                        results = self.opt.solve(self.m, tee=True, **solver_kwargs)
            else:
                results = self.opt.solve(self.m, tee=True, **solver_kwargs)

            return results, warning

        if self.verbose:
            t = datetime.datetime.now().strftime(self.time_format)
            print('\nModel preprocessing complete at {}\n'.format(t))

        if cr.get_key('debug.echo_solver_log', default=False):
            self.results, warnmsg = _solve(warmstart, solver_kwargs)
        else:
            # Silencing output by redirecting stdout and stderr
            with utils.capture_output() as self.pyomo_output:
                self.results, warnmsg = _solve(warmstart, solver_kwargs)
        if warnmsg:
            warnings.warn(warnmsg, exceptions.ModelWarning)
        self.load_results()
dataset/ETHPy150Open calliope-project/calliope/calliope/core.py/Model.solve