Discretization#
Constraints for temporal discretization in optimal control problems.
- class biosym.constraints.discretization.Constraint(model, settings, args)#
Bases:
BaseConstraintBase class for discretization constraints in the biosym package.
This class provides a template for implementing specific discretization constraints. It includes methods for evaluating the constraint function, computing the Jacobian, and retrieving information about the constraint.
- get_confun()#
Evaluate the dynamics constraint function.
- Parameters:
states_list – Dictionary containing the current states.
- Returns:
The dynamics constraint function.
- get_jacobian()#
Get the Jacobian of the dynamics constraint function.
- Parameters:
states_list – Dictionary containing the current states.
- Returns:
The Jacobian of the dynamics constraint function.
- get_n_constraints()#
Get the number of constraints defined by this dynamics constraint.
- Returns:
The number of constraints.
- get_nnz()#
Get the number of non-zero entries in the Jacobian of the dynamics constraint.
- Returns:
The number of non-zero entries.
- biosym.constraints.discretization.confun_at_node(states_list, next_states_list, globals_dict, settings, info, h)#
Evaluate the constraint function at a specific node.
- Parameters:
states_list – List containing the current states.
next_states_list – List containing the next states.
globals_dict – Dictionary containing global variables.
settings – Dictionary containing settings for the dynamics constraint.
info – Information about the constraint function.
- Returns:
The evaluated value of the constraint function at the node.
- biosym.constraints.discretization.confun_q(states_list, globals_dict, settings, info)#
Placeholder for the constraint function.
This function should be implemented in subclasses to evaluate the dynamics constraints.
- Parameters:
states_list – List containing the current states.
settings – Dictionary containing settings for the dynamics constraint.
info – Information about the constraint function.
- Returns:
The evaluated value of the constraint function.
- biosym.constraints.discretization.find_dependents(model)#
- biosym.constraints.discretization.jacobian_at_node(states_list, next_states_list, globals_dict, settings, info, h)#
Compute the Jacobian of the constraint function at a specific node.
- Parameters:
states_list – List containing the current states.
next_states_list – List containing the next states.
globals_dict – Dictionary containing global variables.
settings – Dictionary containing settings for the dynamics constraint.
info – Information about the constraint function.
- Returns:
The Jacobian of the constraint function at the node.
- biosym.constraints.discretization.jacobian_q(states_list, globals_dict, settings, info)#
Placeholder for the Jacobian of the constraint function.
This function should be implemented in subclasses to compute the Jacobian of the dynamics constraints.
- Parameters:
states_list – List containing the current states.
settings – Dictionary containing settings for the dynamics constraint.
info – Information about the constraint function.
- Returns:
The Jacobian of the constraint function.