newton.ik.IKOptimizerLM#
- class newton.ik.IKOptimizerLM(model, n_batch, objectives, *a, **kw)[source]#
Bases:
objectLevenberg-Marquardt optimizer for batched inverse kinematics.
The optimizer solves a batch of independent IK problems that share a single articulation model and objective list. Jacobians can be evaluated with
IKJacobianType.AUTODIFF,IKJacobianType.ANALYTIC, orIKJacobianType.MIXED.- Parameters:
model (Model) – Shared articulation model.
n_batch (int) – Number of evaluation rows solved in parallel. This is typically
n_problems * n_seedsafter any sampling expansion.objectives (Sequence[IKObjective]) – Ordered IK objectives applied to every batch row.
lambda_initial – Initial LM damping factor for each batch row.
jacobian_mode – Jacobian backend to use.
lambda_factor – Factor used to increase or decrease the damping term after each trial step.
lambda_min – Minimum allowed damping value.
lambda_max – Maximum allowed damping value.
rho_min – Minimum ratio of actual to predicted decrease required to accept a step.
problem_idx – Optional mapping from batch rows to base problem indices for per-problem objective data.
- __init__(model, n_batch, objectives, lambda_initial=0.1, jacobian_mode=IKJacobianType.AUTODIFF, lambda_factor=2.0, lambda_min=1e-5, lambda_max=1e10, rho_min=1e-3, *, problem_idx=None)#
- compute_costs(joint_q)#
Evaluate squared residual costs for a batch of joint configurations.
- Parameters:
joint_q (array(ndim=2, dtype=float32)) – Joint coordinates to evaluate, shape [n_batch, joint_coord_count].
- Returns:
Costs for each batch row, shape [n_batch].
- Return type:
array(ndim=1, dtype=float32)
- reset()#
Clear LM damping and accept/reject state before a new solve.
- step(joint_q_in, joint_q_out, iterations=10, step_size=1.0)#
Run several LM iterations on a batch of joint configurations.
- Parameters:
joint_q_in (array(ndim=2, dtype=float32)) – Input joint coordinates, shape [n_batch, joint_coord_count].
joint_q_out (array(ndim=2, dtype=float32)) – Output buffer for the optimized coordinates, shape [n_batch, joint_coord_count]. It may alias
joint_q_infor in-place updates.iterations (int) – Number of LM iterations to execute.
step_size (float) – Scalar applied to each computed update before integration.