Dear Ray, Thank you very much for your reply. It must have something to do with the solver, but I am not sure if it has to do with the zero derivative at the starting point. I tried with zero dead band and different starting points and it didn't find the optimum. However, if I moved 'r' away from the middle of l-u, then it converged well. Unforunatelly, I cannot run my code in another solver (not even MIPS), so that I would test this.
Thanks a lot, Panagis On 26 June 2012 19:24, Ray Zimmerman <[email protected]> wrote: > Ahh ... in that case, I'm guessing it has to do with the starting value for > your z variable. In fact, depending on the solver used, it may generate it's > own initial value. If it lies in the deadband, the variable may not move at > all since the derivatives of the cost there are all zero. > > -- > Ray Zimmerman > Senior Research Associate > 419A Warren Hall, Cornell University, Ithaca, NY 14853 > phone: (607) 255-9645 > > > > > On Jun 26, 2012, at 12:19 PM, Panagis Vovos wrote: > > Dear all, > > Please allow me to correct myself. The cost function I have tested has > a negative quadratic coefficient (Cw=-1, see code below). > Therefore the 'z' variable is expected to converge either to 0 or 10. > Instead it converges to 1.9847, that is in the deadband. > Let me remind you that I am trying to add my own cost function for a > new variable 'z' in OPF,according to 5.3 of the user's manual. 'z' is > between 0 and 10, but there are no other linear or non-linear > constraints. The only thing that leads the variable to a specific > value is the cost function attached to it. It is a quadratic cost > function (d=2) with a "dead band" from 1 to 9 (r=5,k=4). Below you can > find the code I have written to implement it. You can add it to any > Matpower case and test it by running the OPF, since 'z' is an > independent variable. The problem is that the result is z=1.9847, i.e. > in the deadband! Does anyone knows why is that? I have also attached > the Matlab figure of the cost function (w,r) I believe I have created. > > %% CODE ADDED IN MATPOWER CASE FILE > > % ADDITION OF 'z' VARIABLE > NumberOfXvars=(size(mpc.bus,1)+size(mpc.gen,1))*2; > OldVarsA=zeros(size(mpc.buslink,1),NumberOfXvars); > NewVars=size(mpc.buslink,1); > NewVarsA=eye(NewVars); > mpc.A=sparse([OldVarsA NewVarsA]); > mpc.l=zeros(NewVars,1); % lower limit equals 0 > mpc.u=10*ones(NewVars,1); % upper limit equals 10 > > % ADDITION OF COST ON 'z' VARIABLES > mpc.N=mpc.A; > % fparm=[d r^ k m]; > mpc.fparm=[2 5 4 1]; > mpc.Cw=sparse([-1]); > > What am I doing wrong? > Any help would be highly appreciated. > > Best regards, > > Panagis Vovos > <NewCost.jpg> > >
