code: def test_evolution(named_model_space, engine, crossover):
      # Failure rate is approximately 1/50 (2%) when distinct is not set.
      name, model_space = named_model_space
      strategy = RegularizedEvolution(
          population_size=10,
          sample_size=5,
          crossover=crossover,
          mutation_prob=0.3,
          dedup=False,
      )
      assert (
          repr(strategy)
          == f"RegularizedEvolution(population_size=10, sample_size=5, mutation_prob=0.3, crossover={crossover}, dedup=False)"
      )
      strategy(model_space, engine)
      if name != "constraint":
          assert next(strategy.list_models()).metric >= 0.7
      else:
          # constraint space is small.
          assert next(strategy.list_models()).metric == 1.0
  
      state_dict = strategy.state_dict()
      strategy2 = RegularizedEvolution(
          population_size=10,
          sample_size=5,
          crossover=crossover,
          mutation_prob=0.3,
          dedup=False,
      )
      strategy2.load_state_dict(state_dict)
  
      strategy2(model_space, engine)
      assert len(list(engine.list_models())) == engine.max_model_count
  
imports: from __future__ import annotations
  import pytest
  import nni
  from nni.mutable import *
  from nni.nas.evaluator import FunctionalEvaluator
  from nni.nas.execution import SequentialExecutionEngine
  from nni.nas.space import *
  from nni.nas.strategy import GridSearch, Random, RegularizedEvolution, PolicyBasedRL
  import torch
  from torch import nn
  from tianshou.policy import A2CPolicy
  from tianshou.data import to_torch
label_desc: Use image node_id 6 for calling a global function with example usage: test_evolution(named_model_space, engine, crossover) without return types