You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I apologize for any inconvenience, but I am seeking assistance with an issue I've encountered while using the YALMIP toolbox for solving a Mixed Integer Linear Programming (MILP) problem. My problem involves several constraints, as illustrated in Figure 1. Additionally, the definitions for x{k}, mdps(k), and Pflag_trafficlights are provided as follows, respectively. Here, S1=[1,0,0], and Pflag_trafficlights can be known in advance.
x = sdpvar(repmat(ns,1,H+1),ones(1,H+1));
mdps=intvar(H+1,1);
if strcmp(traffic_light_statuses, 'GREEN')
Pflag_trifficlights(k)=1;
elseif strcmp(traffic_light_statuses, 'YELLOW')
Pflag_trifficlights(k)=2;
else
Pflag_trifficlights(k)=3;
end
Unfortunately, I am struggling to identify the cause of an error in my implementation and am unsure how to proceed. Is there a mistake in the way my constraints are described? Is it possible that the cause of this error is caused by a conflict with another constraint. Could you please offer some guidance on how to address this issue? I would greatly appreciate any advice you can provide. Thank you very much!
Hi, Johan! Thank you! I changed like you said, constraints = [constraints,x{1}==[S1Rx;S2Rx;S4*Rx];];
Good news, the code can work successfully, but there are some troubles for the results, the value of mdps are all 0 after the 60th sample point. Do you think is it also caused by the following part? or other reasons. Could you share with me your thoughts for how to debug next step? Thank you very much!
if traffic_light_statuses(k)==1
constraints=[constraints,
implies(a{k}(1),[-5<=S1x{k}<=0, mdps(k+1)==5]);];
flag=1;
elseif traffic_light_statuses(k)==2||traffic_light_statuses(k)==3
flag=1;
constraints=[constraints,
implies(a{k}(2),[-5<=S1x{k}<=0, mdps(k+1)==2]);];
end
constraints = [constraints, sum(a{k}) == 1];
I don't see why your logic would force mdps to be non-zero. if traffic_light_statuses(k)==1 then it can simply set a{k}(1) to 0 and mdps will be unconstrained
Hi Johan, good morning, I got the reason why the mdps are zero, as the slover cann't find a solution. could I consult another question with you?
I rewrite those constrains, which are shown as follows. It seems like the first part conflict with the second part. When I keep both of them, the code can not work, but when I comment one of them, the code can work normally. I can not understand, could you please
give me some guidance about it? Many thanks!
1.if traffic_light_statuses(k)==1
constraints=[constraints,
implies(-10<=S1x{k}<=3, mdps(k+1)==5);];
flag=1;
elseif traffic_light_statuses(k)==2||traffic_light_statuses(k)==3
flag=1;
constraints=[constraints,
implies(-10<=S1x{k}<=3.6, mdps(k+1)==2);];
end
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Dear Johan,
I apologize for any inconvenience, but I am seeking assistance with an issue I've encountered while using the YALMIP toolbox for solving a Mixed Integer Linear Programming (MILP) problem. My problem involves several constraints, as illustrated in Figure 1. Additionally, the definitions for x{k}, mdps(k), and Pflag_trafficlights are provided as follows, respectively. Here, S1=[1,0,0], and Pflag_trafficlights can be known in advance.
x = sdpvar(repmat(ns,1,H+1),ones(1,H+1));
mdps=intvar(H+1,1);
if strcmp(traffic_light_statuses, 'GREEN')
Pflag_trifficlights(k)=1;
elseif strcmp(traffic_light_statuses, 'YELLOW')
Pflag_trifficlights(k)=2;
else
Pflag_trifficlights(k)=3;
end
Unfortunately, I am struggling to identify the cause of an error in my implementation and am unsure how to proceed. Is there a mistake in the way my constraints are described? Is it possible that the cause of this error is caused by a conflict with another constraint. Could you please offer some guidance on how to address this issue? I would greatly appreciate any advice you can provide. Thank you very much!
Warm regards,
Lee.
Beta Was this translation helpful? Give feedback.
All reactions