simopt.solvers.utils ==================== .. py:module:: simopt.solvers.utils .. autoapi-nested-parse:: Utility functions for optimization solvers. Module Contents --------------- .. py:function:: finite_diff(solver: simopt.base.Solver, new_solution: simopt.base.Solution, bounds_check: numpy.ndarray, problem: simopt.base.Problem, stepsize: float, r: int) -> numpy.ndarray Compute the finite difference approximation of the gradient for a solution. :param solver: The solver instance used to create new solutions. :type solver: Solver :param new_solution: The current solution to perturb. :type new_solution: Solution :param bounds_check: Array indicating which perturbation method to use per dimension. :type bounds_check: np.ndarray :param problem: The problem instance providing bounds and function evaluations. :type problem: Problem :param stepsize: The step size used for finite difference calculations. :type stepsize: float :param r: The number of replications used for each function evaluation. :type r: int :returns: The approximated gradient of the function at the given solution. :rtype: np.ndarray .. py:function:: bfgs_hessian_approx(solver: simopt.base.Solver, new_solution: simopt.base.Solution, bounds_check: numpy.ndarray, problem: simopt.base.Problem, r: int) -> numpy.ndarray Approximate Hessian using BFGS. This method applies BFGS updates to build or refine a Hessian approximation. :param solver: The solver instance used to create new solutions. :type solver: Solver :param new_solution: The solution at which derivatives are computed. :type new_solution: Solution :param bounds_check: Boolean mask indicating which variables are within bounds and eligible for perturbation. :type bounds_check: np.ndarray :param problem: The simulation-optimization problem being solved. :type problem: Problem :param r: Number of replications used when estimating gradients. :type r: int :returns: Hessian approximation (updated via BFGS). :rtype: np.ndarray