Skip to content

Commit

Permalink
Added some basic info logging to ConstraintCollocator.
Browse files Browse the repository at this point in the history
  • Loading branch information
moorepants committed Sep 2, 2023
1 parent a1c1cd4 commit 0ab4356
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions opty/direct_collocation.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env python

from functools import wraps
import logging

import numpy as np
import sympy as sm
Expand Down Expand Up @@ -732,6 +733,7 @@ def _discretize_eom(self):
The column vector of the discretized equations of motion.
"""
logging.info('Discretizing the equations of motion.')
x = self.state_symbols
xd = self.state_derivative_symbols
u = self.input_trajectories
Expand Down Expand Up @@ -921,6 +923,7 @@ def _gen_multi_arg_con_func(self):
adjacent_start = 1
adjacent_stop = None

logging.info('Compiling the constraint function.')
f = ufuncify_matrix(args, self.discrete_eom,
const=constant_syms + (h_sym,),
tmp_dir=self.tmp_dir, parallel=self.parallel)
Expand Down Expand Up @@ -1261,11 +1264,13 @@ def _gen_multi_arg_con_jac_func(self):

# This creates a matrix with all of the symbolic partial derivatives
# necessary to compute the full Jacobian.
logging.info('Differentiating the constraint function.')
symbolic_partials = self.discrete_eom.jacobian(wrt)

# This generates a numerical function that evaluates the matrix of
# partial derivatives. This function returns the non-zero elements
# needed to build the sparse constraint Jacobian.
logging.info('Compiling the Jacobian function.')
eval_partials = ufuncify_matrix(args, symbolic_partials,
const=constant_syms + (h_sym,),
tmp_dir=self.tmp_dir,
Expand Down

0 comments on commit 0ab4356

Please sign in to comment.