Optimisation with a nonlinear relationship

68 views
Skip to first unread message

Louis Hallerdt

unread,
May 16, 2015, 11:22:35 AM5/16/15
to yal...@googlegroups.com
Hello,

I am running an optimisation problem using YALMIP and the solver gurobi.
However, this solver would not be appliable anymore since I have to include a non linear and non convex relation ship between one decision variable "doddv" and another one "Lifedv".

the function in question fits the two data set of DOD(Depth of discharge) and Lifetime(Battery duration over this DOD) and is generated thanks to polyfit as shown below

function Lifedv = LifetimeDODfunction(doddv)

L = 7:0.5:15;   %lifetime data
dod = [90 80 70 64 57.5 52 48 43 40 37 34 31 29 26 24 22 20];   %dod data
n=2;        %order of the fitted curve from data of the manufacturer

pinv = polyfit(dod,L,n);

Lifedv=0;
    for i=1:n+1
        Lifedv=Lifedv + pinv(i)*doddv.^(n+1-i);
    end

end


Then I call this in the section where I define all my YALMIP variables

for b=1:Ns
    Lifedv(b,:) = sdpfun(doddv(b,:),'LifetimeDODfunction');
end

which works as long as I don't define constraints that involve "Lifedv". If I do, I get "Warning: Solver not applicable (gurobi)" as expected...

Is there a way to manipulate constraints that need this variable "Lifedv"?
I need this data to improve the objective function.by including the new cost "ObjopBattLife" in the multiobjective problem I have.

Thank you in advance


Exact_relaxation_LifetimeTest1.m
ADMM_FINAL_4.mat
cluster.mat
LifetimeDODfunction.m

Johan Löfberg

unread,
May 18, 2015, 1:34:10 AM5/18/15
to yal...@googlegroups.com
You have a nonlinear expression, so why would you be able to use Gurobi?

However, you complicate matters by using sdpfun. sdpfun means the solver knows nothing about the objective, and thus has no derivatives etc. The function is a simple polynomial though, so just use  Lifedv(b,:) =LifetimeDODfunction(doddv(b,:)). Of course, it is still nonlinear, so a nonlinear solver is required

Johan Löfberg

unread,
May 18, 2015, 1:53:35 AM5/18/15
to yal...@googlegroups.com
Your model is unnecessarily nonconvex though. The polynomial p(z) you fit is a positive quadratic

pinv = polyfit(dod,L,n);
K>> pinv
pinv =

    0.0015   -0.2745   19.6867
K>> z = 0:1:100;
K>> plot(pinv(1)*z.^2 + pinv(2)*z + pinv(3))

You then add a constraint which says p(z)>=0 (i.e, you get a nonconvex qudratic constraint if you skip the whole sdpfun stuff). This constraint is redundant though, as the quadratic is positive.
Reply all
Reply to author
Forward
0 new messages