Decision Optimization

Decision Optimization

Delivers prescriptive analytics capabilities and decision intelligence to improve decision-making.

 View Only
Expand all | Collapse all

Conversion from MIP to LP

  • 1.  Conversion from MIP to LP

    Posted Wed November 20, 2019 12:35 PM

    Originally posted by: JungS


    Hello,

     

    I am using Python to write a model and trying to convert MIP model to LP.

    I simply thought I could change the variable type from " binary " to "continuous" and solve it.

    But, CPLEX still recognize the model as MIP.

    What else should I check to solve the model as lp ? 

    Or is there any way I can force the model to use LP?

    If there is an error coming up after forcing to use LP, then I can find my mistake easier.


    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: Conversion from MIP to LP

    Posted Wed November 20, 2019 04:53 PM

    Here is a simple script using the CPLEX Python API to read in a model from the command line, convert it to an LP, and then write the LP file to disk:

    import sys
    import cplex
    
    c = cplex.Cplex(sys.argv[1])
    print("Original problem type:", c.problem_type[c.get_problem_type()])
    print("Converting to LP....")
    c.set_problem_type(c.problem_type.LP)
    c.write("problem.lp")
    

     


    #CPLEXOptimizers
    #DecisionOptimization