About property value optimization

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
Chonghui Zhang
Posts: 10
Joined: Wed May 19, 2021 1:58 am

About property value optimization

Post by Chonghui Zhang » Fri Dec 09, 2022 5:49 am

Hi all,

I would like to ask two questions about body mass optimization in Moco.

1. I wish to get the maximum weight of a barbell that a human model can lift. Is the following code correct?

Code: Select all

param = MocoParameter('barbell_mass', '/bodyset/barbell', 'mass', MocoBounds(1,500));
problem.addParameter(param)	
2. If maximizing the mass is a cost function, how to set its weighting coefficient when it is combined with other cost functions (e.g. MocoControlGoal)?

Thanks,
Chonghui

User avatar
Nicholas Bianco
Posts: 1044
Joined: Thu Oct 04, 2012 8:09 pm

Re: About property value optimization

Post by Nicholas Bianco » Mon Dec 12, 2022 1:27 pm

Hi Chonghui,

Your code looks correct.

Unfortunately, there's no way to directly maximize the value of a parameter in the model. If the Moco problem you're running solves quickly, it might be easiest to optimize the mass using a two-level optimization approach.

-Nick

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

Re: About property value optimization

Post by Chonghui Zhang » Tue Dec 13, 2022 11:13 pm

Hi Nick,

Thanks for your reply. But I'm not sure how to conduct a two-level optimization. Could you please give me some tips?

Thanks,
Chonghui

User avatar
Nicholas Bianco
Posts: 1044
Joined: Thu Oct 04, 2012 8:09 pm

Re: About property value optimization

Post by Nicholas Bianco » Wed Dec 14, 2022 7:57 am

Hi Chonghui,

The simplest way is to use one of Matlab's optimizers (i.e., fmincon) and when writing the objective function, run your Moco problem and return some value that indicates failure or success.

Here's a paper on using bi-level optimization for lifting: https://www.frontiersin.org/articles/10 ... 83633/full.

-Nick

POST REPLY