pyepo.func.utils ================ .. py:module:: pyepo.func.utils .. autoapi-nested-parse:: Utility function Attributes ---------- .. autoapisummary:: pyepo.func.utils._worker_model pyepo.func.utils._worker_model_key Classes ------- .. autoapisummary:: pyepo.func.utils.sumGammaDistribution Functions --------- .. autoapisummary:: pyepo.func.utils._solve_or_cache pyepo.func.utils._solve_in_pass pyepo.func.utils._solve_batch pyepo.func.utils._update_solution_pool pyepo.func.utils._cache_in_pass pyepo.func.utils._solveWithObj4Par pyepo.func.utils._check_sol Module Contents --------------- .. py:function:: _solve_or_cache(cp, module) A function to get optimization solution in the forward/backward pass .. py:function:: _solve_in_pass(cp, optmodel, processes, pool, solpool=None, solset=None) A function to solve optimization and update solution pool .. py:function:: _solve_batch(cp, optmodel, processes, pool) A function to solve optimization in the forward/backward pass .. py:function:: _update_solution_pool(sol, solpool, solset) Add new solutions to solution pool :param sol: new solutions :type sol: torch.tensor :param solpool: existing solution pool :type solpool: torch.tensor :param solset: hash set for deduplication :type solset: set :returns: updated solution pool :rtype: torch.tensor .. py:function:: _cache_in_pass(cp, optmodel, solpool) A function to use solution pool in the forward/backward pass .. py:data:: _worker_model :value: None .. py:data:: _worker_model_key :value: None .. py:function:: _solveWithObj4Par(cost, args, model_type) A function to solve function in parallel processors :param cost: cost of objective function :type cost: np.ndarray :param args: optModel args :type args: dict :param model_type: optModel class type :type model_type: ABCMeta :returns: optimal solution (list) and objective value (float) :rtype: tuple .. py:function:: _check_sol(c, w, z) A function to check solution is correct .. py:class:: sumGammaDistribution(kappa, n_iterations=10, seed=135) creates a generator of samples for the Sum-of-Gamma distribution .. py:attribute:: κ .. py:attribute:: n_iterations :value: 10 .. py:attribute:: rnd .. py:method:: sample(size)