minimise the peak value

52 views
Skip to first unread message

April Lee

unread,
Jan 18, 2018, 10:26:51 PM1/18/18
to YALMIP
Dear Löfberg,

My problem is the mix-integer optimisation, where the simplified version is as follows:

int=0.25; % 24 h is cut into 96, and each is 15 min (0.25h)
start=[5];% start time 
arrival=[8];%arrival time
parking=[1:start,(arrival+1):96];
distance=[5]; %distance 

chargingrate=3.16;%kw
energycon=0.188;%kwh/km
capacity=24;%kwh
chargingeff=0.9;

% define variables and constraints
soc=sdpvar(1,96); Constraints1=[soc>0 & soc<=1];% constraint 1: state of charge(soc) should between 0 and 1 at any time period among [1,96]
u=intvar(1,96);   Constraints2=[];% constraint 2: u is binary,  u = {0 or 1} within parking period parking=[1:start,(arrival+1):96], and u = 0, othervise;

Constraints1=[Constraints1,soc(1,arrival)==1-energycon.*distance./capacity];
Constraints2=[Constraints2,u(1,1:arrival)==0];%1:41
Constraints1=[Constraints1,soc>0 & soc<=1];
for ii=arrival:95
Constraints1=[Constraints1,soc(1,ii+1) == soc(1,ii) + u(ii+1).*chargingrate*int];
end
ops = sdpsettings('verbose',1,'debug',1);
obj=max( sum(u,1).*chargingrate; %objective is to minimise the peak value among time period of [1,96];
optimize(Constraints1,Constraints2,obj),ops)

I got an error as:

Error using solvesdp (line 91)
Second argument (the objective function h) should be an sdpvar or logdet object (or empty).
Error in optimize (line 31)
[varargout{1:nargout}] = solvesdp(varargin{:}); 

Thank you! 

Johan Löfberg

unread,
Jan 19, 2018, 12:34:38 AM1/19/18
to YALMIP
Message has been deleted

April Lee

unread,
Jan 21, 2018, 11:18:32 PM1/21/18
to YALMIP
Thank you very much for your reply. I have revised it accordingly as:
My current code is :

int=0.25; % 24 h is cut into 96, and each is 15 min (0.25h)
start=[5,10,25];% start time 
arrival=[8,20,45];%arrival time
dis=[10,80,100]; %distance 

chargingrate=3.16;%kw
energycon=0.188;%kwh/km
capacity=24;%kwh
chargingeff=0.9;

u=binvar(1,96);
soc=sdpvar(1,96);
Constraints1=[];
Constraints1=[Constraints1,soc(1,arrival(1,1))==1-energycon.*dis(1,1)./capacity];
Constraints1=[Constraints1,u(1,1:arrival(1,1))==0];
Constraints1=[Constraints1,soc(1,arrival(1,1))>=0.5 &soc(arrival(1,1))<=1];
for jj=2:3
    Constraints1=[Constraints1,soc(1,start(1,jj))==soc(1,arrival(1,jj)-1)+sum(u(1,(arrival(1,jj-1)+1):start(1,jj))).*chargingrate*int];%43=43+
    Constraints1=[Constraints1,u(1,(start(1,jj)+1):arrival(1,jj))==0];
    Constraints1=[Constraints1,soc(1,arrival(1,jj))==soc(1,start(1,jj))-energycon.*dis(1,jj)./capacity];
    Constraints1=[Constraints1,soc(1,arrival(1,jj)) >= 0.5 & soc(1,arrival(1,jj)) <= 1];% constraint: soc should between 0 and 1
    Constraints1=[Constraints1,soc(1,start(1,jj)) >= 0.5 & soc(1,start(1,jj)) <= 1];% constraint: soc should between 0 and 1
end
ops = sdpsettings('solver','cplex','cachesolvers',11);
optimize(Constraints1,max(sum(u,1).*chargingrate),ops)
%u1=value(u)
%soc1=value(soc)

But there is still an error as:

Row 'c127' infeasible, all entries at implied bounds.
Presolve time = 0.00 sec. (0.02 ticks)
ans = 
  struct with fields:

    yalmiptime: 0.1150
    solvertime: 0.0135
          info: 'Infeasible problem (CPLEX-IBM)'
       problem: 1



Johan Löfberg

unread,
Jan 22, 2018, 2:58:28 AM1/22/18
to YALMIP
The solver finds your problem trivially infeasible as you have conflicting bounds or something similar to that

Reply all
Reply to author
Forward
0 new messages