I've been using MOSEK and YALMIP to solve a particular class of convex optimization problem, and recently decided to try and use the ECOS solver as it seems to produce faster results when dealing with relatively small problems. However, when I change the solver with sdpsettings('solver','ecos'), the problem fails to converge. I originally thought that this was because the problem I'm trying to solve was poorly scaled and MOSEK used some form of variable re-scaling before solving the problem, whereas ECOS did not. Because of this I tried doing my own re-scaling, but ECOS still fails to converge, and as such I was hoping to check if my re-scaling attempt was actually implemented correctly.
As an example of re-scaling equality constraints, I simply multiplied the left- and right-hand side of each constraint by the same scaling factor in order to bring each value in the vector close to 1:
length_scale*r(:,t+1) == length_scale*y(1:3,t+1);
velocity_scale*v(:,t+1) == velocity_scale*y(4:6,t+1);
mass_scale*mc(t+1) == mass_scale*y(7,t+1);
force_scale*tau(:,t+1) == force_scale*u(1:3,t+1);
Similarly, re-scaling inequality constraints was done as follows,
force_scale*sig <= force_scale*(T_max.*exp(-mck).*(1-(mc-mck)));
where length_scale, velocity_scale, mass_scale and force_scale were used to re-scale the lengths, velocities, masses and forces to values around 1, respectively. Finally, since the problem was trying to maximize the final mass, I re-scaled the objective function using mass_scale,
objective = mass_scale*(-mc(N))
The error I get is,
Error using - (line 54)
Adding NaN to an SDPVAR makes no sense.
Error in Convex_Opt_Scaled (line 214)
force_scale*sig <= force_scale*(T_max.*exp(-mck).*(1-(mc-mck)));
I was wondering if these errors occurred because my re-scaling attempts were incorrect, or if there could be another problem with my code completely unrelated to scaling issues.