Difficulty with explicit big-M relaxation

61 views
Skip to first unread message

sean

unread,
Apr 26, 2018, 1:16:28 AM4/26/18
to YALMIP
Hi Johan,

I am coding the logic for a big-M relaxation of the attached problem I wrote. Basically I have switched dynamics of an electric vehicle (EV) traversing a connected graph. The total distance traveled and battery energy remaining are the dynamics. These have time-invariant box constraints. The logic for switching these two are the same. The EV can traverse any edge whose weight is greater than zero ( relaxed to >= 1). A binary selection variable and the edge matrix form the foundation for what edges an EV can take at a given node. The current test objective function is to maximize the distance traveled in the time horizon.

The problem is feasible when the edge selection ("con") is not included. When it is included it becomes infeasible. I have checked the edge selection logic and it seems tight but obviously it is not. The error could also be in one of the other constraints that divides the feasible space in such a way that it only appears when intersected with the "con" hyperplane.

Any recommendations on how to visualize this in a useful way? Plotting with binary variables seems tricky. Using polyhedron and projection seem to have a pretty large computation time in this problem. The current plot of constraints does not have any physical intuition to me.

As always, I appreciate your help!

Sean
Screen Shot 2018-04-25 at 10.01.37 PM.png
ev_array_full.m

Johan Löfberg

unread,
Apr 26, 2018, 2:39:04 AM4/26/18
to YALMIP
Way too messy to easily see some bug.

Perhaps you could model the logics using high-level operators (implies) instead and let YALMIP take care of the big-M modelling, to see that your logics actually are correct.

Johan Löfberg

unread,
Apr 26, 2018, 3:13:10 AM4/26/18
to YALMIP
and to debug the problematic constraints, add slacks on them, and then minimize the slacks, to see if it is some specific constraint which introduces the problem

Cannot run your code with con added though, as idx is undefined
Message has been deleted
Message has been deleted

sean

unread,
Apr 26, 2018, 2:41:30 PM4/26/18
to YALMIP
I had shied away from using implies as some of the implications were not obvious to me, but I just got it running with it and was able to identify my bugs.

Thanks Johan!

Johan Löfberg

unread,
Apr 26, 2018, 2:44:25 PM4/26/18
to YALMIP
Great to hear!

sean

unread,
Apr 26, 2018, 10:51:15 PM4/26/18
to YALMIP
Unfortunately found some weird behavior.

It appears that what I thought was the causal statement on line 94 actually changes the value of one of the variables. Namely .99*eps_var is resulting in the value of eps_var being changed even though it should evolve under the dynamics of lines 93 or 96. Should the implication here be switched?


ev_implies_capacity.m

Johan Löfberg

unread,
Apr 27, 2018, 2:33:25 AM4/27/18
to YALMIP
To get any answer there you would have to clean up and simplify the file and remove everything which isn't central to the question and the spotted behavior, and mark very clearly what is considered wrong and how it is seen to be wrong. the code is too complex now

Also, my recommendation when you have models like this is to clearly specify the N disjunctive behavior you have (seem to be three dynamic cases). Introduce 1 binary for every case, and then use implies(case(i), everything that holds in this case) + [sum(cases) == 1], instead of doing things like implies(this and that, this) + implies(these things but not this, these things) + .... It cleans up the code typically, and leads to simpler big-M models
Reply all
Reply to author
Forward
0 new messages