.. _py-flow/Solution: ********************************************************** flow/Solution ********************************************************** .. default-domain:: py .. py:currentmodule:: mod .. cpp:namespace:: mod .. class:: FlowSolutionRange A range of solutions for a flow model. .. attribute:: flow (Read-only) The flow model that produced these solutions. :type: Flow .. attribute:: size The number of solutions in the flow model. :type: int .. method:: __len__() :returns: the number of solutions in the flow model. :rtype: int .. method:: __iter__() :returns: an iterator for the contained solutions. .. method:: __getitem__(i) :param int i: the index into the range. :returns: the ``i`` th solution in the range. :rtype: :class:`FlowSolution` .. method:: list() List overall information about each solution. .. method:: print(printer=FlowPrinter(), data=None) Print solutions using the settings in the given printer and the structure information in the data object. :param FlowPrinter printer: the printer to use governing the appearance. :param DGPrintData data: the extra data to use encoding the structure of the graph. .. class:: FlowSolution A solution for a flow model. .. attribute:: flow (Read-only) The flow model that produced the solution. :type: Flow .. attribute:: id (Read-only) An ID for the solution which is unique among all solutions from the parent :class:`Flow` object. :type: int .. method:: eval(exp) :param FlowLinExp exp: the linear expression to be evaluated on the solution. :returns: the value of the given linear expression evaluated on the solution. :rtype: int or float .. method:: list() List overall information about the solution. .. method:: print(printer=FlowPrinter(), data=None) Print the solution using the settings in the given printer and the structure information in the data object. :param FlowPrinter printer: the printer to use governing the appearance. :param DGPrintData data: the extra data to use encoding the structure of the graph. :returns: the name of the PDF-files that will be compiled in post-processing for respectively the filtered and unfiltered depictions. If either is not requested by the given ``printer`` the corresponding entry is ``None``. :rtype: tuple[str, str] .. class:: FlowSolutionOld .. attribute:: id (Read-only) An id for the solution which is unique among all solutions from the parent :class:`Flow` object. :type: int .. attribute:: flow (Read-only) The flow model that produced this solution. :type: Flow .. method:: eval(exp) :param FlowLinExp exp: the linear expression to be evaluated on the solution. :returns: the value of the given linear expression evaluated on the solution. :rtype: float .. method:: print(printer=FlowPrinter(), data=None) Print the solution using the settings in the given printer and the structure information in the data object. :param FlowPrinter printer: the printer to use governing the appearance. :param DGPrintData data: the extra data to use encoding the structure of the graph. :returns: the name of the PDF-file that will be compiled in post-processing for the filtered graph. :rtype: str .. method:: haxListDerivations() List the solution in more human readable form. Don't expect this function to stay in this form. .. class:: FlowSolutionSet A class representing the set of solutions from a single model. .. attribute:: dgFlow (Read-only) The flow model that produced these solutions. :type: Flow .. method:: list() List overall information about each solution. .. attribute:: size The number of solutions in the flow model. :type: int .. method:: print(printer=FlowPrinter(), data=None) Print solutions using the settings in the given printer and the structure information in the data object. :param FlowPrinter printer: the printer to use governing the appearance. :param DGPrintData data: the extra data to use encoding the structure of the graph. Other ^^^^^ The solution set class additionally supports indexing to retrieve specific solutions and iteration over the range of solutions. E.g., the following iterates through each solution in the flow model ``flow``: .. code-block:: python for sol in flow.solutions: pass