Sudden postural change happened while tuning objective function weighting

OpenSim Moco is a software toolkit to solve optimal control problems with musculoskeletal models defined in OpenSim using the direct collocation method.
POST REPLY
User avatar
Simon Jeng
Posts: 87
Joined: Fri Sep 07, 2018 8:26 pm

Sudden postural change happened while tuning objective function weighting

Post by Simon Jeng » Tue Apr 05, 2022 8:23 am

Hi all,

I selected two goals to predict the initial posture of the box lifting motion in Moco. I'm sorry that I have to keep these goals a secret, because they are key innovations in my unpublished paper. Here I just nominate them as J1 and J2. When I minimize J1, I could get a squatting posture as the leftmost one in the figure shows . When J2 is minimized, I could get a semi-squat posture as the rightmost one shows.

Then, I try to get intermediate postures by combining the two goals into a sum weighted objective function (J=w1J1+w2J2, w1+w2=10). I expect the predicted postures to change gradually from squatting to semi-squatting when I adjust the weightings. Specially, reducing the w1 and increasing w2 under the condition that w1+w2=10.

From the predicted results in the figure, the postures are almost unchanged in the first seven weighting sets, but suddenly change to semi-squatting when (w1,w2)=(3,7). Then the subsequent predicted postures keep the same semi-squatting.

I thought I should test more weighting sets between (4,6) and (3,7), which means (3.9,6.1), (3.8,6.2), ... . But I can still see a sudden postural change at one node. What may cause this problem?

Thanks,
Simon
Attachments
initial posture.png
initial posture.png (126.61 KiB) Viewed 1537 times

User avatar
Ton van den Bogert
Posts: 164
Joined: Thu Apr 27, 2006 11:37 am

Re: Sudden postural change happened while tuning objective function weighting

Post by Ton van den Bogert » Tue Apr 05, 2022 9:13 am

That is an interesting observation and definitely possible for certain problems.

With two objectives, this can be understood graphically.

If you minimize J1 while keeping J2 constant (or the other way around), you get the Pareto front which is typically a monotonically decreasing function J2 = f(J1).

The minimum of the objective w1*J1 + w2*J2 is where the Pareto front touches the straight line w1*J2+w2*J2 = C with the smallest C. This happens where the slope of the straight line (-w1/w2) is equal to the slope of f(J1). If there is a slope value for which this happens in two places, that is a bifurcation. Two different solutions have the same cost. If the slope (weight ratio) is slightly higher, you get the first optimum, if the slope is slightly lower you get the second optimum. There are no solutions in between.

I believe that a sufficient and necessary condition, for the existence of bifurcation, is that the Pareto front has an inflection point, i.e. there is at least one J1 for which f''(J1) = 0.

In human and animal movement, such discontinuities are well known. For example, the transition between walking and running.

Ton van den Bogert

User avatar
Ross Miller
Posts: 372
Joined: Tue Sep 22, 2009 2:02 pm

Re: Sudden postural change happened while tuning objective function weighting

Post by Ross Miller » Wed Apr 06, 2022 6:59 am

I agree with Ton (if I understood his comment correctly) that this is not necessarily a problem, it could actually mean the model/setup is realistic.

I notice when I'm doing barbell squats, with a light weight I can keep my trunk upright and this feels like the most comfortable/easiest way of doing the lift. With a heavy weight, I have to lean my trunk forward fairly far to complete the lift. With intermediate weights I don't gradually transition between these techniques. Rather, at a particular weight I abruptly start needing to use the trunk-lean technique.

Ross

User avatar
Simon Jeng
Posts: 87
Joined: Fri Sep 07, 2018 8:26 pm

Re: Sudden postural change happened while tuning objective function weighting

Post by Simon Jeng » Wed Apr 06, 2022 11:04 pm

Thank you Ton and Ross :D .

I understand that this is not a problem of my model/setup, then I just want to explore why the discontinuities exist in posture prediction.

According to the advice of Ton, I drew the resulting J1 and J2 in Figure(a). Also, I plotted some representative lines of w1*J1+w2*J2=C, where the Pareto front touches the straight line with the smallest C. Line #1 and #4 are the objective funtions in which only a single cost is minimized. Line #2 and #3 correspond to the weightings where the discontinuities happened. I drew the pareto front including two determined parts and a part that I guess.

Ton: I tried to graphically understand what you mean by the bifurcations:
The line #2 touches the part 1, but when the slope of the line reduces a little, it will touch the part 2. The line would not touch the Pareto front between the two parts. No solution would exist in between. So, part 1 and 2 are the two bifurcations. Right? :?:

I also test some weighting sets between (w1, w2) = (3,7) and (4,6). However, the solutions are in unexpected locations (in the dashed purple oval) where the line could not tangent to the pareto front. Are they suboptimal solutions or local optimum?

Simon
Attachments
PF.png
PF.png (37.3 KiB) Viewed 1433 times

User avatar
Chonghui Zhang
Posts: 10
Joined: Wed May 19, 2021 1:58 am

Re: Sudden postural change happened while tuning objective function weighting

Post by Chonghui Zhang » Fri Apr 08, 2022 2:08 am

Hi Simon,

An interesting research! I want to ask a question that how did you get the cost function value when its weighting was zero? When I use Moco, the output cost function value is zero when its weighting is zero.

Chonghui

User avatar
Simon Jeng
Posts: 87
Joined: Fri Sep 07, 2018 8:26 pm

Re: Sudden postural change happened while tuning objective function weighting

Post by Simon Jeng » Sat Apr 09, 2022 7:48 am

Hi Chonghui,

I set the solution as an initial guess of a new MocoStudy, and set the maximum numbers of iteration to be zero. The code is following:

Code: Select all

solver.set_optim_max_iterations(0);
This method was proposed by Nick in a previous thread but I cannot find it out. It outputs the objective function values according to the input states, which seems like an inverse optimization.

Simon

User avatar
Chonghui Zhang
Posts: 10
Joined: Wed May 19, 2021 1:58 am

Re: Sudden postural change happened while tuning objective function weighting

Post by Chonghui Zhang » Sun Apr 10, 2022 6:07 pm

Hi Simon,

Thanks! I have done it.

Wish your question would be answered soon.

Changhui

User avatar
Simon Jeng
Posts: 87
Joined: Fri Sep 07, 2018 8:26 pm

Re: Sudden postural change happened while tuning objective function weighting

Post by Simon Jeng » Wed Apr 13, 2022 1:56 am

Hi all,

For multi-objective optimization, can we observe the whole Pareto front in Moco?

I wanna graphically explain the reason why J1 and J2 could not predict a continuous postural change during w1 and w2 vary. My thought is to show all the Pareto optimum solutions and objective function lines (w1*J1+w2*J2=C) with the smallest C.

In my knowledge, the predicted solution is the tangent point (e.g. the point #1 and #2 in the figure) between the Pareto front and the line w1*J1+w2*J2=C with the smallest C. But there are some non-dominated solution points that the tangent line with the smallest C can't reach (e.g. point #3). I think that the points like point #3 cannot be predicted by MocoStudy so we cannot observe a complete Pareto front (if I understand correctly). Is there another way to observe this?

Thanks,
Simon
Attachments
PF.png
PF.png (21.15 KiB) Viewed 1175 times

POST REPLY