tutorials:optimize_model

Optimizing Model Parameters

In addition to control parameters, it is also possible to directly optimize some properties of the model itself. Examples of variables that can be optimized are:

  • The max_isometric_force of a muscle
  • Location offset or radius of contact geometry
  • Stiffness and damping of a CoordinateLimitForce

Properties can be set either directly, via an offset, or by multiplying them by a specific factor. Values can be defined via a special Properties section inside the OpenSimModel section:

OpenSimModel {
	model_file = data/Human0914.osim
	
	Properties {
		# increase left iliopsoas force by factor 2
		iliopsoas_l { max_isometric_force.factor = 2 }
		
		# optimize y position of contact geometry and reuse parameter for left side
		r_toe { location.offset { x = 0.02~0.01<-1,1> y = 0 z = 0 } } 
		l_toe { location.offset { x = r_toe.location.offset.x y = -0.005 z = 0 } }
				
		# optimize knee limit stiffness and damping and reuse parameters for left side
		KneeLimit_r { upper_stiffness = 1~0.01<0.1,5> damping = 0.1~0.01<0.01,1> } 
		KneeLimit_l { upper_stiffness = KneeLimit_r.upper_stiffness damping = KneeLimit_r.damping } 
	}
}