Exemplo n.º 1
0
def GLOA_with_disjunctive_bounds(pyomo_model):
    job_result = _JobResult()
    pyomo_results = SolverFactory('gdpopt').solve(
        pyomo_model,
        tee=True,
        strategy='GLOA',
        mip_solver='gams',
        mip_solver_args=dict(solver='cplex',
                             add_options=get_base_gams_options_list()),
        nlp_solver='gams',
        nlp_solver_args=dict(solver='baron',
                             add_options=get_base_gams_options_list()),
        minlp_solver='gams',
        minlp_solver_args=dict(solver='baron',
                               add_options=get_base_gams_options_list()),
        iterlim=300,
        calc_disjunctive_bounds=True,
        time_limit=options.time_limit)
    job_result.solver_run_time = pyomo_results.solver.timing.total
    job_result.pyomo_solver_status = pyomo_results.solver.status
    job_result.iterations = pyomo_results.solver.iterations
    job_result.termination_condition = pyomo_results.solver.termination_condition
    job_result.LB = pyomo_results.problem.lower_bound
    job_result.UB = pyomo_results.problem.upper_bound
    return job_result
Exemplo n.º 2
0
def DICOPT(pyomo_model):
    job_result = _JobResult()
    try:
        pyomo_results = SolverFactory('gams').solve(
            pyomo_model,
            tee=True,
            # keepfiles=True,
            solver='dicopt',
            add_options=get_base_gams_options_list() +
            [f'option reslim={options.time_limit};'])
    except ValueError as e:
        # Handle GAMS interface complaining about using DICOPT for MIPs
        if 'GAMS writer passed solver (dicopt) unsuitable for model type (mip)' in str(
                e):
            pyomo_results = SolverFactory('gams').solve(
                pyomo_model,
                tee=True,
                solver='cplex',
                add_options=get_base_gams_options_list() +
                [f'option reslim={options.time_limit};'])
        else:
            raise
    job_result.solver_run_time = pyomo_results.solver.user_time
    job_result.pyomo_solver_status = pyomo_results.solver.status
    job_result.termination_condition = pyomo_results.solver.termination_condition
    job_result.LB = pyomo_results.problem.lower_bound
    job_result.UB = pyomo_results.problem.upper_bound
    return job_result
Exemplo n.º 3
0
def LOA(pyomo_model):
    job_result = _JobResult()
    pyomo_results = SolverFactory('gdpopt').solve(
        pyomo_model,
        tee=True,
        mip_solver='gams',
        mip_solver_args=dict(solver='cplex',
                             add_options=get_base_gams_options_list()),
        nlp_solver='gams',
        nlp_solver_args=dict(solver='ipopth',
                             add_options=get_base_gams_options_list()),
        minlp_solver='gams',
        minlp_solver_args=dict(solver='dicopt',
                               add_options=get_base_gams_options_list()),
        iterlim=300,
        time_limit=options.time_limit)
    job_result.solver_run_time = pyomo_results.solver.timing.total
    job_result.pyomo_solver_status = pyomo_results.solver.status
    job_result.iterations = pyomo_results.solver.iterations
    job_result.termination_condition = pyomo_results.solver.termination_condition
    job_result.LB = pyomo_results.problem.lower_bound
    job_result.UB = pyomo_results.problem.upper_bound
    return job_result
Exemplo n.º 4
0
def SCIP(pyomo_model):
    job_result = _JobResult()
    pyomo_results = SolverFactory('gams').solve(
        pyomo_model,
        tee=True,
        # keepfiles=True,
        solver='scip',
        add_options=get_base_gams_options_list() +
        [f'option reslim={options.time_limit};'])
    job_result.solver_run_time = pyomo_results.solver.user_time
    job_result.pyomo_solver_status = pyomo_results.solver.status
    job_result.termination_condition = pyomo_results.solver.termination_condition
    job_result.LB = pyomo_results.problem.lower_bound
    job_result.UB = pyomo_results.problem.upper_bound
    return job_result