Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  CPLEX Error 1017: Not available for mixed-integer programs.

    Posted 07/28/15 05:14 PM

    Originally posted by: NellyMonserrat


    Hello everybody.

    Could someone help me a little bit? I am new using cplex and also with python, so my apologies in advance if my questions is a silly one.

    I'm using cplex 12.5 and python 2.7, the thing is that I want to get the dual variables of a LP problem but I get error 1017 that said Not available for mixed-integer programs, even when my variables are of continuous type and my constraint are lineal, has anybody some ideas?

    Thanks for you attention. 


    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: CPLEX Error 1017: Not available for mixed-integer programs.

    Posted 07/28/15 06:17 PM

    Originally posted by: NellyMonserrat


    Here is my code, 


    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: CPLEX Error 1017: Not available for mixed-integer programs.

    Posted 07/28/15 07:28 PM

    In the following lines of code, I have commented out a few lines from your program and replaced them with alternatives:

    #LIP.variables.add(names=[Columnas[s][6] for s in xrange(b)],obj= [Columnas[s][5] for s in xrange(b)], types = ["C"] * b,   lb = [0] * b, ub = [1] * b)
    #LIP.variables.add(names=["x"+str(j) for j in range(1,1+Centros)],obj=[CDs[j].ctol for j in xrange(Centros)], types = ["C"]*len(CDs), lb= [0]*len(CDs), ub=[1]*len(CDs))
        
    #LIP.variables.add(names=[Columnas[s][6] for s in xrange(b)],obj= [Columnas[s][5] for s in xrange(b)], types = ["C"] * b,   lb = [0] * b, ub = [1] * b)
    #LIP.variables.add(names=["x"+str(j) for j in range(1,1+Centros)],obj=[CDs[j].ctol for j in xrange(Centros)], types = ["C"]*len(CDs), lb= [0]*len(CDs), ub=[1]*len(CDs))
    LIP.variables.add(names=[Columnas[s][6] for s in xrange(b)],obj= [Columnas[s][5] for s in xrange(b)], lb = [0] * b, ub = [1] * b)
    LIP.variables.add(names=["x"+str(j) for j in range(1,1+Centros)],obj=[CDs[j].ctol for j in xrange(Centros)], lb= [0]*len(CDs), ub=[1]*len(CDs))
    
    LIP.variables.add(names=[Columnas[s][6] for s in xrange(b)],obj= [Columnas[s][5] for s in xrange(b)], lb = [0] * b, ub = [1] * b)
    LIP.variables.add(names=["x"+str(j) for j in range(1,1+Centros)],obj=[CDs[j].ctol for j in xrange(Centros)], lb= [0]*len(CDs), ub=[1]*len(CDs))
       
    

    The difference here is that the uncommented lines do include the "types" arguments to variables.add().  If you read the documentation for this method, you'll see the following note:

    "If types is specified, the problem type will be a MIP, even if all variables are specified to be continuous."

     

    You can check that this is true by adding the following line of code to your program:

    print "Problem Type: " + LIP.problem_type[LIP.get_problem_type()]
    

    With those changes, the call to get_dual_values does not fail for me.


    #CPLEXOptimizers
    #DecisionOptimization


  • 4.  Re: CPLEX Error 1017: Not available for mixed-integer programs.

    Posted 07/29/15 02:46 PM

    Originally posted by: NellyMonserrat


    That's right, thank you so much, I spent a lot time in this trouble, and now, my code works. 

    For last, I'm using the Cplex Python API Reference Manual in IBM web page, do you happen to know other source for consulting?

    Thanks a lot !!! 


    #CPLEXOptimizers
    #DecisionOptimization


  • 5.  Re: CPLEX Error 1017: Not available for mixed-integer programs.

    Posted 07/29/15 03:49 PM

    The reference manual is probably the best resource.  I've linked to the most recent version (12.6.2), but you can also pick older versions within the Knowledge Center.  Over time, we do try to make improvements, but you can leave comments on any page of the documentation if you feel there is something missing, or that can be improved.  The CPLEX Python API is a relatively light layer that sits on top of the C Callable Library.  Sometimes it helps to look at the documentation for the C functions (e.g., CPXXcopyctype), but it isn't always trivial to figure out which function you need to look at.  There's also a lot of useful information in the examples shipped with CPLEX.

     


    #CPLEXOptimizers
    #DecisionOptimization


  • 6.  Re: CPLEX Error 1017: Not available for mixed-integer programs.

    Posted 07/29/15 04:53 PM

    Originally posted by: NellyMonserrat


    Ok, I'll check the documentation for the C functions and the reference manual more carefully. 

     

    Thanks a  lot. :)


    #CPLEXOptimizers
    #DecisionOptimization