0

I have a given path for 6 DOF manipulator for given knots. path(dof,knot)

path_f=[-0.5131   -0.6587   -1.0058   -1.4202   -1.7674   -1.9130
      -0.8696   -0.6711   -0.1980    0.3667    0.8399    1.0383
      -0.8961   -0.7433   -0.3789    0.0560    0.4205    0.5733
       1.1714    0.9639    0.4691   -0.1215   -0.6163   -0.8238
      -3.1000   -2.5800   -1.3400    0.1400    1.3800    1.9000
      -1.1514   -0.9439   -0.4491    0.1415    0.6363    0.8438]

I generated cubic splines between each joints and and each time interval is defined as h(i) and I tried to find the minimum h value which is h(1)+h(2)+h(3)+h(4)+h(5).

to solve that problem I wrote a code:

  options=optimset('Algorithm','sqp','Display','iter','DiffMinChange',1e-16,'DiffMaxChange',1e-4,'TolFun',1e-14,'TolX',1e-20,'MaxFunEvals',60000,'MaxIter',1000);

    h0=[0.001; 0.001; 0.001; 0.001; 0.001]

    h=fmincon(@(h)objecfun(h,path), h0, [], [], [], [], [0; 0; 0; 0; 0] , [], @(h) nonlconstraint(h,Robot,path_f,dof), options); 

When I run the code it says:

Solver stopped prematurely. fmincon stopped because it exceeded the iteration limit, options.MaxIter = 1000 (the selected value).

After 5th iteration f(x) value doesn't change and the results:

    Norm of First-order
 Iter F-count            f(x) Feasibility  Steplength        step  optimality
    0       6    2.500000e-01   2.001e+01                           1.000e+00
    1      12    3.903637e-01   8.013e+00   1.000e+00   6.374e-02   6.077e-01
    2      18    5.115308e-01   2.485e+00   1.000e+00   5.914e-02   3.255e-01
    3      24    5.519283e-01   4.258e-01   1.000e+00   2.941e-02   1.712e-01
    4      30    5.528961e-01   1.288e-02   1.000e+00   5.382e-03   3.098e-02
    5      36    5.530002e-01   4.399e-06   1.000e+00   2.153e-04   2.442e-02
    6      42    5.530000e-01   3.403e-12   1.000e+00   1.305e-07   1.828e-06
    7      48    5.530000e-01   8.704e-14   1.000e+00   1.050e-13   3.103e-07
    8      54    5.530000e-01   8.349e-14   1.000e+00   3.211e-15   1.465e-07
    9      65    5.530000e-01   6.573e-14   1.681e-01   2.713e-16   1.319e-07
   10      72    5.530000e-01   3.020e-14   7.000e-01   9.286e-16   3.740e-08

I have no idea about what the reason behind it. Could you please help me?

user70299
  • 77
  • 10
  • It could be because: 1) Your function to minimize is wrong 2)Minimizing that function is very hard and needs more iterations 3)Minimizing that function is not possible. – Ander Biguri Jul 30 '15 at 11:48
  • I also added the results. I changed the iteration number and the f(x) value which is the h value remains same, however the process continue. – user70299 Jul 30 '15 at 12:01

1 Answers1

0

Your f(x) probably is changing but you don't see it in this resolution. Look at the magnitude of your step size. Try scaling your problem or (if reasonable for your case) increasing DiffMinChange.

mabe
  • 125
  • 1
  • 10
  • There are also TolFun and TolX. Do you need such a high accuracy? Can your objective function provide f(x) with such a high accuracy? – mabe Jul 30 '15 at 13:07
  • I also tried to increase the DiffMinChange and it didn't work. It gives error again. It says: Local minimum possible. Constraints satisfied. fmincon stopped because the size of the current step is less than the selected value of the step size tolerance and constraints are satisfied to within the selected value of the constraint tolerance. – user70299 Jul 30 '15 at 13:17
  • This doesn't sound like an error actually (The message you get in your question doesn't either). It gives you the details about why the optimiser stopped. A well configured optimiser is a balanced compromise between required accuracy and number or iterations/computation time. What do your results look like this time? – mabe Jul 30 '15 at 13:23
  • Is it possible that this is the local minimum value? If yes, how can I get rid of it? – user70299 Jul 30 '15 at 13:38
  • I don't know the shape of f(x) but in theory it is possible. To cope with it you can: (1) analyse the shape of f(x), check if it at all has local minima, (2) if f(x) is not too crazy change the initial values such that the algorithm finds the global min more easily (also might improve computation time) or (3) choose a global optimiser. – mabe Jul 30 '15 at 13:55
  • My objfun is `h(1)+h(2)+h(3)+h(4)+h(5)` which means linear but constraints are `abs(-(d(i+1)-time(j))^2/(2*h(i))*ddq(i)+(time(j)-d(i))^2/(2*h(i))*ddq(i+1)+(ptheta(i+1)/h(i)-h(i)*ddq(i+1)/6)-(ptheta(i)/h(i)-h(i)*ddq(i)/6))-10<=0` I started to not to be sure about the algorithm that I use (sqp). Is it correct or should I change it? I also tried to use 'interior-point' algorithm but it also got stuck local minimum. – user70299 Aug 03 '15 at 14:12
  • I still have the same problem. So far I've tried to 1. Increase the DiffMinChange: it still couldn't find the solution, 2. Change 'TolFun' and 'TolX' it said: No feasible solution found. fmincon stopped because the size of the current step is less than the selected value of the step size tolerance but constraints are not satisfied to within the default value of the constraint tolerance. Does anyone have an idea about the problem? – user70299 Sep 24 '15 at 14:02
  • sorry cant help you further. maybe the problem does not have a feasible solution? By the way, I'm going to remove this answer since it is not actually an answer. So if you have a new question or clarification please post it to your question above. – mabe Sep 25 '15 at 10:42