class_docstr: Base class for NAS strategies.
  
  To explore a space with a strategy, use::
  
      strategy = MyStrategy()
      strategy(model_space, engine)
  
  The strategy has a :meth:`run` method, that defines the process of exploring a NAS space.
  
  Strategy is stateful. It might store information of the current :meth:`initialize` and :meth:`run` as member attributes.
  We do not allow :meth:`run` a strategy twice with same, or different model spaces.
  
  Subclass should override :meth:`_initialize` and :meth:`_run`,
  as well as :meth:`state_dict` and :meth:`load_state_dict` for checkpointing.
class_docstr_tok: ["Base","class","for","NAS","strategies",".","To","explore","a","space","with","a","strategy",",","use",":",":","strategy","=","MyStrategy","(",")","strategy","(","model_space",",","engine",")","The","strategy","has","a",":","meth",":","`","run","`","method",",","that","defines","the","process","of","exploring","a","NAS","space",".","Strategy","is","stateful",".","It","might","store","information","of","the","current",":","meth",":","`","initialize","`","and",":","meth",":","`","run","`","as","member","attributes",".","We","do","not","allow",":","meth",":","`","run","`","a","strategy","twice","with","same",",","or","different","model","spaces",".","Subclass","should","override",":","meth",":","`","_initialize","`","and",":","meth",":","`","_run","`",",","as","well","as",":","meth",":","`","state_dict","`","and",":","meth",":","`","load_state_dict","`","for","checkpointing","."]
docstr: Strategy should use :attr:`engine` to submit models, listen to metrics, and do budget / concurrency control.
  
  The engine is set by :meth:`set_engine`, either manually, or by a NAS experiment.
  
  The engine could be either a real engine, or a middleware that wraps a real engine.
  It doesn't make any difference because their interface are the same.
  
  See Also
  --------
  nni.nas.execution.ExecutionEngine
docstr_tok: ["Strategy","should","use",":","attr",":","`","engine","`","to","submit","models",",","listen","to","metrics",",","and","do","budget","\/","concurrency","control",".","The","engine","is","set","by",":","meth",":","`","set_engine","`",",","either","manually",",","or","by","a","NAS","experiment",".","The","engine","could","be","either","a","real","engine",",","or","a","middleware","that","wraps","a","real","engine",".","It","does","n't","make","any","difference","because","their","interface","are","the","same",".","See","Also","--","--","--","--","nni.nas.execution.ExecutionEngine"]
code: def engine(self) -> ExecutionEngine:
      """Strategy should use :attr:`engine` to submit models, listen to metrics, and do budget / concurrency control.
  
      The engine is set by :meth:`set_engine`, either manually, or by a NAS experiment.
  
      The engine could be either a real engine, or a middleware that wraps a real engine.
      It doesn't make any difference because their interface are the same.
  
      See Also
      --------
      nni.nas.execution.ExecutionEngine
      """
      if self._engine is None:
          raise RuntimeError("Strategy is not attached to an engine.")
      return self._engine
  
imports: from __future__ import annotations
  import logging
  import time
  from enum import Enum
  from typing import Iterator, cast
  from nni.nas.execution import ExecutionEngine
  from nni.nas.space import ExecutableModelSpace, ModelStatus
  from nni.typehint import TrialMetric
label_desc: Use image node_id 2 for calling the Strategy obj's underlying member method code with example usage: obj.engine() and returns: self