Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  construct circular constraint matrices Q,l,r for cplexqcp in MPC

    Posted 05/21/17 12:25 PM

    Originally posted by: michelco


    Hello

    I need some help constructing the Q,l and r matrices for a circular constraint using cplexqcp in an MPC application. 

     

    The constraint is: (x-x_ref)^2 + (y-y_ref)^2 <= w, where w is the radius of the circle. The system has 7 states, 4 inputs and a slack variable and a prediction horizon of 30, thus the decision variable has (7+4+1)*30 = 360 variables. Since the reference is changing at each step in the horizon I should get 30 constraints, of the form given above (just a slightly different value for the ref's at each step). I just can't seem to construct the matrices correctly, r becoms 30x1, l 30x360 but Q becomes 360x360 which cplexqcp deems to be wrong (which it probably is). Anyone can help me out a little bit?

     

    Best regards MC 


    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: construct circular constraint matrices Q,l,r for cplexqcp in MPC

    Posted 05/23/17 01:24 AM

    If I understood correctly you are building up 30 different constrains (r is 30x1). This means Q should be a cell array with one matrix for each constraint, not a single flat matrix.

    Not sure this is an option but it might be easier to use the Class API and use function addQCs to add the constraints one by one.


    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: construct circular constraint matrices Q,l,r for cplexqcp in MPC

    Posted 05/23/17 05:25 PM

    Originally posted by: michelco


    Thank you! I've changed the Q matrix to a cell matrix, but it still gives me the same error "error: incorrect l,Q,r.". I'm using cplexqcp within Matlab by the way. I also tried changing r to a row vector (1x30) but to no avail. I'm guessing it's something wrong with l ?

     

    Never mind, I had forgotten to transpose l. Appreciate the answer though because, it helped me since I didnt realize Q was supposed to be a cell matrix ,so thank you again!


    #CPLEXOptimizers
    #DecisionOptimization


  • 4.  Re: construct circular constraint matrices Q,l,r for cplexqcp in MPC

    Posted 05/24/17 09:29 AM

    For sake of completeness and future reference, here is a version of the cplexqcp.m example shipped with CPLEX that just adds the same quadratic constraint twice:

       % Add two identical quadratic constraints. Both only have a quadratic
       % part. The linear part is all-zero
       % l has one column for each constraint   
       l = [0 0;
            0 0;
            0 0];
       % r has one column for each constraint
       r = [1 1];
       % Q has one cell for each constraint, each cell is a matrix
       Q = { [1  0  0
              0  1  0
              0  0  1], ...
             [1  0  0
              0  1  0
              0  0  1] };

    The important point (that is unfortunately not explicit in the docs) is that Q must be a row of cells.


    #CPLEXOptimizers
    #DecisionOptimization