Wrong objective value?

28 views
Skip to first unread message

juls...@gmail.com

unread,
Nov 30, 2015, 5:27:08 PM11/30/15
to Gurobi Optimization
Hi,

I'm using the following code in MATLAB to solve an optimal control problem:

    H=gam*([G,-G])'*Q*[G,-G];
 
    sense='';
    [lineq,l2]=size(Aineq);
    alfa=gam*X0'*F'*Q*(F*X0);
    for i=1:lineq
        sense=strcat(sense,'<');
    end
    modelrvz.A=sparse(Aineq);
    modelrvz.obj=f;
    modelrvz.rhs=[bineq];
    parm.outputflag=1;
    modelrvz.objcon=alfa;
    parm.presolve=0;
    modelrvz.sense=sense;
    modelrvz.Q=sparse(H);
    gurobi_write(modelrvz, 'rendezvous_imp1.lp');
    results = gurobi(modelrvz,parm);
    fval1(k)=results.objval;
    U=results.x;
    fval(k)=f'*U+U'*H*U+gam*(F*X0)'*Q*(F*X0);

The problem arises when I check the objetive value, which should be always positive from my problem statement, with the command results.objval I get sometimes negative result, but taking the results.x and computing the objetive function I get positive values, as is has to be. Why is there such a discrepance?

Moreover, I've disabled the presolver because in a certain time step (I need to solve the optimization problem N times) it gives me an error saying that H matrix isnt semi-definite positive and the computation stopped. With quadprog function of MATLAB I don't have these problems, I only have a warning saying that H is not symettric, however it is just due to numerical error computing H.

Thanks.
Reply all
Reply to author
Forward
0 new messages