======================= Exchangeable components ======================= * :ref:`dev_guide_input` * **QualityAssurance component** * :ref:`dev_guide_estimation` * :ref:`dev_guide_search` * :ref:`dev_guide_output` .. image:: ../images/components/component_overview_qa.png :alt: QualityAssurance component overview .. _dev_guide_qa: QualityAssurance component ========================== The *QualityAssurance* component (or stage) is responsible for validating the circuits resulting from the approximation process against global quality constraints. Its main function is simply deciding whether or not an approximated circuit satisfies all quality constraints. The result can be used in the search process to recognize boundaries in the search space or eventually terminating the search. Functions ========= .. .. todo:: Add links to function documentations ``setup(gen_info: GeneralInformation): None`` --------------------------------------------- The ``setup`` method can be used to initialize this component by storing the ``GeneralInformation`` instance, parsing the global quality constraints from the configuration file and for creating files and directories that are needed for the validation process. The default implementation stores the ``GeneralInformation`` instance and creates a directory ``sqcc_files`` in the base directory, assuming that auxiliary circuits will be created for validation. ``validateCircuit(node: Node): Boolean`` ---------------------------------------- The ``validateCircuit`` method validates the circuit of a given ``Node`` against the global quality constraints and only outputs whether the validation was successful or not. To store the result and make it interpretable for the other components, the ``Circuit`` instance's ``validated`` attribute should be set to ``True`` and its ``valid`` attribute set to the result of the validation. Note that this method works with a ``Circuit`` instance, but gets a ``Node`` as parameter. This is because ``Node``\ s are the central interface for circuit representations and component interaction. A ``Node`` instance however stores a reference to its respective ``Circuit`` instance, which is accessible via ``node.circuit``. This attribute will always contain a ``Circuit`` instance if the ``Node`` was put through the approximation process beforehand. Since quality assurance techniques are generally very diverse and require a lot of setup and cleanup, this is typically the start of a toolchain or a series of helper function calls. Feel free to add as many more functions as you need to compute the result of the validation. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ :ref:`Back to the Developer Guide `