matlab+cplex+yalmip solve TD-VRP (sdpvar reference as function input variable)

87 views
Skip to first unread message

jianfeng

unread,
May 8, 2019, 3:56:53 AM5/8/19
to YALMIP
Dear professor:
      This problem confused me for few weeks.


for i=1:cityNum
    for j=1:cityNum
        for k=1:vNum
            if i~=j     
                F=[F;Tik(2,i,k)+mydijkstra_T(dym_v,distance_matrix,dot(i),dot(j),Tik(2,i,k))-Tmax*(1-Xijk(i,j,k))<=Tik(1,j,k)];%               
            end
        end
    end
end
.......

function myT=mydijkstra_T(bb,a,sb,db,t_start);
n=size(a,1); visited(1:n) = 0;
T(1:n) = inf; T(sb) = t_start;
visited(sb)=1; u=sb; T(sb) = t_start
parent(1:n) = 0; 
dt(1:n) = inf;dt(sb) = 0;

for i = 1: n-1
     id=find(visited==0); 
     for v = id
         for k =1:48
             %t_seq=0.25;   6-12
             if (0.25*k+5.75)<=T(u) && T(u)<(0.25*k+6) 
                         if (0.25*k+6-T(u))*bb(k,u,v)>=a(u, v)                   
                                if   a(u, v)/bb(k,u,v) +T(u) < T(v)
                                     T(v) = T(u) + a(u, v)/bb(k,u,v);  
                                     dt(v) = dt(u) + a(u, v)/bb(k,u,v);
                                     parent(v) = u;                                    
                                end
                         end
.......

NOTE:  Tik is sdpvar  variable,  and mydijkstra_T is a dijkstra function .



     When use sdpvar as  this function input variable,it seems it doesn't work at all.I would be extremely grateful to get your help.



Johan Löfberg

unread,
May 8, 2019, 3:59:18 AM5/8/19
to YALMIP

jianfeng

unread,
May 8, 2019, 4:27:49 AM5/8/19
to YALMIP
so what can I do to my function,implies seems not to be a solution.

Johan Löfberg

unread,
May 8, 2019, 5:07:13 AM5/8/19
to YALMIP
Sure looks like you have some simple piecewise affine dynamics, hence implies would be applicable. You will have to refactor your code of course, introducing new variables, generating constraints etc
Reply all
Reply to author
Forward
0 new messages