sequince.steps.mutation.adaptive.de
===================================

.. py:module:: sequince.steps.mutation.adaptive.de

.. autoapi-nested-parse::

   Adapt a DE scale mixture only between outer SMC iterations.



Classes
-------

.. autoapisummary::

   sequince.steps.mutation.adaptive.de.AdaptDEScaleWeights


Module Contents
---------------

.. py:class:: AdaptDEScaleWeights(mutation, policy = None)

   Bases: :py:obj:`sequince.steps.mutation.adaptive.base.AdaptiveMutationStep`


   Replace immutable DE weights at the next outer iteration (eager only).

   :param mutation: DE mutation or a complete repeated block whose leaf uses a
                    DifferentialEvolutionKernel. Wrap the complete block so weights
                    stay fixed across all rounds. Place conditional execution outside.
   :type mutation: RedBlueMetropolisHastingsMutation or RepeatedMutationStep
   :param policy: Policy selecting weights from completed metrics. Defaults to
                  ESJDScaleWeightPolicy. The multiplier bank and unit-move probability
                  remain unchanged.
   :type policy: DEScaleWeightPolicy or None

   .. rubric:: Notes

   Compose as ``AdaptMutationSteps(AdaptDEScaleWeights(mutation), ...)`` to
   adapt both budgets and weights. Repeated calls at the same context
   iteration reuse frozen weights and consult the policy only once. The
   next weights are installed on entering the next iteration, never midway
   through a block. The wrapped kernel configuration is owned by this wrapper;
   do not share the mutation with another adapter or replace its kernel.

   Required DEScaleMetrics are configured once on the leaf, preserving user
   metrics. An existing de_scales metric must match the configured scale bank.

   Completed metrics gain a ``de_scale_adaptation`` entry containing
   ``weights`` used for this block and ``next_weights``. Checkpoints retain
   both decisions and nested child/policy state. Reconstruct the same bank,
   kernel parameters and policy configuration before loading a checkpoint.


   .. py:attribute:: policy


   .. py:property:: current_weights
      :type: tuple[float, ...] | None


      Weights frozen for the current or most recent outer iteration.


   .. py:property:: next_weights
      :type: tuple[float, ...] | None


      Weights proposed for the next outer iteration.


   .. py:method:: apply_with_n_steps(state, context, rng, *, n_steps)

      Run a complete block with a budget supplied by an outer adapter.



   .. py:method:: state_dict()

      Return frozen/pending decisions and nested child/policy state.



   .. py:method:: load_state_dict(state)

      Restore decisions without rerunning the policy.



