How to use the docplex.util.environment.get_environment function in docplex

To help you get started, we’ve selected a few docplex examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github kosticlab / aether / lp / ilp.py View on Github external
mdl.minimize(mdl.sum(qty[s] * s.cost for s in server))
    mdl.print_information()
    url = None
    key = None
    if not mdl.solve(url=url, key=key):
        print("*** Problem has no solution")
    else:
        mdl.float_precision = 3
        print("* model solved as function:")
        mdl.report()
        mdl.print_solution()
        mdl.report_kpis()
        mdl.export_as_lp("cplex.lp")
        os.system("cat cplex.lp")
        # Save the CPLEX solution as "solution.json" program output
        with get_environment().get_output_stream("instances.json") as fp:
            mdl.solution.export(fp, "json")
    return

docplex

The IBM Decision Optimization CPLEX Modeling for Python

Apache-2.0
Latest version published 4 months ago

Package Health Score

68 / 100
Full package analysis

Similar packages