coneprog: Infeasibilities are satisfied in last step from iterative display but exitflag is still -2 (NoFeasiblePointFound)

7 views (last 30 days)
I am trying to solve a trajectory optimization problem with coneprog under the problem-based approach and am having convergence issues. The last iteration of the iterative display appears to show that the problem is feasibly solved:
Iter Fval Primal Infeas Dual Infeas Duality Gap Time
1 0.000000e+00 2.989297e-01 2.661135e-01 2.396722e-03 0.01
2 1.671582e+00 1.371375e-01 1.220827e-01 1.099524e-03 0.02
3 3.247714e+00 4.683911e-02 4.169716e-02 3.755409e-04 0.02
4 5.466823e+00 2.962828e-02 2.637572e-02 2.375500e-04 0.02
5 6.748515e+00 1.679716e-02 1.495319e-02 1.346743e-04 0.02
6 3.367365e+00 1.788542e-03 1.592198e-03 1.433995e-05 0.03
7 5.484853e+00 4.005449e-06 3.565735e-06 3.211443e-08 0.03
8 5.484859e+00 6.005173e-09 5.346126e-09 4.817329e-11 0.04
9 5.484864e+00 1.200136e-11 1.091778e-11 1.141043e-13 0.04
However, I am still getting a -2 exit flag and the message:
Problem is infeasible.
Is there anyway to extract anymore information about why this solution is infeasible? The functions where the solver operations occur are .p files so I can't find what's going wrong on the inside. Also, when a solution is returned infeasible all output fields are empty except the error message. I am using optimality and constraint tolerances of 1e-8 for reference, but even when I drop them down to 1e-1 just for the sake of trying to get a feasible solution returned it still does not work. Does this mean maybe that the solution converges but upper/lower bounds are violated? Any advice would be much appreciated.
  15 Comments
Torsten
Torsten on 4 Aug 2022
Can you show how to "make a wrapper around the p function and capture the last call input" ? I honestly don't know how this can be done in the case of "coneprog".

Sign in to comment.

Accepted Answer

Alan Weiss
Alan Weiss on 10 Jul 2022
I think that you have a misunderstanding about what the iterative display shows. For example, consider the documentation example about trajectory optimization Discretized Optimal Trajectory, Problem-Based. If you insert iterative display in an infeasible problem there, you get the following display:
p0 = [0 0 0];
pF = [5 10 3];
myprob = setupproblem(1);
opts = optimoptions("coneprog",Display="iter");
[solm,fvalm,eflagm,outputm] = solve(myprob,Options=opts);
Solving problem using coneprog. Iter Fval Primal Infeas Dual Infeas Duality Gap Time 1 9.800000e-01 3.681614e-01 3.311258e-01 3.148330e-03 0.10 2 2.051010e+00 1.708611e-01 1.536731e-01 1.461117e-03 0.12 3 1.886027e+00 8.505728e-02 7.650085e-02 7.273667e-04 0.12 4 2.587887e+00 1.176815e-02 1.058432e-02 1.006352e-04 0.12 5 2.287761e+00 2.885400e-05 2.595136e-05 2.467444e-07 0.13 6 2.286884e+00 2.348651e-07 3.892967e-08 3.701098e-10 0.13 Problem is infeasible.
function trajectoryprob = setupproblem(T,air)
if nargin == 1
air = false;
end
N = 50;
g = [0 0 -9.81];
p0 = [0 0 0];
pF = [5 10 3];
Amax = 25;
t = T/N;
p = optimvar("p",N,3);
v = optimvar("v",N,3);
a = optimvar("a",N-1,3,"LowerBound",-Amax,"UpperBound",Amax);
trajectoryprob = optimproblem;
s = optimvar("s",N-1,"LowerBound",0,"UpperBound",3*Amax);
trajectoryprob.Objective = sum(s)*t;
scons = optimconstr(N-1);
for i = 1:(N-1)
scons(i) = norm(a(i,:)) <= s(i);
end
acons = optimconstr(N-1);
for i = 1:(N-1)
acons(i) = norm(a(i,:)) <= Amax;
end
vcons = optimconstr(N+1,3);
vcons(1,:) = v(1,:) == [0 0 0];
if air
vcons(2:N,:) = v(2:N,:) == v(1:(N-1),:)*exp(-t) + t*(a(1:(N-1),:) + repmat(g,N-1,1));
else
vcons(2:N,:) = v(2:N,:) == v(1:(N-1),:) + t*(a(1:(N-1),:) + repmat(g,N-1,1));
end
vcons(N+1,:) = v(N,:) == [0 0 0];
pcons = optimconstr(N+1,3);
pcons(1,:) = p(1,:) == p0;
if air
pcons(2:N,:) = p(2:N,:) == p(1:(N-1),:) + t*(1+exp(-t))/2*v(1:(N-1),:) + t^2/2*(a(1:(N-1),:) + repmat(g,N-1,1));
else
pcons(2:N,:) = p(2:N,:) == p(1:(N-1),:) + t*v(1:(N-1),:) + t^2/2*(a(1:(N-1),:) + repmat(g,N-1,1));
end
pcons((N+1),:) = p(N,:) == pF;
trajectoryprob.Constraints.acons = acons;
trajectoryprob.Constraints.scons = scons;
trajectoryprob.Constraints.vcons = vcons;
trajectoryprob.Constraints.pcons = pcons;
end
The iterative display looks a lot like yours. This problem is definitely infeasible, it is not a question of twiddling some options to make it feasible. I know that this problem is infeasible because setupproblem(1) specifies too small a time for the problem to be solved with the given limits on applied acceleration (see the example for details). Perhaps something like that is going on with your example.
Alan Weiss
MATLAB mathematical toolbox documentation
  2 Comments
Nick
Nick on 4 Aug 2022
Ok yes I had a false understanding of what the iterative display is showing. Thank you for this example. As @Torsten mentioned, do you know if we should be getting any output at iterations that are not converged? Like if we were to set the maximum iterations to something smaller?

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!