Decision Optimization

Decision Optimization

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

 View Only
  • 1.  Identity matrix seen as not positive semi-definite

    Posted Fri June 29, 2018 03:05 PM

    Originally posted by: kreitzpa


    Hi all,

    I am having trouble with my quadratic objective function being seen as nonconvex/not positive semi-definite.  This happens even when I enter the identity matrix.  I am using Python.  Below I put the tuples I enter into the function objective.set_quadratic_coefficients() .  Below the tuples is the matrix it prints out when I do a nested for loop which calls get_quadratic_coeffiencts(x,y) for x in range 8, for y in range 8.

     

    Any ideas on what is going wrong?  My problem is a QP, there are no integer or binary variables involved.

     

    Thanks in advance,
    Pat

     

    (2, 2, 1.0)
    (7, 7, 1.0)
    (0, 0, 1.0)
    (1, 1, 1.0)
    (4, 4, 1.0)
    (5, 5, 1.0)
    (3, 3, 1.0)
    (6, 6, 1.0)
    1.0    0.0    0.0    0.0    0.0    0.0    0.0    0.0    
    0.0    1.0    0.0    0.0    0.0    0.0    0.0    0.0    
    0.0    0.0    1.0    0.0    0.0    0.0    0.0    0.0    
    0.0    0.0    0.0    1.0    0.0    0.0    0.0    0.0    
    0.0    0.0    0.0    0.0    1.0    0.0    0.0    0.0    
    0.0    0.0    0.0    0.0    0.0    1.0    0.0    0.0    
    0.0    0.0    0.0    0.0    0.0    0.0    1.0    0.0    
    0.0    0.0    0.0    0.0    0.0    0.0    0.0    1.0


    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: Identity matrix seen as not positive semi-definite

    Posted Fri June 29, 2018 03:39 PM

    Does Cplex.solution.advanced.get_quadratic_indefinite_certificate() shed any light on this? Are you minimizing or maximizing?


    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: Identity matrix seen as not positive semi-definite

    Posted Fri June 29, 2018 06:55 PM

    Originally posted by: kreitzpa


    Hi Daniel,

     

    Thanks for the reply, the output for get_quadratic_indefinite_certificate()  is:

    CPXPARAM_Read_DataCheck    1
    CPXPARAM_OptimalityTarget       2
    [1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]

    And I am maximizing.  Is there a better way to get the Q matrix than a nested loop calling get_quadratic_coeffiencts(x,y) that you know of?

    Edit:  I see now that it works when minimizing, does CPLEX multiplies Q by -1 when maximizing?


    #CPLEXOptimizers
    #DecisionOptimization


  • 4.  Re: Identity matrix seen as not positive semi-definite

    Posted Fri June 29, 2018 07:26 PM

    Is there a better way to get the Q matrix than a nested loop calling get_quadratic_coeffiencts(x,y) that you know of?

    You can use objective.get_quadratic.

    Edit:  I see now that it works when minimizing, does CPLEX multiplies Q by -1 when maximizing?

    The documentation for CPXchgobjsen indicates that this is expected.

     


    #CPLEXOptimizers
    #DecisionOptimization


  • 5.  Re: Identity matrix seen as not positive semi-definite

    Posted Sat June 30, 2018 03:39 AM

    As stated here, you need a convex objective when minimizing but a concave objective when maximizing

    CPLEX can solve minimization problems having a convex quadratic objective function. Equivalently, it can solve maximization problems having a concave quadratic objective function.

    This is because maximizing xQx is the same as minimizing -xQx. You can use the solution type parameter to ask CPLEX to solve your QP even if it has a non-convex objective.


    #CPLEXOptimizers
    #DecisionOptimization