diff --git a/.gitignore b/.gitignore index 7379b397db26c2c72f01871165fcfa1967eabd09..56a0e1ee8aaeb80525280e5d268dbe9143a05100 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,8 @@ PKG-INFO .idea **/.idea/workspace.xml **/.idea/tasks.xml + +# Examples output folders +/examples/scripts/sellar_problem +/examples/scripts/ssbj +/examples/scripts/tu_delft_wing_design \ No newline at end of file diff --git a/doc/KADMOS.html b/doc/KADMOS.html index eb1515300bcfed1c875b9b53b79416cbeb11e6db..818d9bf3cacc3c7777364fd3e8af90f32fd29eb0 100644 --- a/doc/KADMOS.html +++ b/doc/KADMOS.html @@ -106,10 +106,16 @@ <span class="gp">>>> </span><span class="n">add_contact</span><span class="p">(</span><span class="s1">'Maaike de Wit'</span><span class="p">,</span> <span class="s1">'M.D.deWit@student.tudelft.nl'</span><span class="p">,</span> <span class="s1">'mddewit'</span><span class="p">,</span> <span class="n">company</span><span class="o">=</span><span class="s1">'TU Delft'</span><span class="p">,</span> <span class="n">roles</span><span class="o">=</span><span class="n">roles</span><span class="p">)</span> </pre></div> </div> -<p>In case the contact uid already exists the old contact attributes are conserved and only new roles are added to -the roles already present for that contact. To change old contact information, this has to be adjusted in the -XML-file from which the old contact information is loaded.</p> -<p>To add (more) roles to the existing contact, it is recommended to use the method: add_contact_roles()</p> +<div class="admonition note"> +<p class="first admonition-title">Note</p> +<p class="last">In case the contact uid already exists the old contact attributes are conserved and only new roles +are added to the roles already present for that contact. To change old contact information, this has to be +adjusted in the XML-file from which the old contact information is loaded.</p> +</div> +<div class="admonition hint"> +<p class="first admonition-title">Hint</p> +<p class="last">To add (more) roles to the existing contact, it is recommended to use the method: add_contact_roles()</p> +</div> </dd></dl> <dl class="method"> @@ -137,15 +143,18 @@ XML-file from which the old contact information is loaded.</p> <li>‘customer’</li> </ul> <p>Adding an organizational role to an existing contact:</p> -<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">add_contact</span><span class="p">(</span><span class="s1">'mddewit'</span><span class="p">,</span> <span class="n">roles</span><span class="o">=</span><span class="s1">'integrator'</span><span class="p">)</span> +<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">graph</span><span class="o">.</span><span class="n">add_contact</span><span class="p">(</span><span class="s1">'mddewit'</span><span class="p">,</span> <span class="n">roles</span><span class="o">=</span><span class="s1">'integrator'</span><span class="p">)</span> </pre></div> </div> <p>Adding two (or more) organizational roles to an existing contact:</p> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">roles</span> <span class="o">=</span> <span class="p">[</span><span class="s1">'integrator'</span><span class="p">,</span> <span class="s1">'architect'</span><span class="p">]</span> -<span class="gp">>>> </span><span class="n">add_contact</span><span class="p">(</span><span class="s1">'mddewit'</span><span class="p">,</span> <span class="n">company</span><span class="o">=</span><span class="s1">'TU Delft'</span><span class="p">,</span> <span class="n">roles</span><span class="o">=</span><span class="n">roles</span><span class="p">)</span> +<span class="gp">>>> </span><span class="n">graph</span><span class="o">.</span><span class="n">add_contact</span><span class="p">(</span><span class="s1">'mddewit'</span><span class="p">,</span> <span class="n">company</span><span class="o">=</span><span class="s1">'TU Delft'</span><span class="p">,</span> <span class="n">roles</span><span class="o">=</span><span class="n">roles</span><span class="p">)</span> </pre></div> </div> -<p>This method only works for existing contacts. To add a contact use the method: add_contact()</p> +<div class="admonition hint"> +<p class="first admonition-title">Hint</p> +<p class="last">This method only works for existing contacts. To add a contact use the method: add_contact()</p> +</div> </dd></dl> <dl class="method"> @@ -185,13 +194,19 @@ XML-file from which the old contact information is loaded.</p> <li><strong>precision</strong> (<em>float</em>) – precision of the design competence, optional</li> <li><strong>fidelity_level</strong> (<em>int</em>) – the level of fidelity of the design competence, optional</li> <li><strong>run_time</strong> (<em>float</em>) – the run time of the design competence, optional</li> -<li><strong>verification</strong> (<em>str</em>) – verification method of the design competence, optional</li> +<li><strong>verification</strong> (<em>dict</em>) – verification method of the design competence, optional</li> </ul> </td> </tr> </tbody> </table> <p>At least one of the optional elements for the performance information has to be defined.</p> +<p>Adding performance info with a verification:</p> +<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">verification</span> <span class="o">=</span> <span class="p">{</span><span class="s1">'method'</span><span class="p">:</span> <span class="s1">'dummy_method'</span><span class="p">,</span> <span class="s1">'verifier'</span><span class="p">:</span> <span class="n">contact_uid</span><span class="p">,</span> <span class="s1">'result'</span><span class="p">:</span> <span class="s1">'dummy_result'</span><span class="p">,</span> +<span class="gp">>>> </span> <span class="s1">'date'</span><span class="p">:</span> <span class="n">dateTime</span><span class="p">,</span> <span class="s1">'version'</span><span class="p">:</span> <span class="n">dummy_version</span><span class="p">}</span> +<span class="gp">>>> </span><span class="n">graph</span><span class="o">.</span><span class="n">add_dc_performance_info</span><span class="p">(</span><span class="n">dc_uid</span><span class="p">,</span> <span class="n">verification</span><span class="o">=</span><span class="n">verification</span><span class="p">)</span> +</pre></div> +</div> </dd></dl> <dl class="method"> @@ -204,7 +219,7 @@ XML-file from which the old contact information is loaded.</p> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple"> <li><strong>dc_uid</strong> (<em>str</em>) – uid of the design competence</li> -<li><strong>single_or_multi_execution</strong> (<em>'single'</em><em> or </em><em>'multiple'</em>) – execution type</li> +<li><strong>single_or_multi_execution</strong> (<em>str</em>) – execution type. Choose from ‘single’ or ‘multiple’.</li> <li><strong>job_name</strong> (<em>str</em>) – job name of the design competence</li> <li><strong>remote_engineer</strong> (<em>str</em>) – contact uid of remote engineering of the design competence</li> <li><strong>notification_message</strong> (<em>str</em>) – message to notify remote_engineer</li> @@ -216,8 +231,9 @@ XML-file from which the old contact information is loaded.</p> </table> <p>Example use:</p> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">single_or_multi</span> <span class="o">=</span> <span class="s2">"single"</span> -<span class="gp">>>> </span><span class="n">job_name</span> <span class="o">=</span> <span class="s1">'job_</span><span class="si">{}</span><span class="s1">'</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">fpg</span><span class="o">.</span><span class="n">node</span><span class="p">[</span><span class="n">node</span><span class="p">][</span><span class="s1">'label'</span><span class="p">]</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="s1">' '</span><span class="p">,</span> <span class="s1">''</span><span class="p">))</span> -<span class="gp">>>> </span><span class="n">notification_message</span> <span class="o">=</span> <span class="s1">'Hi, could you please run this tool </span><span class="si">{}</span><span class="s1"> for me for my </span><span class="si">{}</span><span class="s1"> AGILE workflow '</span> <span class="s1">'execution. Thanks.'</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">fpg</span><span class="o">.</span><span class="n">node</span><span class="p">[</span><span class="n">node</span><span class="p">][</span><span class="s1">'label'</span><span class="p">]</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="s1">' '</span><span class="p">,</span> <span class="s1">''</span><span class="p">),</span> <span class="n">architecture</span><span class="p">)</span> +<span class="gp">>>> </span><span class="n">job_name</span> <span class="o">=</span> <span class="s1">'job_</span><span class="si">{}</span><span class="s1">'</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">fpg</span><span class="o">.</span><span class="n">nodes</span><span class="p">[</span><span class="n">node</span><span class="p">][</span><span class="s1">'label'</span><span class="p">]</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="s1">' '</span><span class="p">,</span> <span class="s1">''</span><span class="p">))</span> +<span class="gp">>>> </span><span class="n">notification_message</span> <span class="o">=</span> <span class="s1">'Hi, could you please run this tool </span><span class="si">{}</span><span class="s1"> for me for my </span><span class="si">{}</span><span class="s1"> AGILE workflow '</span> +<span class="gp">>>> </span> <span class="s1">'execution. Thanks.'</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">fpg</span><span class="o">.</span><span class="n">nodes</span><span class="p">[</span><span class="n">node</span><span class="p">][</span><span class="s1">'label'</span><span class="p">]</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="s1">' '</span><span class="p">,</span> <span class="s1">''</span><span class="p">),</span> <span class="n">architecture</span><span class="p">)</span> <span class="gp">>>> </span><span class="n">fpg</span><span class="o">.</span><span class="n">add_dc_remote_component_info</span><span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="n">single_or_multi</span><span class="p">,</span> <span class="n">job_name</span><span class="p">,</span> <span class="s1">'ivangent'</span><span class="p">,</span> <span class="n">notification_message</span><span class="p">,</span> <span class="gp">>>> </span> <span class="n">data_exchange_dict</span><span class="o">=</span><span class="p">{</span><span class="s1">'urlsite'</span><span class="p">:</span> <span class="s1">'some_url'</span><span class="p">,</span> <span class="gp">>>> </span> <span class="s1">'folder'</span><span class="p">:</span> <span class="s1">'some_folder'</span><span class="p">})</span> @@ -261,22 +277,24 @@ XML-file from which the old contact information is loaded.</p> <dt id="kadmos.graph.graph_kadmos.KadmosGraph.add_edge"> <code class="descname">add_edge</code><span class="sig-paren">(</span><em>u</em>, <em>v</em>, <em>attr_dict=None</em>, <em>**attr</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_kadmos.KadmosGraph.add_edge" title="Permalink to this definition">¶</a></dt> <dd><p>Add an edge between u and v.</p> -<p>The nodes u and v will be automatically added if they are not already in the graph.</p> -<p>Adding an existing edge results in an update of the edge data.</p> -<p>Edge attributes can be specified with keywords or by directly accessing the edge’s attribute dictionary. -See examples below.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple"> -<li><strong>v</strong> (<em>u</em><em>,</em>) – nodes</li> -<li><strong>attr</strong> (<em>Edge data</em><em> (or </em><em>labels</em><em> or </em><em>objects</em><em>) </em><em>can be assigned using keyword arguments.</em>) – keyword arguments, optional</li> +<li><strong>u</strong> (<em>can be</em><em>, </em><em>for example</em><em>, </em><em>strings</em><em> or </em><em>numbers. Nodes must be hashable</em><em> (</em><em>and not None</em><em>) </em><em>Python objects.</em>) – node</li> +<li><strong>v</strong> (<em>see u</em>) – node</li> +<li><strong>attr_dict</strong> (<em>str</em>) – keyword arguments</li> +<li><strong>attr</strong> (<em>str</em>) – edge data (or labels or objects) can be assigned using keyword arguments.</li> </ul> </td> </tr> </tbody> </table> +<p>The nodes u and v will be automatically added if they are not already in the graph.</p> +<p>Adding an existing edge results in an update of the edge data.</p> +<p>Edge attributes can be specified with keywords or by directly accessing the edge’s attribute dictionary. +See examples below.</p> <p>The following examples both add the edge e=(1,2) to graph G:</p> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">G</span> <span class="o">=</span> <span class="n">nx</span><span class="o">.</span><span class="n">Graph</span><span class="p">()</span> <span class="c1"># or DiGraph, MultiGraph, MultiDiGraph, etc</span> <span class="gp">>>> </span><span class="n">e</span> <span class="o">=</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">)</span> @@ -298,101 +316,6 @@ numerical value. Associate date to edge using keywords:</p> </div> </dd></dl> -<dl class="method"> -<dt id="kadmos.graph.graph_kadmos.KadmosGraph.add_edges_from"> -<code class="descname">add_edges_from</code><span class="sig-paren">(</span><em>ebunch_to_add</em>, <em>**attr</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_kadmos.KadmosGraph.add_edges_from" title="Permalink to this definition">¶</a></dt> -<dd><p>Add all the edges in ebunch_to_add.</p> -<dl class="docutils"> -<dt>ebunch_to_add <span class="classifier-delimiter">:</span> <span class="classifier">container of edges</span></dt> -<dd>Each edge given in the container will be added to the -graph. The edges must be given as 2-tuples (u, v) or -3-tuples (u, v, d) where d is a dictionary containing edge data.</dd> -<dt>attr <span class="classifier-delimiter">:</span> <span class="classifier">keyword arguments, optional</span></dt> -<dd>Edge data (or labels or objects) can be assigned using -keyword arguments.</dd> -</dl> -<p>add_edge : add a single edge -add_weighted_edges_from : convenient way to add weighted edges</p> -<p>Adding the same edge twice has no effect but any edge data -will be updated when each duplicate edge is added.</p> -<p>Edge attributes specified in an ebunch take precedence over -attributes specified via keyword arguments.</p> -<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">G</span> <span class="o">=</span> <span class="n">nx</span><span class="o">.</span><span class="n">Graph</span><span class="p">()</span> <span class="c1"># or DiGraph, MultiGraph, MultiDiGraph, etc</span> -<span class="gp">>>> </span><span class="n">G</span><span class="o">.</span><span class="n">add_edges_from</span><span class="p">([(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">)])</span> <span class="c1"># using a list of edge tuples</span> -<span class="gp">>>> </span><span class="n">e</span> <span class="o">=</span> <span class="nb">zip</span><span class="p">(</span><span class="nb">range</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">3</span><span class="p">),</span> <span class="nb">range</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">4</span><span class="p">))</span> -<span class="gp">>>> </span><span class="n">G</span><span class="o">.</span><span class="n">add_edges_from</span><span class="p">(</span><span class="n">e</span><span class="p">)</span> <span class="c1"># Add the path graph 0-1-2-3</span> -</pre></div> -</div> -<p>Associate data to edges</p> -<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">G</span><span class="o">.</span><span class="n">add_edges_from</span><span class="p">([(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">),</span> <span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">)],</span> <span class="n">weight</span><span class="o">=</span><span class="mi">3</span><span class="p">)</span> -<span class="gp">>>> </span><span class="n">G</span><span class="o">.</span><span class="n">add_edges_from</span><span class="p">([(</span><span class="mi">3</span><span class="p">,</span> <span class="mi">4</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">4</span><span class="p">)],</span> <span class="n">label</span><span class="o">=</span><span class="s1">'WN2898'</span><span class="p">)</span> -</pre></div> -</div> -</dd></dl> - -<dl class="method"> -<dt id="kadmos.graph.graph_kadmos.KadmosGraph.add_equation"> -<code class="descname">add_equation</code><span class="sig-paren">(</span><em>edge_or_node</em>, <em>equation</em>, <em>language='Python'</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_kadmos.KadmosGraph.add_equation" title="Permalink to this definition">¶</a></dt> -<dd><p>Method to add an equation to an output edge.</p> -<table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple"> -<li><strong>edge_or_node</strong> (<em>list</em><em>, </em><em>str</em>) – graph edge or node under consideration.</li> -<li><strong>equation</strong> (<em>str</em>) – equation to be added</li> -<li><strong>language</strong> (<em>str</em>) – equation language used for the equation</li> -</ul> -</td> -</tr> -</tbody> -</table> -</dd></dl> - -<dl class="method"> -<dt id="kadmos.graph.graph_kadmos.KadmosGraph.add_equation_label"> -<code class="descname">add_equation_label</code><span class="sig-paren">(</span><em>edge</em>, <em>labeling_method='node_label'</em>, <em>language='Python'</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_kadmos.KadmosGraph.add_equation_label" title="Permalink to this definition">¶</a></dt> -<dd><p>Method to add an equation label to a edge that can (safely) be used as reference in an equation.</p> -<table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> -<li><strong>edge</strong> (<em>str</em>) – graph edge under consideration</li> -<li><strong>labeling_method</strong> (<em>str</em>) – select method for automatic label string determination (node_id or node_label)</li> -<li><strong>language</strong> (<em>str</em>) – equation language used for the equation label</li> -</ul> -</td> -</tr> -<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">label</p> -</td> -</tr> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">str</p> -</td> -</tr> -</tbody> -</table> -</dd></dl> - -<dl class="method"> -<dt id="kadmos.graph.graph_kadmos.KadmosGraph.add_equation_labels"> -<code class="descname">add_equation_labels</code><span class="sig-paren">(</span><em>nodes</em>, <em>language='Python'</em>, <em>labeling_method='node_id'</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_kadmos.KadmosGraph.add_equation_labels" title="Permalink to this definition">¶</a></dt> -<dd><p>Method to add equation labels automatically to all input edges connected to the specified list of nodes</p> -<table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple"> -<li><strong>nodes</strong> (<em>list</em>) – list of nodes</li> -<li><strong>language</strong> (<em>str</em>) – equation language used for the equation label</li> -<li><strong>labeling_method</strong> (<em>str</em>) – select method for automatic label string determination (node_id or node_label)</li> -</ul> -</td> -</tr> -</tbody> -</table> -</dd></dl> - <dl class="method"> <dt id="kadmos.graph.graph_kadmos.KadmosGraph.add_instance"> <code class="descname">add_instance</code><span class="sig-paren">(</span><em>node</em>, <em>instance=None</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_kadmos.KadmosGraph.add_instance" title="Permalink to this definition">¶</a></dt> @@ -412,26 +335,6 @@ attributes specified via keyword arguments.</p> <p>In case the default is used the instance added is the highest current instance + 1.</p> </dd></dl> -<dl class="method"> -<dt id="kadmos.graph.graph_kadmos.KadmosGraph.add_mathematical_function"> -<code class="descname">add_mathematical_function</code><span class="sig-paren">(</span><em>input_nodes</em>, <em>function_node</em>, <em>output_nodes</em>, <em>function_type='regular'</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_kadmos.KadmosGraph.add_mathematical_function" title="Permalink to this definition">¶</a></dt> -<dd><p>Method to add mathematical function to graph</p> -<table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple"> -<li><strong>input_nodes</strong> (<em>str</em><em>, </em><em>list</em>) – input nodes of the mathematical function</li> -<li><strong>function_node</strong> (<em>str</em>) – function node of the mathematical function</li> -<li><strong>output_nodes</strong> (<em>str</em><em>, </em><em>list</em>) – output nodes of the mathematical function</li> -<li><strong>function_type</strong> (<em>'regular'</em><em> or </em><em>'consistency'</em>) – type of function, optional (default=’regular’)</li> -</ul> -</td> -</tr> -</tbody> -</table> -</dd></dl> - <dl class="method"> <dt id="kadmos.graph.graph_kadmos.KadmosGraph.add_node"> <code class="descname">add_node</code><span class="sig-paren">(</span><em>n</em>, <em>attr_dict=None</em>, <em>**attr</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_kadmos.KadmosGraph.add_node" title="Permalink to this definition">¶</a></dt> @@ -443,7 +346,7 @@ attributes specified via keyword arguments.</p> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple"> <li><strong>n</strong> (<em>A node can be any hashable Python object except None.</em>) – node</li> <li><strong>attr_dict</strong> (<em>dict</em>) – dictionary of attribute keyword arguments.</li> -<li><strong>attr</strong> (<em>Set</em><em> or </em><em>change node attributes using attr_dict.</em>) – keyword arguments, optional</li> +<li><strong>attr</strong> (<em>str</em><em>, </em><em>dict</em>) – Set or change node attributes using attr_dict.</li> </ul> </td> </tr> @@ -463,53 +366,17 @@ attributes specified via keyword arguments.</p> <span class="gp">>>> </span><span class="n">G</span><span class="o">.</span><span class="n">add_node</span><span class="p">(</span><span class="mi">3</span><span class="p">,</span> <span class="n">weight</span><span class="o">=</span><span class="mf">0.4</span><span class="p">,</span> <span class="n">UTM</span><span class="o">=</span><span class="p">(</span><span class="s1">'13S'</span><span class="p">,</span> <span class="mi">382871</span><span class="p">,</span> <span class="mi">3972649</span><span class="p">))</span> </pre></div> </div> -<p>Notes:</p> -<p>A hashable object is one that can be used as a key in a Python +<div class="admonition note"> +<p class="first admonition-title">Note</p> +<p class="last">A hashable object is one that can be used as a key in a Python dictionary. This includes strings, numbers, tuples of strings and numbers, etc.</p> -<p>On many platforms hashable items also include mutables such as +</div> +<div class="admonition note"> +<p class="first admonition-title">Note</p> +<p class="last">On many platforms hashable items also include mutables such as NetworkX Graphs, though one should be careful that the hash doesn’t change on mutables.</p> -</dd></dl> - -<dl class="method"> -<dt id="kadmos.graph.graph_kadmos.KadmosGraph.add_nodes_from"> -<code class="descname">add_nodes_from</code><span class="sig-paren">(</span><em>nodes_for_adding</em>, <em>**attr</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_kadmos.KadmosGraph.add_nodes_from" title="Permalink to this definition">¶</a></dt> -<dd><p>Add multiple nodes.</p> -<dl class="docutils"> -<dt>nodes_for_adding <span class="classifier-delimiter">:</span> <span class="classifier">iterable container</span></dt> -<dd>A container of nodes (list, dict, set, etc.). -OR -A container of (node, attribute dict) tuples. -Node attributes are updated using the attribute dict.</dd> -<dt>attr <span class="classifier-delimiter">:</span> <span class="classifier">keyword arguments, optional (default= no attributes)</span></dt> -<dd>Update attributes for all nodes in nodes. -Node attributes specified in nodes as a tuple take -precedence over attributes specified via keyword arguments.</dd> -</dl> -<p>add_node</p> -<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">G</span> <span class="o">=</span> <span class="n">nx</span><span class="o">.</span><span class="n">Graph</span><span class="p">()</span> <span class="c1"># or DiGraph, MultiGraph, MultiDiGraph, etc</span> -<span class="gp">>>> </span><span class="n">G</span><span class="o">.</span><span class="n">add_nodes_from</span><span class="p">(</span><span class="s1">'Hello'</span><span class="p">)</span> -<span class="gp">>>> </span><span class="n">K3</span> <span class="o">=</span> <span class="n">nx</span><span class="o">.</span><span class="n">Graph</span><span class="p">([(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">),</span> <span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="mi">0</span><span class="p">)])</span> -<span class="gp">>>> </span><span class="n">G</span><span class="o">.</span><span class="n">add_nodes_from</span><span class="p">(</span><span class="n">K3</span><span class="p">)</span> -<span class="gp">>>> </span><span class="nb">sorted</span><span class="p">(</span><span class="n">G</span><span class="o">.</span><span class="n">nodes</span><span class="p">(),</span> <span class="n">key</span><span class="o">=</span><span class="nb">str</span><span class="p">)</span> -<span class="go">[0, 1, 2, 'H', 'e', 'l', 'o']</span> -</pre></div> -</div> -<p>Use keywords to update specific node attributes for every node.</p> -<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">G</span><span class="o">.</span><span class="n">add_nodes_from</span><span class="p">([</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">],</span> <span class="n">size</span><span class="o">=</span><span class="mi">10</span><span class="p">)</span> -<span class="gp">>>> </span><span class="n">G</span><span class="o">.</span><span class="n">add_nodes_from</span><span class="p">([</span><span class="mi">3</span><span class="p">,</span> <span class="mi">4</span><span class="p">],</span> <span class="n">weight</span><span class="o">=</span><span class="mf">0.4</span><span class="p">)</span> -</pre></div> -</div> -<p>Use (node, attrdict) tuples to update attributes for specific nodes.</p> -<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">G</span><span class="o">.</span><span class="n">add_nodes_from</span><span class="p">([(</span><span class="mi">1</span><span class="p">,</span> <span class="nb">dict</span><span class="p">(</span><span class="n">size</span><span class="o">=</span><span class="mi">11</span><span class="p">)),</span> <span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="p">{</span><span class="s1">'color'</span><span class="p">:</span><span class="s1">'blue'</span><span class="p">})])</span> -<span class="gp">>>> </span><span class="n">G</span><span class="o">.</span><span class="n">nodes</span><span class="p">[</span><span class="mi">1</span><span class="p">][</span><span class="s1">'size'</span><span class="p">]</span> -<span class="go">11</span> -<span class="gp">>>> </span><span class="n">H</span> <span class="o">=</span> <span class="n">nx</span><span class="o">.</span><span class="n">Graph</span><span class="p">()</span> -<span class="gp">>>> </span><span class="n">H</span><span class="o">.</span><span class="n">add_nodes_from</span><span class="p">(</span><span class="n">G</span><span class="o">.</span><span class="n">nodes</span><span class="p">(</span><span class="n">data</span><span class="o">=</span><span class="kc">True</span><span class="p">))</span> -<span class="gp">>>> </span><span class="n">H</span><span class="o">.</span><span class="n">nodes</span><span class="p">[</span><span class="mi">1</span><span class="p">][</span><span class="s1">'size'</span><span class="p">]</span> -<span class="go">11</span> -</pre></div> </div> </dd></dl> @@ -517,22 +384,6 @@ precedence over attributes specified via keyword arguments.</dd> <dt id="kadmos.graph.graph_kadmos.KadmosGraph.add_objective_function_by_nodes"> <code class="descname">add_objective_function_by_nodes</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_kadmos.KadmosGraph.add_objective_function_by_nodes" title="Permalink to this definition">¶</a></dt> <dd><p>This function adds objective functions to the graph using lists of variable nodes.</p> -<p>Each list produces a separate objective function node in the graph. If the list if passed as a keyword argument, -the keyword is taken as the name of the objective function node. Otherwise, a standard name will be given to the -node. Each objective function node has one output variable, and takes the nodes given in the argument list as -input nodes.</p> -<p>If the provided nodes do not exist in the graph, a warning is given to the user on whether to continue the -addition of the objective function to the graph using valid nodes.</p> -<p>Example:</p> -<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">unnamed_function</span> <span class="o">=</span> <span class="nb">list</span><span class="p">(</span><span class="o">>></span><span class="nb">list</span> <span class="n">of</span> <span class="n">graph</span> <span class="n">nodes</span><span class="o"><<</span><span class="p">)</span> -<span class="gp">>>> </span><span class="n">named_obj_fcn</span> <span class="o">=</span> <span class="nb">list</span><span class="p">(</span><span class="o">>></span><span class="nb">list</span> <span class="n">of</span> <span class="n">graph</span> <span class="n">nodes</span><span class="o"><<</span><span class="p">)</span> -<span class="gp">>>> </span><span class="n">MyGraph</span><span class="o">.</span><span class="n">add_objective_function_by_nodes</span><span class="p">(</span><span class="n">unnamed_function</span><span class="p">,</span> <span class="n">My_obj_fcn_name</span> <span class="o">=</span> <span class="n">named_obj_fcn</span><span class="p">)</span> -</pre></div> -</div> -<p>The added objective function nodes can be queried by the attribute:</p> -<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">Graph</span><span class="o">.</span><span class="n">node</span><span class="p">[</span><span class="n">node</span><span class="p">][</span><span class="s2">"name"</span><span class="p">]</span> <span class="o">==</span> <span class="s2">"Objective"</span> -</pre></div> -</div> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> @@ -551,91 +402,44 @@ addition of the objective function to the graph using valid nodes.</p> </tr> </tbody> </table> -</dd></dl> - -<dl class="method"> -<dt id="kadmos.graph.graph_kadmos.KadmosGraph.add_weighted_edges_from"> -<code class="descname">add_weighted_edges_from</code><span class="sig-paren">(</span><em>ebunch_to_add</em>, <em>weight='weight'</em>, <em>**attr</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_kadmos.KadmosGraph.add_weighted_edges_from" title="Permalink to this definition">¶</a></dt> -<dd><p>Add weighted edges in <cite>ebunch_to_add</cite> with specified weight attr</p> -<dl class="docutils"> -<dt>ebunch_to_add <span class="classifier-delimiter">:</span> <span class="classifier">container of edges</span></dt> -<dd>Each edge given in the list or container will be added -to the graph. The edges must be given as 3-tuples (u, v, w) -where w is a number.</dd> -<dt>weight <span class="classifier-delimiter">:</span> <span class="classifier">string, optional (default= ‘weight’)</span></dt> -<dd>The attribute name for the edge weights to be added.</dd> -<dt>attr <span class="classifier-delimiter">:</span> <span class="classifier">keyword arguments, optional (default= no attributes)</span></dt> -<dd>Edge attributes to add/update for all edges.</dd> -</dl> -<p>add_edge : add a single edge -add_edges_from : add multiple edges</p> -<p>Adding the same edge twice for Graph/DiGraph simply updates -the edge data. For MultiGraph/MultiDiGraph, duplicate edges -are stored.</p> -<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">G</span> <span class="o">=</span> <span class="n">nx</span><span class="o">.</span><span class="n">Graph</span><span class="p">()</span> <span class="c1"># or DiGraph, MultiGraph, MultiDiGraph, etc</span> -<span class="gp">>>> </span><span class="n">G</span><span class="o">.</span><span class="n">add_weighted_edges_from</span><span class="p">([(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mf">3.0</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mf">7.5</span><span class="p">)])</span> +<p>Each list produces a separate objective function node in the graph. If the list if passed as a keyword argument, +the keyword is taken as the name of the objective function node. Otherwise, a standard name will be given to the +node. Each objective function node has one output variable, and takes the nodes given in the argument list as +input nodes.</p> +<p>If the provided nodes do not exist in the graph, a warning is given to the user on whether to continue the +addition of the objective function to the graph using valid nodes.</p> +<p>Example:</p> +<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">unnamed_function</span> <span class="o">=</span> <span class="nb">list</span><span class="p">(</span><span class="o">>></span><span class="nb">list</span> <span class="n">of</span> <span class="n">graph</span> <span class="n">nodes</span><span class="o"><<</span><span class="p">)</span> +<span class="gp">>>> </span><span class="n">named_obj_fcn</span> <span class="o">=</span> <span class="nb">list</span><span class="p">(</span><span class="o">>></span><span class="nb">list</span> <span class="n">of</span> <span class="n">graph</span> <span class="n">nodes</span><span class="o"><<</span><span class="p">)</span> +<span class="gp">>>> </span><span class="n">MyGraph</span><span class="o">.</span><span class="n">add_objective_function_by_nodes</span><span class="p">(</span><span class="n">unnamed_function</span><span class="p">,</span> <span class="n">My_obj_fcn_name</span> <span class="o">=</span> <span class="n">named_obj_fcn</span><span class="p">)</span> </pre></div> </div> -</dd></dl> - -<dl class="attribute"> -<dt id="kadmos.graph.graph_kadmos.KadmosGraph.adj"> -<code class="descname">adj</code><a class="headerlink" href="#kadmos.graph.graph_kadmos.KadmosGraph.adj" title="Permalink to this definition">¶</a></dt> -<dd><p>Graph adjacency object holding the neighbors of each node.</p> -<p>This object is a read-only dict-like structure with node keys -and neighbor-dict values. The neighbor-dict is keyed by neighbor -to the edge-data-dict. So <cite>G.adj[3][2][‘color’] = ‘blue’</cite> sets -the color of the edge <cite>(3, 2)</cite> to <cite>“blueâ€</cite>.</p> -<p>Iterating over G.adj behaves like a dict. Useful idioms include -<cite>for nbr, datadict in G.adj[n].items():</cite>.</p> -<p>The neighbor information is also provided by subscripting the graph. -So <cite>for nbr, foovalue in G[node].data(‘foo’, default=1):</cite> works.</p> -<p>For directed graphs, <cite>G.adj</cite> holds outgoing (successor) info.</p> -</dd></dl> - -<dl class="method"> -<dt id="kadmos.graph.graph_kadmos.KadmosGraph.adjacency"> -<code class="descname">adjacency</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_kadmos.KadmosGraph.adjacency" title="Permalink to this definition">¶</a></dt> -<dd><p>Return an iterator over (node, adjacency dict) tuples for all nodes.</p> -<p>For directed graphs, only outgoing neighbors/adjacencies are included.</p> -<dl class="docutils"> -<dt>adj_iter <span class="classifier-delimiter">:</span> <span class="classifier">iterator</span></dt> -<dd>An iterator over (node, adjacency dictionary) for all nodes in -the graph.</dd> -</dl> -<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">G</span> <span class="o">=</span> <span class="n">nx</span><span class="o">.</span><span class="n">path_graph</span><span class="p">(</span><span class="mi">4</span><span class="p">)</span> <span class="c1"># or DiGraph, MultiGraph, MultiDiGraph, etc</span> -<span class="gp">>>> </span><span class="p">[(</span><span class="n">n</span><span class="p">,</span> <span class="n">nbrdict</span><span class="p">)</span> <span class="k">for</span> <span class="n">n</span><span class="p">,</span> <span class="n">nbrdict</span> <span class="ow">in</span> <span class="n">G</span><span class="o">.</span><span class="n">adjacency</span><span class="p">()]</span> -<span class="go">[(0, {1: {}}), (1, {0: {}, 2: {}}), (2, {1: {}, 3: {}}), (3, {2: {}})]</span> +<p>The added objective function nodes can be queried by the attribute:</p> +<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">Graph</span><span class="o">.</span><span class="n">nodes</span><span class="p">[</span><span class="n">node</span><span class="p">][</span><span class="s2">"name"</span><span class="p">]</span> <span class="o">==</span> <span class="s2">"Objective"</span> </pre></div> </div> </dd></dl> -<dl class="attribute"> -<dt id="kadmos.graph.graph_kadmos.KadmosGraph.adjlist_inner_dict_factory"> -<code class="descname">adjlist_inner_dict_factory</code><a class="headerlink" href="#kadmos.graph.graph_kadmos.KadmosGraph.adjlist_inner_dict_factory" title="Permalink to this definition">¶</a></dt> -<dd><p>alias of <code class="xref py py-class docutils literal notranslate"><span class="pre">__builtin__.dict</span></code></p> -</dd></dl> - -<dl class="attribute"> -<dt id="kadmos.graph.graph_kadmos.KadmosGraph.adjlist_outer_dict_factory"> -<code class="descname">adjlist_outer_dict_factory</code><a class="headerlink" href="#kadmos.graph.graph_kadmos.KadmosGraph.adjlist_outer_dict_factory" title="Permalink to this definition">¶</a></dt> -<dd><p>alias of <code class="xref py py-class docutils literal notranslate"><span class="pre">__builtin__.dict</span></code></p> -</dd></dl> - <dl class="method"> <dt id="kadmos.graph.graph_kadmos.KadmosGraph.change_graph_class"> <code class="descname">change_graph_class</code><span class="sig-paren">(</span><em>graph_class</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_kadmos.KadmosGraph.change_graph_class" title="Permalink to this definition">¶</a></dt> <dd><p>Method to adjust the class of a graph.</p> +<table class="docutils field-list" frame="void" rules="none"> +<col class="field-name" /> +<col class="field-body" /> +<tbody valign="top"> +<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">newly classed graph.</td> +</tr> +<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">graph_class</td> +</tr> +</tbody> +</table> </dd></dl> <dl class="method"> <dt id="kadmos.graph.graph_kadmos.KadmosGraph.check"> <code class="descname">check</code><span class="sig-paren">(</span><em>raise_error=False</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_kadmos.KadmosGraph.check" title="Permalink to this definition">¶</a></dt> <dd><p>Method to check the graph for validity and completeness.</p> -<p>Several checks are performed. However the method does not guarantee the validity of the graph.</p> -<p>The checks are split into several categories and the methods _check_category_a, _check_category_b and -_check_category_c are used to determine the overall validity and completeness. These sub methods are generally -defined below and are then further refined in child classes.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> @@ -648,15 +452,19 @@ defined below and are then further refined in child classes.</p> </tr> </tbody> </table> +<div class="admonition note"> +<p class="first admonition-title">Note</p> +<p class="last">Several checks are performed. However the method does not guarantee the validity of the graph.</p> +</div> +<p>The checks are split into several categories and the methods _check_category_a, _check_category_b and +_check_category_c are used to determine the overall validity and completeness. These sub methods are generally +defined below and are then further refined in child classes.</p> </dd></dl> <dl class="method"> <dt id="kadmos.graph.graph_kadmos.KadmosGraph.check_cmdows_integrity"> <code class="descname">check_cmdows_integrity</code><span class="sig-paren">(</span><em>convention=True</em>, <em>mpg=None</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_kadmos.KadmosGraph.check_cmdows_integrity" title="Permalink to this definition">¶</a></dt> <dd><p>Method to check the integrity of the CMDOWS file that can be created with the save method.</p> -<p>The integrity check is graph specific and thus needs to be executed for every graph before saving as CMDOWS if -one wants to be sure that the CMDOWS file is integer. Due to its relative long runtime this check is however not -performed automatically when using the save method.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> @@ -675,13 +483,15 @@ performed automatically when using the save method.</p> </tr> </tbody> </table> +<p>The integrity check is graph specific and thus needs to be executed for every graph before saving as CMDOWS if +one wants to be sure that the CMDOWS file is integer. Due to its relative long runtime this check is however not +performed automatically when using the save method.</p> </dd></dl> <dl class="method"> <dt id="kadmos.graph.graph_kadmos.KadmosGraph.check_for_coupling"> <code class="descname">check_for_coupling</code><span class="sig-paren">(</span><em>function_order</em>, <em>only_feedback=False</em>, <em>raise_error_if_true=False</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_kadmos.KadmosGraph.check_for_coupling" title="Permalink to this definition">¶</a></dt> <dd><p>Function to check for the presence of coupling in a graph for a list of analyses in a given analysis order.</p> -<p>Note that only the functions in the function_order list are checked for feedback.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> @@ -701,85 +511,9 @@ performed automatically when using the save method.</p> </tr> </tbody> </table> -</dd></dl> - -<dl class="method"> -<dt id="kadmos.graph.graph_kadmos.KadmosGraph.clear"> -<code class="descname">clear</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_kadmos.KadmosGraph.clear" title="Permalink to this definition">¶</a></dt> -<dd><p>Remove all nodes and edges from the graph.</p> -<p>This also removes the name, and all graph, node, and edge attributes.</p> -<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">G</span> <span class="o">=</span> <span class="n">nx</span><span class="o">.</span><span class="n">path_graph</span><span class="p">(</span><span class="mi">4</span><span class="p">)</span> <span class="c1"># or DiGraph, MultiGraph, MultiDiGraph, etc</span> -<span class="gp">>>> </span><span class="n">G</span><span class="o">.</span><span class="n">clear</span><span class="p">()</span> -<span class="gp">>>> </span><span class="nb">list</span><span class="p">(</span><span class="n">G</span><span class="o">.</span><span class="n">nodes</span><span class="p">)</span> -<span class="go">[]</span> -<span class="gp">>>> </span><span class="nb">list</span><span class="p">(</span><span class="n">G</span><span class="o">.</span><span class="n">edges</span><span class="p">)</span> -<span class="go">[]</span> -</pre></div> -</div> -</dd></dl> - -<dl class="method"> -<dt id="kadmos.graph.graph_kadmos.KadmosGraph.copy"> -<code class="descname">copy</code><span class="sig-paren">(</span><em>as_view=False</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_kadmos.KadmosGraph.copy" title="Permalink to this definition">¶</a></dt> -<dd><p>Return a copy of the graph.</p> -<p>The copy method by default returns a shallow copy of the graph -and attributes. That is, if an attribute is a container, that -container is shared by the original an the copy. -Use Python’s <cite>copy.deepcopy</cite> for new containers.</p> -<p>If <cite>as_view</cite> is True then a view is returned instead of a copy.</p> -<p>All copies reproduce the graph structure, but data attributes -may be handled in different ways. There are four types of copies -of a graph that people might want.</p> -<p>Deepcopy – The default behavior is a “deepcopy†where the graph -structure as well as all data attributes and any objects they might -contain are copied. The entire graph object is new so that changes -in the copy do not affect the original object. (see Python’s -copy.deepcopy)</p> -<p>Data Reference (Shallow) – For a shallow copy the graph structure -is copied but the edge, node and graph attribute dicts are -references to those in the original graph. This saves -time and memory but could cause confusion if you change an attribute -in one graph and it changes the attribute in the other. -NetworkX does not provide this level of shallow copy.</p> -<p>Independent Shallow – This copy creates new independent attribute -dicts and then does a shallow copy of the attributes. That is, any -attributes that are containers are shared between the new graph -and the original. This is exactly what <cite>dict.copy()</cite> provides. -You can obtain this style copy using:</p> -<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">G</span> <span class="o">=</span> <span class="n">nx</span><span class="o">.</span><span class="n">path_graph</span><span class="p">(</span><span class="mi">5</span><span class="p">)</span> -<span class="gp">>>> </span><span class="n">H</span> <span class="o">=</span> <span class="n">G</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span> -<span class="gp">>>> </span><span class="n">H</span> <span class="o">=</span> <span class="n">G</span><span class="o">.</span><span class="n">copy</span><span class="p">(</span><span class="n">as_view</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span> -<span class="gp">>>> </span><span class="n">H</span> <span class="o">=</span> <span class="n">nx</span><span class="o">.</span><span class="n">Graph</span><span class="p">(</span><span class="n">G</span><span class="p">)</span> -<span class="gp">>>> </span><span class="n">H</span> <span class="o">=</span> <span class="n">G</span><span class="o">.</span><span class="n">fresh_copy</span><span class="p">()</span><span class="o">.</span><span class="vm">__class__</span><span class="p">(</span><span class="n">G</span><span class="p">)</span> -</pre></div> -</div> -<p>Fresh Data – For fresh data, the graph structure is copied while -new empty data attribute dicts are created. The resulting graph -is independent of the original and it has no edge, node or graph -attributes. Fresh copies are not enabled. Instead use:</p> -<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">H</span> <span class="o">=</span> <span class="n">G</span><span class="o">.</span><span class="n">fresh_copy</span><span class="p">()</span> -<span class="gp">>>> </span><span class="n">H</span><span class="o">.</span><span class="n">add_nodes_from</span><span class="p">(</span><span class="n">G</span><span class="p">)</span> -<span class="gp">>>> </span><span class="n">H</span><span class="o">.</span><span class="n">add_edges_from</span><span class="p">(</span><span class="n">G</span><span class="o">.</span><span class="n">edges</span><span class="p">)</span> -</pre></div> -</div> -<p>View – Inspired by dict-views, graph-views act like read-only -versions of the original graph, providing a copy of the original -structure without requiring any memory for copying the information.</p> -<p>See the Python copy module for more information on shallow -and deep copies, <a class="reference external" href="https://docs.python.org/2/library/copy.html">https://docs.python.org/2/library/copy.html</a>.</p> -<dl class="docutils"> -<dt>as_view <span class="classifier-delimiter">:</span> <span class="classifier">bool, optional (default=False)</span></dt> -<dd>If True, the returned graph-view provides a read-only view -of the original graph without actually copying any data.</dd> -</dl> -<dl class="docutils"> -<dt>G <span class="classifier-delimiter">:</span> <span class="classifier">Graph</span></dt> -<dd>A copy of the graph.</dd> -</dl> -<p>to_directed: return a directed copy of the graph.</p> -<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">G</span> <span class="o">=</span> <span class="n">nx</span><span class="o">.</span><span class="n">path_graph</span><span class="p">(</span><span class="mi">4</span><span class="p">)</span> <span class="c1"># or DiGraph, MultiGraph, MultiDiGraph, etc</span> -<span class="gp">>>> </span><span class="n">H</span> <span class="o">=</span> <span class="n">G</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span> -</pre></div> +<div class="admonition note"> +<p class="first admonition-title">Note</p> +<p class="last">only the functions in the function_order list are checked for feedback.</p> </div> </dd></dl> @@ -835,7 +569,7 @@ of the original graph without actually copying any data.</dd> <li><strong>node</strong> (<em>str</em>) – node to be copied</li> <li><strong>suffix</strong> (<em>str</em>) – suffix to be added to the node ID</li> <li><strong>label_extension</strong> (<em>str</em>) – extension for labels</li> -<li><strong>kwargs</strong> (<em>dict</em>) – keyword arguments will be added as node attributes</li> +<li><strong>kwargs</strong> (<em>dict</em><em>, </em><em>int</em>) – keyword arguments will be added as node attributes</li> </ul> </td> </tr> @@ -924,48 +658,10 @@ of the original graph without actually copying any data.</dd> </table> </dd></dl> -<dl class="attribute"> -<dt id="kadmos.graph.graph_kadmos.KadmosGraph.degree"> -<code class="descname">degree</code><a class="headerlink" href="#kadmos.graph.graph_kadmos.KadmosGraph.degree" title="Permalink to this definition">¶</a></dt> -<dd><p>A DegreeView for the Graph as G.degree or G.degree().</p> -<p>The node degree is the number of edges adjacent to the node. -The weighted node degree is the sum of the edge weights for -edges incident to that node.</p> -<p>This object provides an iterator for (node, degree) as well as -lookup for the degree for a single node.</p> -<dl class="docutils"> -<dt>nbunch <span class="classifier-delimiter">:</span> <span class="classifier">single node, container, or all nodes (default= all nodes)</span></dt> -<dd>The view will only report edges incident to these nodes.</dd> -<dt>weight <span class="classifier-delimiter">:</span> <span class="classifier">string or None, optional (default=None)</span></dt> -<dd>The name of an edge attribute that holds the numerical value used -as a weight. If None, then each edge has weight 1. -The degree is the sum of the edge weights adjacent to the node.</dd> -</dl> -<p>If a single node is requested -deg : int</p> -<blockquote> -<div>Degree of the node</div></blockquote> -<p>OR if multiple nodes are requested -nd_iter : iterator</p> -<blockquote> -<div>The iterator returns two-tuples of (node, degree).</div></blockquote> -<p>in_degree, out_degree</p> -<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">G</span> <span class="o">=</span> <span class="n">nx</span><span class="o">.</span><span class="n">DiGraph</span><span class="p">()</span> <span class="c1"># or MultiDiGraph</span> -<span class="gp">>>> </span><span class="n">nx</span><span class="o">.</span><span class="n">add_path</span><span class="p">(</span><span class="n">G</span><span class="p">,</span> <span class="p">[</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">])</span> -<span class="gp">>>> </span><span class="n">G</span><span class="o">.</span><span class="n">degree</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span> <span class="c1"># node 0 with degree 1</span> -<span class="go">1</span> -<span class="gp">>>> </span><span class="nb">list</span><span class="p">(</span><span class="n">G</span><span class="o">.</span><span class="n">degree</span><span class="p">([</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">]))</span> -<span class="go">[(0, 1), (1, 2), (2, 2)]</span> -</pre></div> -</div> -</dd></dl> - <dl class="method"> <dt id="kadmos.graph.graph_kadmos.KadmosGraph.disconnect_problematic_variables_from"> <code class="descname">disconnect_problematic_variables_from</code><span class="sig-paren">(</span><em>function</em>, <em>disconnect_collided_targets=True</em>, <em>disconnect_shared_sources=True</em>, <em>ignore_list=[]</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_kadmos.KadmosGraph.disconnect_problematic_variables_from" title="Permalink to this definition">¶</a></dt> <dd><p>Method to automatically disconnect certain problematic variables with respect to a given function.</p> -<p>If given as setting (disconnect_collided_targets=True) then the collided targets will be disconnected from this -function. Also, if given as setting (disconnect_shared_sources=True), shared sources are also disconnected.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> @@ -973,103 +669,15 @@ function. Also, if given as setting (disconnect_shared_sources=True), shared sou <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple"> <li><strong>function</strong> (<em>basestring</em>) – function around which problematic variables are disconnected</li> <li><strong>disconnect_collided_targets</strong> (<em>bool</em>) – setting to disconnect collided targets</li> -<li><strong>disconnect_shared_sources</strong> (<em>list</em>) – setting to disconnect shared sources</li> -<li><strong>disconnect_shared_sources</strong> – setting to ignore certain nodes</li> +<li><strong>disconnect_shared_sources</strong> (<em>bool</em>) – setting to disconnect shared sources</li> +<li><strong>ignore_list</strong> (<em>list</em>) – setting to ignore certain nodes</li> </ul> </td> </tr> </tbody> </table> -</dd></dl> - -<dl class="attribute"> -<dt id="kadmos.graph.graph_kadmos.KadmosGraph.edge_attr_dict_factory"> -<code class="descname">edge_attr_dict_factory</code><a class="headerlink" href="#kadmos.graph.graph_kadmos.KadmosGraph.edge_attr_dict_factory" title="Permalink to this definition">¶</a></dt> -<dd><p>alias of <code class="xref py py-class docutils literal notranslate"><span class="pre">__builtin__.dict</span></code></p> -</dd></dl> - -<dl class="method"> -<dt id="kadmos.graph.graph_kadmos.KadmosGraph.edge_subgraph"> -<code class="descname">edge_subgraph</code><span class="sig-paren">(</span><em>edges</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_kadmos.KadmosGraph.edge_subgraph" title="Permalink to this definition">¶</a></dt> -<dd><p>Returns the subgraph induced by the specified edges.</p> -<p>The induced subgraph contains each edge in <cite>edges</cite> and each -node incident to any one of those edges.</p> -<dl class="docutils"> -<dt>edges <span class="classifier-delimiter">:</span> <span class="classifier">iterable</span></dt> -<dd>An iterable of edges in this graph.</dd> -</dl> -<dl class="docutils"> -<dt>G <span class="classifier-delimiter">:</span> <span class="classifier">Graph</span></dt> -<dd>An edge-induced subgraph of this graph with the same edge -attributes.</dd> -</dl> -<p>The graph, edge, and node attributes in the returned subgraph -view are references to the corresponding attributes in the original -graph. The view is read-only.</p> -<p>To create a full graph version of the subgraph with its own copy -of the edge or node attributes, use:</p> -<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">G</span><span class="o">.</span><span class="n">edge_subgraph</span><span class="p">(</span><span class="n">edges</span><span class="p">)</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span> -</pre></div> -</div> -<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">G</span> <span class="o">=</span> <span class="n">nx</span><span class="o">.</span><span class="n">path_graph</span><span class="p">(</span><span class="mi">5</span><span class="p">)</span> -<span class="gp">>>> </span><span class="n">H</span> <span class="o">=</span> <span class="n">G</span><span class="o">.</span><span class="n">edge_subgraph</span><span class="p">([(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="p">(</span><span class="mi">3</span><span class="p">,</span> <span class="mi">4</span><span class="p">)])</span> -<span class="gp">>>> </span><span class="nb">list</span><span class="p">(</span><span class="n">H</span><span class="o">.</span><span class="n">nodes</span><span class="p">)</span> -<span class="go">[0, 1, 3, 4]</span> -<span class="gp">>>> </span><span class="nb">list</span><span class="p">(</span><span class="n">H</span><span class="o">.</span><span class="n">edges</span><span class="p">)</span> -<span class="go">[(0, 1), (3, 4)]</span> -</pre></div> -</div> -</dd></dl> - -<dl class="attribute"> -<dt id="kadmos.graph.graph_kadmos.KadmosGraph.edges"> -<code class="descname">edges</code><a class="headerlink" href="#kadmos.graph.graph_kadmos.KadmosGraph.edges" title="Permalink to this definition">¶</a></dt> -<dd><p>An OutEdgeView of the DiGraph as G.edges or G.edges().</p> -<p>edges(self, nbunch=None, data=False, default=None)</p> -<p>The OutEdgeView provides set-like operations on the edge-tuples -as well as edge attribute lookup. When called, it also provides -an EdgeDataView object which allows control of access to edge -attributes (but does not provide set-like operations). -Hence, <cite>G.edges[u, v][‘color’]</cite> provides the value of the color -attribute for edge <cite>(u, v)</cite> while -<cite>for (u, v, c) in G.edges.data(‘color’, default=’red’):</cite> -iterates through all the edges yielding the color attribute -with default <cite>‘red’</cite> if no color attribute exists.</p> -<dl class="docutils"> -<dt>nbunch <span class="classifier-delimiter">:</span> <span class="classifier">single node, container, or all nodes (default= all nodes)</span></dt> -<dd>The view will only report edges incident to these nodes.</dd> -<dt>data <span class="classifier-delimiter">:</span> <span class="classifier">string or bool, optional (default=False)</span></dt> -<dd>The edge attribute returned in 3-tuple (u, v, ddict[data]). -If True, return edge attribute dict in 3-tuple (u, v, ddict). -If False, return 2-tuple (u, v).</dd> -<dt>default <span class="classifier-delimiter">:</span> <span class="classifier">value, optional (default=None)</span></dt> -<dd>Value used for edges that dont have the requested attribute. -Only relevant if data is not True or False.</dd> -</dl> -<dl class="docutils"> -<dt>edges <span class="classifier-delimiter">:</span> <span class="classifier">OutEdgeView</span></dt> -<dd>A view of edge attributes, usually it iterates over (u, v) -or (u, v, d) tuples of edges, but can also be used for -attribute lookup as <cite>edges[u, v][‘foo’]</cite>.</dd> -</dl> -<p>in_edges, out_edges</p> -<p>Nodes in nbunch that are not in the graph will be (quietly) ignored. -For directed graphs this returns the out-edges.</p> -<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">G</span> <span class="o">=</span> <span class="n">nx</span><span class="o">.</span><span class="n">DiGraph</span><span class="p">()</span> <span class="c1"># or MultiDiGraph, etc</span> -<span class="gp">>>> </span><span class="n">nx</span><span class="o">.</span><span class="n">add_path</span><span class="p">(</span><span class="n">G</span><span class="p">,</span> <span class="p">[</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">])</span> -<span class="gp">>>> </span><span class="n">G</span><span class="o">.</span><span class="n">add_edge</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="n">weight</span><span class="o">=</span><span class="mi">5</span><span class="p">)</span> -<span class="gp">>>> </span><span class="p">[</span><span class="n">e</span> <span class="k">for</span> <span class="n">e</span> <span class="ow">in</span> <span class="n">G</span><span class="o">.</span><span class="n">edges</span><span class="p">]</span> -<span class="go">[(0, 1), (1, 2), (2, 3)]</span> -<span class="gp">>>> </span><span class="n">G</span><span class="o">.</span><span class="n">edges</span><span class="o">.</span><span class="n">data</span><span class="p">()</span> <span class="c1"># default data is {} (empty dict)</span> -<span class="go">OutEdgeDataView([(0, 1, {}), (1, 2, {}), (2, 3, {'weight': 5})])</span> -<span class="gp">>>> </span><span class="n">G</span><span class="o">.</span><span class="n">edges</span><span class="o">.</span><span class="n">data</span><span class="p">(</span><span class="s1">'weight'</span><span class="p">,</span> <span class="n">default</span><span class="o">=</span><span class="mi">1</span><span class="p">)</span> -<span class="go">OutEdgeDataView([(0, 1, 1), (1, 2, 1), (2, 3, 5)])</span> -<span class="gp">>>> </span><span class="n">G</span><span class="o">.</span><span class="n">edges</span><span class="p">([</span><span class="mi">0</span><span class="p">,</span> <span class="mi">2</span><span class="p">])</span> <span class="c1"># only edges incident to these nodes</span> -<span class="go">OutEdgeDataView([(0, 1), (2, 3)])</span> -<span class="gp">>>> </span><span class="n">G</span><span class="o">.</span><span class="n">edges</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span> <span class="c1"># only edges incident to a single node (use G.adj[0]?)</span> -<span class="go">OutEdgeDataView([(0, 1)])</span> -</pre></div> -</div> +<p>If given as setting (disconnect_collided_targets=True) then the collided targets will be disconnected from this +function. Also, if given as setting (disconnect_shared_sources=True), shared sources are also disconnected.</p> </dd></dl> <dl class="method"> @@ -1206,22 +814,12 @@ Just get all nodes of a graph in a list:</p> </div> <p>Get all nodes with any of the listed attribute values:</p> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">all_nodes</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">find_all_nodes</span><span class="p">(</span><span class="n">category</span><span class="o">=</span><span class="s1">'all'</span><span class="p">,</span> <span class="n">subcategory</span><span class="o">=</span><span class="s1">'all'</span><span class="p">,</span> -<span class="gp">>>> </span> <span class="n">attr_include</span><span class="o">=</span><span class="p">[[</span><span class="s1">'problem_role'</span><span class="p">,</span> <span class="p">[</span><span class="s1">'constraint'</span><span class="p">,</span> <span class="s1">'objective'</span><span class="p">]],</span> <span class="p">[</span><span class="s1">'instance'</span><span class="p">,</span> <span class="mi">1</span><span class="p">]])</span> +<span class="gp">>>> </span> <span class="n">attr_include</span><span class="o">=</span><span class="p">[[</span><span class="s1">'problem_role'</span><span class="p">,</span> <span class="p">[</span><span class="s1">'constraint'</span><span class="p">,</span> <span class="s1">'objective'</span><span class="p">]],</span> +<span class="gp">>>> </span> <span class="p">[</span><span class="s1">'instance'</span><span class="p">,</span> <span class="mi">1</span><span class="p">]])</span> </pre></div> </div> </dd></dl> -<dl class="method"> -<dt id="kadmos.graph.graph_kadmos.KadmosGraph.fresh_copy"> -<code class="descname">fresh_copy</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_kadmos.KadmosGraph.fresh_copy" title="Permalink to this definition">¶</a></dt> -<dd><p>Return a fresh copy graph with the same data structure.</p> -<p>A fresh copy has no nodes, edges or graph attributes. It is -the same data structure as the current graph. This method is -typically used to create an empty version of the graph.</p> -<p>If you subclass the base class you should overwrite this method -to return your class of graph.</p> -</dd></dl> - <dl class="method"> <dt id="kadmos.graph.graph_kadmos.KadmosGraph.get_adjacency_matrix"> <code class="descname">get_adjacency_matrix</code><span class="sig-paren">(</span><em>print_in_log=True</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_kadmos.KadmosGraph.get_adjacency_matrix" title="Permalink to this definition">¶</a></dt> @@ -1310,6 +908,16 @@ to return your class of graph.</p> <dt id="kadmos.graph.graph_kadmos.KadmosGraph.get_contracted_graph"> <code class="descname">get_contracted_graph</code><span class="sig-paren">(</span><em>contraction_level</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_kadmos.KadmosGraph.get_contracted_graph" title="Permalink to this definition">¶</a></dt> <dd><p>This function contracts the nodes of a graph to the provided contraction level.</p> +<table class="docutils field-list" frame="void" rules="none"> +<col class="field-name" /> +<col class="field-body" /> +<tbody valign="top"> +<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>contraction_level</strong> (<em>int</em>) – from 0 (highest level) to X (lowest level existing in XML schema)</td> +</tr> +<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">contracted_graph: graph with contracted nodes</td> +</tr> +</tbody> +</table> <p>The contraction level refers to the xpath-level, which represents the position of the descendant with respect to its predecessors. The example below represents a level 3 node, with “cpacs†being at level zero.</p> <p>/cpacs/aircraft/wings/wing</p> @@ -1317,36 +925,18 @@ to its predecessors. The example below represents a level 3 node, with “cpacs <p>—-aircraft</p> <p>——–wings</p> <p>————wing</p> -<p>All nodes above the contraction level are removed from the graph and replaced by a “variable group†node, which +<div class="admonition note"> +<p class="first admonition-title">Note</p> +<p class="last">All nodes above the contraction level are removed from the graph and replaced by a “variable group†node, which groups the removed nodes in a node at contraction level. This allows for a “de-cluttering†of the graph, with the graph connections still being represented.</p> -<table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>contraction_level</strong> (<em>int</em>) – from 0 (highest level) to X (lowest level existing in XML schema)</td> -</tr> -<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">contracted_graph: graph with contracted nodes</td> -</tr> -</tbody> -</table> -</dd></dl> - -<dl class="method"> -<dt id="kadmos.graph.graph_kadmos.KadmosGraph.get_direct_coupling_nodes"> -<code class="descname">get_direct_coupling_nodes</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_kadmos.KadmosGraph.get_direct_coupling_nodes" title="Permalink to this definition">¶</a></dt> -<dd><p>This method returns the direct couplings between two nodes in a graph.</p> -<p>This method is specifically written (and tested) with function nodes in mind. Direct coupling is defined as -coupling with between two nodes through a third node.</p> -<p>In this function, each combination between the provided arguments is tested for couplings (in pairs). First, -the two nodes in each pair are checked for common neighbors. If they do, the edges of the common neighbors are -iterated to determine whether the node-pair is connected to each other, or only the neighbor. The direction of -the coupling is also checked.</p> -<p>Example:</p> -<p>The connection:</p> -<p>F1 => N1 => F2</p> -<p>leads to:</p> -<p>[(F1, F2, N1)]</p> +</div> +</dd></dl> + +<dl class="method"> +<dt id="kadmos.graph.graph_kadmos.KadmosGraph.get_direct_coupling_nodes"> +<code class="descname">get_direct_coupling_nodes</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_kadmos.KadmosGraph.get_direct_coupling_nodes" title="Permalink to this definition">¶</a></dt> +<dd><p>This method returns the direct couplings between two nodes in a graph.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> @@ -1366,46 +956,17 @@ the coupling is also checked.</p> </tr> </tbody> </table> -</dd></dl> - -<dl class="method"> -<dt id="kadmos.graph.graph_kadmos.KadmosGraph.get_edge_data"> -<code class="descname">get_edge_data</code><span class="sig-paren">(</span><em>u</em>, <em>v</em>, <em>default=None</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_kadmos.KadmosGraph.get_edge_data" title="Permalink to this definition">¶</a></dt> -<dd><p>Return the attribute dictionary associated with edge (u, v).</p> -<p>This is identical to <cite>G[u][v]</cite> except the default is returned -instead of an exception is the edge doesn’t exist.</p> -<p>u, v : nodes -default: any Python object (default=None)</p> -<blockquote> -<div>Value to return if the edge (u, v) is not found.</div></blockquote> -<dl class="docutils"> -<dt>edge_dict <span class="classifier-delimiter">:</span> <span class="classifier">dictionary</span></dt> -<dd>The edge attribute dictionary.</dd> -</dl> -<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">G</span> <span class="o">=</span> <span class="n">nx</span><span class="o">.</span><span class="n">path_graph</span><span class="p">(</span><span class="mi">4</span><span class="p">)</span> <span class="c1"># or DiGraph, MultiGraph, MultiDiGraph, etc</span> -<span class="gp">>>> </span><span class="n">G</span><span class="p">[</span><span class="mi">0</span><span class="p">][</span><span class="mi">1</span><span class="p">]</span> -<span class="go">{}</span> -</pre></div> -</div> -<p>Warning: Assigning to <cite>G[u][v]</cite> is not permitted. -But it is safe to assign attributes <cite>G[u][v][‘foo’]</cite></p> -<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">G</span><span class="p">[</span><span class="mi">0</span><span class="p">][</span><span class="mi">1</span><span class="p">][</span><span class="s1">'weight'</span><span class="p">]</span> <span class="o">=</span> <span class="mi">7</span> -<span class="gp">>>> </span><span class="n">G</span><span class="p">[</span><span class="mi">0</span><span class="p">][</span><span class="mi">1</span><span class="p">][</span><span class="s1">'weight'</span><span class="p">]</span> -<span class="go">7</span> -<span class="gp">>>> </span><span class="n">G</span><span class="p">[</span><span class="mi">1</span><span class="p">][</span><span class="mi">0</span><span class="p">][</span><span class="s1">'weight'</span><span class="p">]</span> -<span class="go">7</span> -</pre></div> -</div> -<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">G</span> <span class="o">=</span> <span class="n">nx</span><span class="o">.</span><span class="n">path_graph</span><span class="p">(</span><span class="mi">4</span><span class="p">)</span> <span class="c1"># or DiGraph, MultiGraph, MultiDiGraph, etc</span> -<span class="gp">>>> </span><span class="n">G</span><span class="o">.</span><span class="n">get_edge_data</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span> <span class="c1"># default edge data is {}</span> -<span class="go">{}</span> -<span class="gp">>>> </span><span class="n">e</span> <span class="o">=</span> <span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span> -<span class="gp">>>> </span><span class="n">G</span><span class="o">.</span><span class="n">get_edge_data</span><span class="p">(</span><span class="o">*</span><span class="n">e</span><span class="p">)</span> <span class="c1"># tuple form</span> -<span class="go">{}</span> -<span class="gp">>>> </span><span class="n">G</span><span class="o">.</span><span class="n">get_edge_data</span><span class="p">(</span><span class="s1">'a'</span><span class="p">,</span> <span class="s1">'b'</span><span class="p">,</span> <span class="n">default</span><span class="o">=</span><span class="mi">0</span><span class="p">)</span> <span class="c1"># edge not in graph, return 0</span> -<span class="go">0</span> -</pre></div> -</div> +<p>This method is specifically written (and tested) with function nodes in mind. Direct coupling is defined as +coupling with between two nodes through a third node.</p> +<p>In this function, each combination between the provided arguments is tested for couplings (in pairs). First, +the two nodes in each pair are checked for common neighbors. If they do, the edges of the common neighbors are +iterated to determine whether the node-pair is connected to each other, or only the neighbor. The direction of +the coupling is also checked.</p> +<p>Example:</p> +<ul class="simple"> +<li>The connection: F1 => N1 => F2</li> +<li>Leads to: [(F1, F2, N1)]</li> +</ul> </dd></dl> <dl class="method"> @@ -1430,12 +991,6 @@ But it is safe to assign attributes <cite>G[u][v][‘foo’]</cite></p> <dt id="kadmos.graph.graph_kadmos.KadmosGraph.get_function_graph"> <code class="descname">get_function_graph</code><span class="sig-paren">(</span><em>keep_objective_variables=False</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_kadmos.KadmosGraph.get_function_graph" title="Permalink to this definition">¶</a></dt> <dd><p>Method for replacing variable nodes by function connections.</p> -<p>This function removes all variable nodes from the graph and replaces the variable connections of each function -with function connections, such that:</p> -<p>F(1) => N(1) => F(2) => N(2) => F(3)</p> -<p>becomes:</p> -<p>F(1) => F(2) => F(3)</p> -<p>Note: N(i) is a variable node, and F(i) a function node.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> @@ -1448,6 +1003,13 @@ with function connections, such that:</p> </tr> </tbody> </table> +<div class="admonition note"> +<p class="first admonition-title">Note</p> +<p>This function removes all variable nodes from the graph and replaces the variable connections of each function +with function connections, such that if N(i) is a variable node, and F(i) a function node:</p> +<p>F(1) => N(1) => F(2) => N(2) => F(3)</p> +<p class="last">becomes: F(1) => F(2) => F(3)</p> +</div> </dd></dl> <dl class="method"> @@ -1478,8 +1040,6 @@ with function connections, such that:</p> <dt id="kadmos.graph.graph_kadmos.KadmosGraph.get_graph_properties"> <code class="descname">get_graph_properties</code><span class="sig-paren">(</span><em>*args</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_kadmos.KadmosGraph.get_graph_properties" title="Permalink to this definition">¶</a></dt> <dd><p>This function retrieves the properties of a graph.</p> -<p>If no argument is given, the standard list of properties GRAPH_PROPERTIES is analyzed and their values are -returned in a dict. If arguments are given, only this list will be used as standard list of properties.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> @@ -1492,6 +1052,8 @@ returned in a dict. If arguments are given, only this list will be used as stand </tr> </tbody> </table> +<p>If no argument is given, the standard list of properties GRAPH_PROPERTIES is analyzed and their values are +returned in a dict. If arguments are given, only this list will be used as standard list of properties.</p> </dd></dl> <dl class="method"> @@ -1523,6 +1085,18 @@ returned in a dict. If arguments are given, only this list will be used as stand <dt id="kadmos.graph.graph_kadmos.KadmosGraph.get_node_subcategory"> <code class="descname">get_node_subcategory</code><span class="sig-paren">(</span><em>node</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_kadmos.KadmosGraph.get_node_subcategory" title="Permalink to this definition">¶</a></dt> <dd><p>Method to analyse a node and to update the subcategory attribute of the node.</p> +<table class="docutils field-list" frame="void" rules="none"> +<col class="field-name" /> +<col class="field-body" /> +<tbody valign="top"> +<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>node</strong> (<em>basestring</em>) – node in the graph</td> +</tr> +<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">subcategory of the node</td> +</tr> +<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body">basestring</td> +</tr> +</tbody> +</table> <p>The following table illustrates how the subcategory is determined based on the category, indegree and outdegree:</p> <table border="1" class="docutils"> <colgroup> @@ -1603,26 +1177,12 @@ collided shared circular coupling</td> </tr> </tbody> </table> -<table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>node</strong> (<em>basestring</em>) – node in the graph</td> -</tr> -<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">subcategory of the node</td> -</tr> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body">basestring</td> -</tr> -</tbody> -</table> </dd></dl> <dl class="method"> <dt id="kadmos.graph.graph_kadmos.KadmosGraph.get_nodes_based_on_strings"> <code class="descname">get_nodes_based_on_strings</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_kadmos.KadmosGraph.get_nodes_based_on_strings" title="Permalink to this definition">¶</a></dt> <dd><p>This function enables the user to search graph nodes for specific strings.</p> -<p>Each provided string will be searched for, and if multiple node are found for each string, the user will be able -to select the ones desired. The other matched nodes are disregarded.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> @@ -1638,6 +1198,8 @@ to select the ones desired. The other matched nodes are disregarded.</p> </tr> </tbody> </table> +<p>Each provided string will be searched for, and if multiple node are found for each string, the user will be able +to select the ones desired. The other matched nodes are disregarded.</p> </dd></dl> <dl class="method"> @@ -1690,7 +1252,7 @@ to select the ones desired. The other matched nodes are disregarded.</p> </tr> <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">number of couplings for the input node</td> </tr> -<tr class="field-odd field"><th class="field-name">Type:</th><td class="field-body">int</td> +<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body">int</td> </tr> </tbody> </table> @@ -1742,7 +1304,6 @@ to select the ones desired. The other matched nodes are disregarded.</p> <dt id="kadmos.graph.graph_kadmos.KadmosGraph.get_subgraph_by_function_nodes"> <code class="descname">get_subgraph_by_function_nodes</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_kadmos.KadmosGraph.get_subgraph_by_function_nodes" title="Permalink to this definition">¶</a></dt> <dd><p>This function retrieves a subgraph from the original graph only containing the argument nodes.</p> -<p>All arguments must be found in the graph.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> @@ -1758,25 +1319,38 @@ to select the ones desired. The other matched nodes are disregarded.</p> </tr> </tbody> </table> +<div class="admonition note"> +<p class="first admonition-title">Note</p> +<p class="last">All arguments must be found in the graph.</p> +</div> </dd></dl> <dl class="method"> <dt id="kadmos.graph.graph_kadmos.KadmosGraph.get_system_inputs"> <code class="descname">get_system_inputs</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_kadmos.KadmosGraph.get_system_inputs" title="Permalink to this definition">¶</a></dt> <dd><p>This method checks whether there are system inputs in the graph using the function nodes provided.</p> -<p>The function nodes should be provided in the args. If system inputs exist they are returned.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>args</strong> – function nodes</td> +<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> +<li><strong>args</strong> – function nodes</li> +<li><strong>kwargs</strong> – </li> +</ul> +</td> </tr> -<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">system input nodes dictionary</td> +<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">system input nodes dictionary</p> +</td> </tr> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body">dict</td> +<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">dict</p> +</td> </tr> </tbody> </table> +<div class="admonition note"> +<p class="first admonition-title">Note</p> +<p class="last">The function nodes should be provided in the args. If system inputs exist they are returned.</p> +</div> </dd></dl> <dl class="method"> @@ -1815,58 +1389,6 @@ to select the ones desired. The other matched nodes are disregarded.</p> </table> </dd></dl> -<dl class="method"> -<dt id="kadmos.graph.graph_kadmos.KadmosGraph.has_edge"> -<code class="descname">has_edge</code><span class="sig-paren">(</span><em>u</em>, <em>v</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_kadmos.KadmosGraph.has_edge" title="Permalink to this definition">¶</a></dt> -<dd><p>Return True if the edge (u, v) is in the graph.</p> -<p>This is the same as <cite>v in G[u]</cite> without KeyError exceptions.</p> -<dl class="docutils"> -<dt>u, v <span class="classifier-delimiter">:</span> <span class="classifier">nodes</span></dt> -<dd>Nodes can be, for example, strings or numbers. -Nodes must be hashable (and not None) Python objects.</dd> -</dl> -<dl class="docutils"> -<dt>edge_ind <span class="classifier-delimiter">:</span> <span class="classifier">bool</span></dt> -<dd>True if edge is in the graph, False otherwise.</dd> -</dl> -<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">G</span> <span class="o">=</span> <span class="n">nx</span><span class="o">.</span><span class="n">path_graph</span><span class="p">(</span><span class="mi">4</span><span class="p">)</span> <span class="c1"># or DiGraph, MultiGraph, MultiDiGraph, etc</span> -<span class="gp">>>> </span><span class="n">G</span><span class="o">.</span><span class="n">has_edge</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span> <span class="c1"># using two nodes</span> -<span class="go">True</span> -<span class="gp">>>> </span><span class="n">e</span> <span class="o">=</span> <span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span> -<span class="gp">>>> </span><span class="n">G</span><span class="o">.</span><span class="n">has_edge</span><span class="p">(</span><span class="o">*</span><span class="n">e</span><span class="p">)</span> <span class="c1"># e is a 2-tuple (u, v)</span> -<span class="go">True</span> -<span class="gp">>>> </span><span class="n">e</span> <span class="o">=</span> <span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="p">{</span><span class="s1">'weight'</span><span class="p">:</span><span class="mi">7</span><span class="p">})</span> -<span class="gp">>>> </span><span class="n">G</span><span class="o">.</span><span class="n">has_edge</span><span class="p">(</span><span class="o">*</span><span class="n">e</span><span class="p">[:</span><span class="mi">2</span><span class="p">])</span> <span class="c1"># e is a 3-tuple (u, v, data_dictionary)</span> -<span class="go">True</span> -</pre></div> -</div> -<p>The following syntax are equivalent:</p> -<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">G</span><span class="o">.</span><span class="n">has_edge</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span> -<span class="go">True</span> -<span class="gp">>>> </span><span class="mi">1</span> <span class="ow">in</span> <span class="n">G</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="c1"># though this gives KeyError if 0 not in G</span> -<span class="go">True</span> -</pre></div> -</div> -</dd></dl> - -<dl class="method"> -<dt id="kadmos.graph.graph_kadmos.KadmosGraph.has_node"> -<code class="descname">has_node</code><span class="sig-paren">(</span><em>n</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_kadmos.KadmosGraph.has_node" title="Permalink to this definition">¶</a></dt> -<dd><p>Return True if the graph contains the node n.</p> -<p>Identical to <cite>n in G</cite></p> -<p>n : node</p> -<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">G</span> <span class="o">=</span> <span class="n">nx</span><span class="o">.</span><span class="n">path_graph</span><span class="p">(</span><span class="mi">3</span><span class="p">)</span> <span class="c1"># or DiGraph, MultiGraph, MultiDiGraph, etc</span> -<span class="gp">>>> </span><span class="n">G</span><span class="o">.</span><span class="n">has_node</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span> -<span class="go">True</span> -</pre></div> -</div> -<p>It is more readable and simpler to use</p> -<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="mi">0</span> <span class="ow">in</span> <span class="n">G</span> -<span class="go">True</span> -</pre></div> -</div> -</dd></dl> - <dl class="method"> <dt id="kadmos.graph.graph_kadmos.KadmosGraph.has_nodes"> <code class="descname">has_nodes</code><span class="sig-paren">(</span><em>nodes</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_kadmos.KadmosGraph.has_nodes" title="Permalink to this definition">¶</a></dt> @@ -1885,85 +1407,20 @@ Nodes must be hashable (and not None) Python objects.</dd> </table> </dd></dl> -<dl class="method"> -<dt id="kadmos.graph.graph_kadmos.KadmosGraph.has_predecessor"> -<code class="descname">has_predecessor</code><span class="sig-paren">(</span><em>u</em>, <em>v</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_kadmos.KadmosGraph.has_predecessor" title="Permalink to this definition">¶</a></dt> -<dd><p>Return True if node u has predecessor v.</p> -<p>This is true if graph has the edge u<-v.</p> -</dd></dl> - -<dl class="method"> -<dt id="kadmos.graph.graph_kadmos.KadmosGraph.has_successor"> -<code class="descname">has_successor</code><span class="sig-paren">(</span><em>u</em>, <em>v</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_kadmos.KadmosGraph.has_successor" title="Permalink to this definition">¶</a></dt> -<dd><p>Return True if node u has successor v.</p> -<p>This is true if graph has the edge u->v.</p> -</dd></dl> - -<dl class="attribute"> -<dt id="kadmos.graph.graph_kadmos.KadmosGraph.in_degree"> -<code class="descname">in_degree</code><a class="headerlink" href="#kadmos.graph.graph_kadmos.KadmosGraph.in_degree" title="Permalink to this definition">¶</a></dt> -<dd><p>An InDegreeView for (node, in_degree) or in_degree for single node.</p> -<p>The node in_degree is the number of edges pointing to the node. -The weighted node degree is the sum of the edge weights for -edges incident to that node.</p> -<p>This object provides an iteration over (node, in_degree) as well as -lookup for the degree for a single node.</p> -<dl class="docutils"> -<dt>nbunch <span class="classifier-delimiter">:</span> <span class="classifier">single node, container, or all nodes (default= all nodes)</span></dt> -<dd>The view will only report edges incident to these nodes.</dd> -<dt>weight <span class="classifier-delimiter">:</span> <span class="classifier">string or None, optional (default=None)</span></dt> -<dd>The name of an edge attribute that holds the numerical value used -as a weight. If None, then each edge has weight 1. -The degree is the sum of the edge weights adjacent to the node.</dd> -</dl> -<p>If a single node is requested -deg : int</p> -<blockquote> -<div>In-degree of the node</div></blockquote> -<p>OR if multiple nodes are requested -nd_iter : iterator</p> -<blockquote> -<div>The iterator returns two-tuples of (node, in-degree).</div></blockquote> -<p>degree, out_degree</p> -<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">G</span> <span class="o">=</span> <span class="n">nx</span><span class="o">.</span><span class="n">DiGraph</span><span class="p">()</span> -<span class="gp">>>> </span><span class="n">nx</span><span class="o">.</span><span class="n">add_path</span><span class="p">(</span><span class="n">G</span><span class="p">,</span> <span class="p">[</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">])</span> -<span class="gp">>>> </span><span class="n">G</span><span class="o">.</span><span class="n">in_degree</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span> <span class="c1"># node 0 with degree 0</span> -<span class="go">0</span> -<span class="gp">>>> </span><span class="nb">list</span><span class="p">(</span><span class="n">G</span><span class="o">.</span><span class="n">in_degree</span><span class="p">([</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">]))</span> -<span class="go">[(0, 0), (1, 1), (2, 1)]</span> -</pre></div> -</div> -</dd></dl> - -<dl class="attribute"> -<dt id="kadmos.graph.graph_kadmos.KadmosGraph.in_edges"> -<code class="descname">in_edges</code><a class="headerlink" href="#kadmos.graph.graph_kadmos.KadmosGraph.in_edges" title="Permalink to this definition">¶</a></dt> -<dd><p>An InEdgeView of the Graph as G.in_edges or G.in_edges().</p> -<p>in_edges(self, nbunch=None, data=False, default=None):</p> -<dl class="docutils"> -<dt>nbunch <span class="classifier-delimiter">:</span> <span class="classifier">single node, container, or all nodes (default= all nodes)</span></dt> -<dd>The view will only report edges incident to these nodes.</dd> -<dt>data <span class="classifier-delimiter">:</span> <span class="classifier">string or bool, optional (default=False)</span></dt> -<dd>The edge attribute returned in 3-tuple (u, v, ddict[data]). -If True, return edge attribute dict in 3-tuple (u, v, ddict). -If False, return 2-tuple (u, v).</dd> -<dt>default <span class="classifier-delimiter">:</span> <span class="classifier">value, optional (default=None)</span></dt> -<dd>Value used for edges that dont have the requested attribute. -Only relevant if data is not True or False.</dd> -</dl> -<dl class="docutils"> -<dt>in_edges <span class="classifier-delimiter">:</span> <span class="classifier">InEdgeView</span></dt> -<dd>A view of edge attributes, usually it iterates over (u, v) -or (u, v, d) tuples of edges, but can also be used for -attribute lookup as <cite>edges[u, v][‘foo’]</cite>.</dd> -</dl> -<p>edges</p> -</dd></dl> - <dl class="method"> <dt id="kadmos.graph.graph_kadmos.KadmosGraph.inspect"> <code class="descname">inspect</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_kadmos.KadmosGraph.inspect" title="Permalink to this definition">¶</a></dt> <dd><p>Method to print an overview of the graph.</p> +<table class="docutils field-list" frame="void" rules="none"> +<col class="field-name" /> +<col class="field-body" /> +<tbody valign="top"> +<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">printed overview of the graph</td> +</tr> +<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">str</td> +</tr> +</tbody> +</table> </dd></dl> <dl class="method"> @@ -1976,6 +1433,10 @@ attribute lookup as <cite>edges[u, v][‘foo’]</cite>.</dd> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>node</strong> (<em>str</em>) – node</td> </tr> +<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">printed node details</td> +</tr> +<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body">str</td> +</tr> </tbody> </table> </dd></dl> @@ -1990,22 +1451,14 @@ attribute lookup as <cite>edges[u, v][‘foo’]</cite>.</dd> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>list_of_nodes</strong> (<em>list</em>) – node list</td> </tr> +<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">printed details of nodes</td> +</tr> +<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body">str</td> +</tr> </tbody> </table> </dd></dl> -<dl class="method"> -<dt id="kadmos.graph.graph_kadmos.KadmosGraph.is_directed"> -<code class="descname">is_directed</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_kadmos.KadmosGraph.is_directed" title="Permalink to this definition">¶</a></dt> -<dd><p>Return True if graph is directed, False otherwise.</p> -</dd></dl> - -<dl class="method"> -<dt id="kadmos.graph.graph_kadmos.KadmosGraph.is_multigraph"> -<code class="descname">is_multigraph</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_kadmos.KadmosGraph.is_multigraph" title="Permalink to this definition">¶</a></dt> -<dd><p>Return True if graph is a multigraph, False otherwise.</p> -</dd></dl> - <dl class="method"> <dt id="kadmos.graph.graph_kadmos.KadmosGraph.load_cmdows"> <code class="descname">load_cmdows</code><span class="sig-paren">(</span><em>cmdows</em>, <em>check_list</em>, <em>ignore_modes=False</em>, <em>keep_running=False</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_kadmos.KadmosGraph.load_cmdows" title="Permalink to this definition">¶</a></dt> @@ -2030,12 +1483,15 @@ attribute lookup as <cite>edges[u, v][‘foo’]</cite>.</dd> </tr> </tbody> </table> -<p>Check_list options:</p> -<ul class="simple"> +<div class="admonition note"> +<p class="first admonition-title">Note</p> +<p>check_list options:</p> +<ul class="last simple"> <li>‘consistent_root’: check if all in-/output files have the same root element</li> <li>‘invalid_leaf_elements’: check for leaf elements that still have child elements in other in-/output files</li> <li>‘schemas’: check if the in-/output files are consistent with the schema.</li> </ul> +</div> <p>To perform all of the checks without stopping if an error is found by the checks:</p> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">check_list</span> <span class="o">=</span> <span class="p">[</span><span class="s1">'consistent_root'</span><span class="p">,</span> <span class="s1">'invalid_leaf_elements'</span><span class="p">,</span> <span class="s1">'schemas'</span><span class="p">]</span> <span class="gp">>>> </span><span class="n">graph</span><span class="o">.</span><span class="n">load_cmdows</span><span class="p">(</span><span class="n">cmdows</span><span class="p">,</span> <span class="n">check_list</span><span class="p">,</span> <span class="n">keep_running</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> @@ -2047,6 +1503,14 @@ attribute lookup as <cite>edges[u, v][‘foo’]</cite>.</dd> <dt id="kadmos.graph.graph_kadmos.KadmosGraph.make_all_variables_valid"> <code class="descname">make_all_variables_valid</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_kadmos.KadmosGraph.make_all_variables_valid" title="Permalink to this definition">¶</a></dt> <dd><p>Method to analyze all variables in a graph and make any problematic variables valid.</p> +<table class="docutils field-list" frame="void" rules="none"> +<col class="field-name" /> +<col class="field-body" /> +<tbody valign="top"> +<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">graph with problematic variables removed.</td> +</tr> +</tbody> +</table> <p>Problematic variable are holes and splittables. Splittable variables are split and holes will simply be removed.</p> </dd></dl> @@ -2078,8 +1542,6 @@ attribute lookup as <cite>edges[u, v][‘foo’]</cite>.</dd> <dt id="kadmos.graph.graph_kadmos.KadmosGraph.merge_function_nodes_based_on_modes"> <code class="descname">merge_function_nodes_based_on_modes</code><span class="sig-paren">(</span><em>merge_funcs=None</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_kadmos.KadmosGraph.merge_function_nodes_based_on_modes" title="Permalink to this definition">¶</a></dt> <dd><p>This class method merges all execution modes of the same function into a single node.</p> -<p>Mainly used for illustration purposes since information on the execution modes gets lost. Functions must be -present in graph.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> @@ -2090,6 +1552,8 @@ present in graph.</p> </tr> </tbody> </table> +<p>Mainly used for illustration purposes since information on the execution modes gets lost. Functions must be +present in graph.</p> </dd></dl> <dl class="method"> @@ -2100,12 +1564,18 @@ present in graph.</p> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple"> +<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> <li><strong>args</strong> (<em>node_ids</em>) – functions to be merged</li> <li><strong>kwargs</strong> (<em>dict</em>) – new_label to specify new node label manually (optional)</li> </ul> </td> </tr> +<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">graph with merged function</p> +</td> +</tr> +<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last"><a class="reference internal" href="#kadmos.graph.graph_kadmos.KadmosGraph" title="kadmos.graph.graph_kadmos.KadmosGraph">KadmosGraph</a></p> +</td> +</tr> </tbody> </table> </dd></dl> @@ -2118,12 +1588,18 @@ present in graph.</p> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple"> +<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> <li><strong>args</strong> (<em>node_ids</em>) – functions to be merged</li> <li><strong>kwargs</strong> (<em>dict</em>) – new_label to specify new node label manually (optional)</li> </ul> </td> </tr> +<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">graph with merged functions</p> +</td> +</tr> +<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last"><a class="reference internal" href="#kadmos.graph.graph_kadmos.KadmosGraph" title="kadmos.graph.graph_kadmos.KadmosGraph">KadmosGraph</a></p> +</td> +</tr> </tbody> </table> </dd></dl> @@ -2132,161 +1608,31 @@ present in graph.</p> <dt id="kadmos.graph.graph_kadmos.KadmosGraph.merge_sequential_functions"> <code class="descname">merge_sequential_functions</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_kadmos.KadmosGraph.merge_sequential_functions" title="Permalink to this definition">¶</a></dt> <dd><p>Function to merge a collection of functions.</p> -<p>It is assumed that the merged functions are actually executed in the sequence in which they are given to this -function.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple"> +<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> <li><strong>args</strong> (<em>node_ids</em>) – functions to be merged in the given sequence</li> <li><strong>kwargs</strong> (<em>str</em>) – new_label to specify new node label manually (optional)</li> </ul> </td> </tr> +<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">graph with merged functions</p> +</td> +</tr> +<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last"><a class="reference internal" href="#kadmos.graph.graph_kadmos.KadmosGraph" title="kadmos.graph.graph_kadmos.KadmosGraph">KadmosGraph</a></p> +</td> +</tr> </tbody> </table> -</dd></dl> - -<dl class="attribute"> -<dt id="kadmos.graph.graph_kadmos.KadmosGraph.name"> -<code class="descname">name</code><a class="headerlink" href="#kadmos.graph.graph_kadmos.KadmosGraph.name" title="Permalink to this definition">¶</a></dt> -<dd><p>String identifier of the graph.</p> -<p>This graph attribute appears in the attribute dict G.graph -keyed by the string <cite>“nameâ€</cite>. as well as an attribute (technically -a property) <cite>G.name</cite>. This is entirely user controlled.</p> -</dd></dl> - -<dl class="method"> -<dt id="kadmos.graph.graph_kadmos.KadmosGraph.nbunch_iter"> -<code class="descname">nbunch_iter</code><span class="sig-paren">(</span><em>nbunch=None</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_kadmos.KadmosGraph.nbunch_iter" title="Permalink to this definition">¶</a></dt> -<dd><p>Return an iterator over nodes contained in nbunch that are -also in the graph.</p> -<p>The nodes in nbunch are checked for membership in the graph -and if not are silently ignored.</p> -<dl class="docutils"> -<dt>nbunch <span class="classifier-delimiter">:</span> <span class="classifier">single node, container, or all nodes (default= all nodes)</span></dt> -<dd>The view will only report edges incident to these nodes.</dd> -</dl> -<dl class="docutils"> -<dt>niter <span class="classifier-delimiter">:</span> <span class="classifier">iterator</span></dt> -<dd>An iterator over nodes in nbunch that are also in the graph. -If nbunch is None, iterate over all nodes in the graph.</dd> -</dl> -<dl class="docutils"> -<dt>NetworkXError</dt> -<dd>If nbunch is not a node or or sequence of nodes. -If a node in nbunch is not hashable.</dd> -</dl> -<p>Graph.__iter__</p> -<p>When nbunch is an iterator, the returned iterator yields values -directly from nbunch, becoming exhausted when nbunch is exhausted.</p> -<p>To test whether nbunch is a single node, one can use -“if nbunch in self:â€, even after processing with this routine.</p> -<p>If nbunch is not a node or a (possibly empty) sequence/iterator -or None, a <code class="xref py py-exc docutils literal notranslate"><span class="pre">NetworkXError</span></code> is raised. Also, if any object in -nbunch is not hashable, a <code class="xref py py-exc docutils literal notranslate"><span class="pre">NetworkXError</span></code> is raised.</p> -</dd></dl> - -<dl class="method"> -<dt id="kadmos.graph.graph_kadmos.KadmosGraph.neighbors"> -<code class="descname">neighbors</code><span class="sig-paren">(</span><em>n</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_kadmos.KadmosGraph.neighbors" title="Permalink to this definition">¶</a></dt> -<dd><p>Return an iterator over successor nodes of n.</p> -<p>neighbors() and successors() are the same.</p> -</dd></dl> - -<dl class="attribute"> -<dt id="kadmos.graph.graph_kadmos.KadmosGraph.node"> -<code class="descname">node</code><a class="headerlink" href="#kadmos.graph.graph_kadmos.KadmosGraph.node" title="Permalink to this definition">¶</a></dt> -<dd><p>A NodeView of the Graph as G.nodes or G.nodes().</p> -<p>Can be used as <cite>G.nodes</cite> for data lookup and for set-like operations. -Can also be used as <cite>G.nodes(data=’color’, default=None)</cite> to return a -NodeDataView which reports specific node data but no set operations. -It presents a dict-like interface as well with <cite>G.nodes.items()</cite> -iterating over <cite>(node, nodedata)</cite> 2-tuples and <cite>G.nodes[3][‘foo’]</cite> -providing the value of the <cite>foo</cite> attribute for node <cite>3</cite>. In addition, -a view <cite>G.nodes.data(‘foo’)</cite> provides a dict-like interface to the -<cite>foo</cite> attribute of each node. <cite>G.nodes.data(‘foo’, default=1)</cite> -provides a default for nodes that do not have attribute <cite>foo</cite>.</p> -<dl class="docutils"> -<dt>data <span class="classifier-delimiter">:</span> <span class="classifier">string or bool, optional (default=False)</span></dt> -<dd>The node attribute returned in 2-tuple (n, ddict[data]). -If True, return entire node attribute dict as (n, ddict). -If False, return just the nodes n.</dd> -<dt>default <span class="classifier-delimiter">:</span> <span class="classifier">value, optional (default=None)</span></dt> -<dd>Value used for nodes that dont have the requested attribute. -Only relevant if data is not True or False.</dd> -</dl> -<dl class="docutils"> -<dt>NodeView</dt> -<dd><p class="first">Allows set-like operations over the nodes as well as node -attribute dict lookup and calling to get a NodeDataView. -A NodeDataView iterates over <cite>(n, data)</cite> and has no set operations. -A NodeView iterates over <cite>n</cite> and includes set operations.</p> -<p class="last">When called, if data is False, an iterator over nodes. -Otherwise an iterator of 2-tuples (node, attribute value) -where the attribute is specified in <cite>data</cite>. -If data is True then the attribute becomes the -entire data dictionary.</p> -</dd> -</dl> -<p>If your node data is not needed, it is simpler and equivalent -to use the expression <code class="docutils literal notranslate"><span class="pre">for</span> <span class="pre">n</span> <span class="pre">in</span> <span class="pre">G</span></code>, or <code class="docutils literal notranslate"><span class="pre">list(G)</span></code>.</p> -<p>There are two simple ways of getting a list of all nodes in the graph:</p> -<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">G</span> <span class="o">=</span> <span class="n">nx</span><span class="o">.</span><span class="n">path_graph</span><span class="p">(</span><span class="mi">3</span><span class="p">)</span> -<span class="gp">>>> </span><span class="nb">list</span><span class="p">(</span><span class="n">G</span><span class="o">.</span><span class="n">nodes</span><span class="p">)</span> -<span class="go">[0, 1, 2]</span> -<span class="gp">>>> </span><span class="nb">list</span><span class="p">(</span><span class="n">G</span><span class="p">)</span> -<span class="go">[0, 1, 2]</span> -</pre></div> -</div> -<p>To get the node data along with the nodes:</p> -<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">G</span><span class="o">.</span><span class="n">add_node</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="n">time</span><span class="o">=</span><span class="s1">'5pm'</span><span class="p">)</span> -<span class="gp">>>> </span><span class="n">G</span><span class="o">.</span><span class="n">nodes</span><span class="p">[</span><span class="mi">0</span><span class="p">][</span><span class="s1">'foo'</span><span class="p">]</span> <span class="o">=</span> <span class="s1">'bar'</span> -<span class="gp">>>> </span><span class="nb">list</span><span class="p">(</span><span class="n">G</span><span class="o">.</span><span class="n">nodes</span><span class="p">(</span><span class="n">data</span><span class="o">=</span><span class="kc">True</span><span class="p">))</span> -<span class="go">[(0, {'foo': 'bar'}), (1, {'time': '5pm'}), (2, {})]</span> -<span class="gp">>>> </span><span class="nb">list</span><span class="p">(</span><span class="n">G</span><span class="o">.</span><span class="n">nodes</span><span class="o">.</span><span class="n">data</span><span class="p">())</span> -<span class="go">[(0, {'foo': 'bar'}), (1, {'time': '5pm'}), (2, {})]</span> -</pre></div> -</div> -<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="nb">list</span><span class="p">(</span><span class="n">G</span><span class="o">.</span><span class="n">nodes</span><span class="p">(</span><span class="n">data</span><span class="o">=</span><span class="s1">'foo'</span><span class="p">))</span> -<span class="go">[(0, 'bar'), (1, None), (2, None)]</span> -<span class="gp">>>> </span><span class="nb">list</span><span class="p">(</span><span class="n">G</span><span class="o">.</span><span class="n">nodes</span><span class="o">.</span><span class="n">data</span><span class="p">(</span><span class="s1">'foo'</span><span class="p">))</span> -<span class="go">[(0, 'bar'), (1, None), (2, None)]</span> -</pre></div> -</div> -<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="nb">list</span><span class="p">(</span><span class="n">G</span><span class="o">.</span><span class="n">nodes</span><span class="p">(</span><span class="n">data</span><span class="o">=</span><span class="s1">'time'</span><span class="p">))</span> -<span class="go">[(0, None), (1, '5pm'), (2, None)]</span> -<span class="gp">>>> </span><span class="nb">list</span><span class="p">(</span><span class="n">G</span><span class="o">.</span><span class="n">nodes</span><span class="o">.</span><span class="n">data</span><span class="p">(</span><span class="s1">'time'</span><span class="p">))</span> -<span class="go">[(0, None), (1, '5pm'), (2, None)]</span> -</pre></div> -</div> -<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="nb">list</span><span class="p">(</span><span class="n">G</span><span class="o">.</span><span class="n">nodes</span><span class="p">(</span><span class="n">data</span><span class="o">=</span><span class="s1">'time'</span><span class="p">,</span> <span class="n">default</span><span class="o">=</span><span class="s1">'Not Available'</span><span class="p">))</span> -<span class="go">[(0, 'Not Available'), (1, '5pm'), (2, 'Not Available')]</span> -<span class="gp">>>> </span><span class="nb">list</span><span class="p">(</span><span class="n">G</span><span class="o">.</span><span class="n">nodes</span><span class="o">.</span><span class="n">data</span><span class="p">(</span><span class="s1">'time'</span><span class="p">,</span> <span class="n">default</span><span class="o">=</span><span class="s1">'Not Available'</span><span class="p">))</span> -<span class="go">[(0, 'Not Available'), (1, '5pm'), (2, 'Not Available')]</span> -</pre></div> -</div> -<p>If some of your nodes have an attribute and the rest are assumed -to have a default attribute value you can create a dictionary -from node/attribute pairs using the <cite>default</cite> keyword argument -to guarantee the value is never None:</p> -<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">G</span> <span class="o">=</span> <span class="n">nx</span><span class="o">.</span><span class="n">Graph</span><span class="p">()</span> -<span class="gp">>>> </span><span class="n">G</span><span class="o">.</span><span class="n">add_node</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span> -<span class="gp">>>> </span><span class="n">G</span><span class="o">.</span><span class="n">add_node</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="n">weight</span><span class="o">=</span><span class="mi">2</span><span class="p">)</span> -<span class="gp">>>> </span><span class="n">G</span><span class="o">.</span><span class="n">add_node</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="n">weight</span><span class="o">=</span><span class="mi">3</span><span class="p">)</span> -<span class="gp">>>> </span><span class="nb">dict</span><span class="p">(</span><span class="n">G</span><span class="o">.</span><span class="n">nodes</span><span class="p">(</span><span class="n">data</span><span class="o">=</span><span class="s1">'weight'</span><span class="p">,</span> <span class="n">default</span><span class="o">=</span><span class="mi">1</span><span class="p">))</span> -<span class="go">{0: 1, 1: 2, 2: 3}</span> -</pre></div> +<div class="admonition attention"> +<p class="first admonition-title">Attention</p> +<p class="last">It is assumed that the merged functions are actually executed in the sequence in which they are +given to this function.</p> </div> </dd></dl> -<dl class="attribute"> -<dt id="kadmos.graph.graph_kadmos.KadmosGraph.node_dict_factory"> -<code class="descname">node_dict_factory</code><a class="headerlink" href="#kadmos.graph.graph_kadmos.KadmosGraph.node_dict_factory" title="Permalink to this definition">¶</a></dt> -<dd><p>alias of <code class="xref py py-class docutils literal notranslate"><span class="pre">__builtin__.dict</span></code></p> -</dd></dl> - <dl class="method"> <dt id="kadmos.graph.graph_kadmos.KadmosGraph.node_is_function"> <code class="descname">node_is_function</code><span class="sig-paren">(</span><em>node</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_kadmos.KadmosGraph.node_is_function" title="Permalink to this definition">¶</a></dt> @@ -2327,17 +1673,6 @@ to guarantee the value is never None:</p> <dt id="kadmos.graph.graph_kadmos.KadmosGraph.node_is_objective_function"> <code class="descname">node_is_objective_function</code><span class="sig-paren">(</span><em>node</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_kadmos.KadmosGraph.node_is_objective_function" title="Permalink to this definition">¶</a></dt> <dd><p>This function checks whether the provided node is a objective function.</p> -<dl class="docutils"> -<dt>This function checks whether the provided node:</dt> -<dd><ol class="first last arabic simple"> -<li>exists in graph</li> -<li>has name-attribute “Objectiveâ€</li> -<li>has an out-degree of 1</li> -<li>has an outgoing node with an out-degree of zero # TODO: THIS IS WRONG!</li> -</ol> -</dd> -</dl> -<p>Only if all checks are satisfied, is the node a valid objective function node.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> @@ -2350,6 +1685,20 @@ to guarantee the value is never None:</p> </tr> </tbody> </table> +<dl class="docutils"> +<dt>This function checks whether the provided node:</dt> +<dd><ol class="first last arabic simple"> +<li>exists in graph</li> +<li>has name-attribute “Objectiveâ€</li> +<li>has an out-degree of 1</li> +<li>has an outgoing node with an out-degree of zero</li> +</ol> +</dd> +</dl> +<div class="admonition note"> +<p class="first admonition-title">Note</p> +<p class="last">Only if all checks are satisfied, is the node a valid objective function node.</p> +</div> </dd></dl> <dl class="method"> @@ -2388,247 +1737,6 @@ to guarantee the value is never None:</p> </table> </dd></dl> -<dl class="attribute"> -<dt id="kadmos.graph.graph_kadmos.KadmosGraph.nodes"> -<code class="descname">nodes</code><a class="headerlink" href="#kadmos.graph.graph_kadmos.KadmosGraph.nodes" title="Permalink to this definition">¶</a></dt> -<dd><p>A NodeView of the Graph as G.nodes or G.nodes().</p> -<p>Can be used as <cite>G.nodes</cite> for data lookup and for set-like operations. -Can also be used as <cite>G.nodes(data=’color’, default=None)</cite> to return a -NodeDataView which reports specific node data but no set operations. -It presents a dict-like interface as well with <cite>G.nodes.items()</cite> -iterating over <cite>(node, nodedata)</cite> 2-tuples and <cite>G.nodes[3][‘foo’]</cite> -providing the value of the <cite>foo</cite> attribute for node <cite>3</cite>. In addition, -a view <cite>G.nodes.data(‘foo’)</cite> provides a dict-like interface to the -<cite>foo</cite> attribute of each node. <cite>G.nodes.data(‘foo’, default=1)</cite> -provides a default for nodes that do not have attribute <cite>foo</cite>.</p> -<dl class="docutils"> -<dt>data <span class="classifier-delimiter">:</span> <span class="classifier">string or bool, optional (default=False)</span></dt> -<dd>The node attribute returned in 2-tuple (n, ddict[data]). -If True, return entire node attribute dict as (n, ddict). -If False, return just the nodes n.</dd> -<dt>default <span class="classifier-delimiter">:</span> <span class="classifier">value, optional (default=None)</span></dt> -<dd>Value used for nodes that dont have the requested attribute. -Only relevant if data is not True or False.</dd> -</dl> -<dl class="docutils"> -<dt>NodeView</dt> -<dd><p class="first">Allows set-like operations over the nodes as well as node -attribute dict lookup and calling to get a NodeDataView. -A NodeDataView iterates over <cite>(n, data)</cite> and has no set operations. -A NodeView iterates over <cite>n</cite> and includes set operations.</p> -<p class="last">When called, if data is False, an iterator over nodes. -Otherwise an iterator of 2-tuples (node, attribute value) -where the attribute is specified in <cite>data</cite>. -If data is True then the attribute becomes the -entire data dictionary.</p> -</dd> -</dl> -<p>If your node data is not needed, it is simpler and equivalent -to use the expression <code class="docutils literal notranslate"><span class="pre">for</span> <span class="pre">n</span> <span class="pre">in</span> <span class="pre">G</span></code>, or <code class="docutils literal notranslate"><span class="pre">list(G)</span></code>.</p> -<p>There are two simple ways of getting a list of all nodes in the graph:</p> -<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">G</span> <span class="o">=</span> <span class="n">nx</span><span class="o">.</span><span class="n">path_graph</span><span class="p">(</span><span class="mi">3</span><span class="p">)</span> -<span class="gp">>>> </span><span class="nb">list</span><span class="p">(</span><span class="n">G</span><span class="o">.</span><span class="n">nodes</span><span class="p">)</span> -<span class="go">[0, 1, 2]</span> -<span class="gp">>>> </span><span class="nb">list</span><span class="p">(</span><span class="n">G</span><span class="p">)</span> -<span class="go">[0, 1, 2]</span> -</pre></div> -</div> -<p>To get the node data along with the nodes:</p> -<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">G</span><span class="o">.</span><span class="n">add_node</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="n">time</span><span class="o">=</span><span class="s1">'5pm'</span><span class="p">)</span> -<span class="gp">>>> </span><span class="n">G</span><span class="o">.</span><span class="n">nodes</span><span class="p">[</span><span class="mi">0</span><span class="p">][</span><span class="s1">'foo'</span><span class="p">]</span> <span class="o">=</span> <span class="s1">'bar'</span> -<span class="gp">>>> </span><span class="nb">list</span><span class="p">(</span><span class="n">G</span><span class="o">.</span><span class="n">nodes</span><span class="p">(</span><span class="n">data</span><span class="o">=</span><span class="kc">True</span><span class="p">))</span> -<span class="go">[(0, {'foo': 'bar'}), (1, {'time': '5pm'}), (2, {})]</span> -<span class="gp">>>> </span><span class="nb">list</span><span class="p">(</span><span class="n">G</span><span class="o">.</span><span class="n">nodes</span><span class="o">.</span><span class="n">data</span><span class="p">())</span> -<span class="go">[(0, {'foo': 'bar'}), (1, {'time': '5pm'}), (2, {})]</span> -</pre></div> -</div> -<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="nb">list</span><span class="p">(</span><span class="n">G</span><span class="o">.</span><span class="n">nodes</span><span class="p">(</span><span class="n">data</span><span class="o">=</span><span class="s1">'foo'</span><span class="p">))</span> -<span class="go">[(0, 'bar'), (1, None), (2, None)]</span> -<span class="gp">>>> </span><span class="nb">list</span><span class="p">(</span><span class="n">G</span><span class="o">.</span><span class="n">nodes</span><span class="o">.</span><span class="n">data</span><span class="p">(</span><span class="s1">'foo'</span><span class="p">))</span> -<span class="go">[(0, 'bar'), (1, None), (2, None)]</span> -</pre></div> -</div> -<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="nb">list</span><span class="p">(</span><span class="n">G</span><span class="o">.</span><span class="n">nodes</span><span class="p">(</span><span class="n">data</span><span class="o">=</span><span class="s1">'time'</span><span class="p">))</span> -<span class="go">[(0, None), (1, '5pm'), (2, None)]</span> -<span class="gp">>>> </span><span class="nb">list</span><span class="p">(</span><span class="n">G</span><span class="o">.</span><span class="n">nodes</span><span class="o">.</span><span class="n">data</span><span class="p">(</span><span class="s1">'time'</span><span class="p">))</span> -<span class="go">[(0, None), (1, '5pm'), (2, None)]</span> -</pre></div> -</div> -<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="nb">list</span><span class="p">(</span><span class="n">G</span><span class="o">.</span><span class="n">nodes</span><span class="p">(</span><span class="n">data</span><span class="o">=</span><span class="s1">'time'</span><span class="p">,</span> <span class="n">default</span><span class="o">=</span><span class="s1">'Not Available'</span><span class="p">))</span> -<span class="go">[(0, 'Not Available'), (1, '5pm'), (2, 'Not Available')]</span> -<span class="gp">>>> </span><span class="nb">list</span><span class="p">(</span><span class="n">G</span><span class="o">.</span><span class="n">nodes</span><span class="o">.</span><span class="n">data</span><span class="p">(</span><span class="s1">'time'</span><span class="p">,</span> <span class="n">default</span><span class="o">=</span><span class="s1">'Not Available'</span><span class="p">))</span> -<span class="go">[(0, 'Not Available'), (1, '5pm'), (2, 'Not Available')]</span> -</pre></div> -</div> -<p>If some of your nodes have an attribute and the rest are assumed -to have a default attribute value you can create a dictionary -from node/attribute pairs using the <cite>default</cite> keyword argument -to guarantee the value is never None:</p> -<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">G</span> <span class="o">=</span> <span class="n">nx</span><span class="o">.</span><span class="n">Graph</span><span class="p">()</span> -<span class="gp">>>> </span><span class="n">G</span><span class="o">.</span><span class="n">add_node</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span> -<span class="gp">>>> </span><span class="n">G</span><span class="o">.</span><span class="n">add_node</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="n">weight</span><span class="o">=</span><span class="mi">2</span><span class="p">)</span> -<span class="gp">>>> </span><span class="n">G</span><span class="o">.</span><span class="n">add_node</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="n">weight</span><span class="o">=</span><span class="mi">3</span><span class="p">)</span> -<span class="gp">>>> </span><span class="nb">dict</span><span class="p">(</span><span class="n">G</span><span class="o">.</span><span class="n">nodes</span><span class="p">(</span><span class="n">data</span><span class="o">=</span><span class="s1">'weight'</span><span class="p">,</span> <span class="n">default</span><span class="o">=</span><span class="mi">1</span><span class="p">))</span> -<span class="go">{0: 1, 1: 2, 2: 3}</span> -</pre></div> -</div> -</dd></dl> - -<dl class="method"> -<dt id="kadmos.graph.graph_kadmos.KadmosGraph.number_of_edges"> -<code class="descname">number_of_edges</code><span class="sig-paren">(</span><em>u=None</em>, <em>v=None</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_kadmos.KadmosGraph.number_of_edges" title="Permalink to this definition">¶</a></dt> -<dd><p>Return the number of edges between two nodes.</p> -<dl class="docutils"> -<dt>u, v <span class="classifier-delimiter">:</span> <span class="classifier">nodes, optional (default=all edges)</span></dt> -<dd>If u and v are specified, return the number of edges between -u and v. Otherwise return the total number of all edges.</dd> -</dl> -<dl class="docutils"> -<dt>nedges <span class="classifier-delimiter">:</span> <span class="classifier">int</span></dt> -<dd>The number of edges in the graph. If nodes <cite>u</cite> and <cite>v</cite> are -specified return the number of edges between those nodes. If -the graph is directed, this only returns the number of edges -from <cite>u</cite> to <cite>v</cite>.</dd> -</dl> -<p>size</p> -<p>For undirected graphs, this method counts the total number of -edges in the graph:</p> -<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">G</span> <span class="o">=</span> <span class="n">nx</span><span class="o">.</span><span class="n">path_graph</span><span class="p">(</span><span class="mi">4</span><span class="p">)</span> -<span class="gp">>>> </span><span class="n">G</span><span class="o">.</span><span class="n">number_of_edges</span><span class="p">()</span> -<span class="go">3</span> -</pre></div> -</div> -<p>If you specify two nodes, this counts the total number of edges -joining the two nodes:</p> -<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">G</span><span class="o">.</span><span class="n">number_of_edges</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span> -<span class="go">1</span> -</pre></div> -</div> -<p>For directed graphs, this method can count the total number of -directed edges from <cite>u</cite> to <cite>v</cite>:</p> -<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">G</span> <span class="o">=</span> <span class="n">nx</span><span class="o">.</span><span class="n">DiGraph</span><span class="p">()</span> -<span class="gp">>>> </span><span class="n">G</span><span class="o">.</span><span class="n">add_edge</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span> -<span class="gp">>>> </span><span class="n">G</span><span class="o">.</span><span class="n">add_edge</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span> -<span class="gp">>>> </span><span class="n">G</span><span class="o">.</span><span class="n">number_of_edges</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span> -<span class="go">1</span> -</pre></div> -</div> -</dd></dl> - -<dl class="method"> -<dt id="kadmos.graph.graph_kadmos.KadmosGraph.number_of_nodes"> -<code class="descname">number_of_nodes</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_kadmos.KadmosGraph.number_of_nodes" title="Permalink to this definition">¶</a></dt> -<dd><p>Return the number of nodes in the graph.</p> -<dl class="docutils"> -<dt>nnodes <span class="classifier-delimiter">:</span> <span class="classifier">int</span></dt> -<dd>The number of nodes in the graph.</dd> -</dl> -<p>order, __len__ which are identical</p> -<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">G</span> <span class="o">=</span> <span class="n">nx</span><span class="o">.</span><span class="n">path_graph</span><span class="p">(</span><span class="mi">3</span><span class="p">)</span> <span class="c1"># or DiGraph, MultiGraph, MultiDiGraph, etc</span> -<span class="gp">>>> </span><span class="nb">len</span><span class="p">(</span><span class="n">G</span><span class="p">)</span> -<span class="go">3</span> -</pre></div> -</div> -</dd></dl> - -<dl class="method"> -<dt id="kadmos.graph.graph_kadmos.KadmosGraph.order"> -<code class="descname">order</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_kadmos.KadmosGraph.order" title="Permalink to this definition">¶</a></dt> -<dd><p>Return the number of nodes in the graph.</p> -<dl class="docutils"> -<dt>nnodes <span class="classifier-delimiter">:</span> <span class="classifier">int</span></dt> -<dd>The number of nodes in the graph.</dd> -</dl> -<p>number_of_nodes, __len__ which are identical</p> -</dd></dl> - -<dl class="attribute"> -<dt id="kadmos.graph.graph_kadmos.KadmosGraph.out_degree"> -<code class="descname">out_degree</code><a class="headerlink" href="#kadmos.graph.graph_kadmos.KadmosGraph.out_degree" title="Permalink to this definition">¶</a></dt> -<dd><p>An OutDegreeView for (node, out_degree)</p> -<p>The node out_degree is the number of edges pointing out of the node. -The weighted node degree is the sum of the edge weights for -edges incident to that node.</p> -<p>This object provides an iterator over (node, out_degree) as well as -lookup for the degree for a single node.</p> -<dl class="docutils"> -<dt>nbunch <span class="classifier-delimiter">:</span> <span class="classifier">single node, container, or all nodes (default= all nodes)</span></dt> -<dd>The view will only report edges incident to these nodes.</dd> -<dt>weight <span class="classifier-delimiter">:</span> <span class="classifier">string or None, optional (default=None)</span></dt> -<dd>The name of an edge attribute that holds the numerical value used -as a weight. If None, then each edge has weight 1. -The degree is the sum of the edge weights adjacent to the node.</dd> -</dl> -<p>If a single node is requested -deg : int</p> -<blockquote> -<div>Out-degree of the node</div></blockquote> -<p>OR if multiple nodes are requested -nd_iter : iterator</p> -<blockquote> -<div>The iterator returns two-tuples of (node, out-degree).</div></blockquote> -<p>degree, in_degree</p> -<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">G</span> <span class="o">=</span> <span class="n">nx</span><span class="o">.</span><span class="n">DiGraph</span><span class="p">()</span> -<span class="gp">>>> </span><span class="n">nx</span><span class="o">.</span><span class="n">add_path</span><span class="p">(</span><span class="n">G</span><span class="p">,</span> <span class="p">[</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">])</span> -<span class="gp">>>> </span><span class="n">G</span><span class="o">.</span><span class="n">out_degree</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span> <span class="c1"># node 0 with degree 1</span> -<span class="go">1</span> -<span class="gp">>>> </span><span class="nb">list</span><span class="p">(</span><span class="n">G</span><span class="o">.</span><span class="n">out_degree</span><span class="p">([</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">]))</span> -<span class="go">[(0, 1), (1, 1), (2, 1)]</span> -</pre></div> -</div> -</dd></dl> - -<dl class="attribute"> -<dt id="kadmos.graph.graph_kadmos.KadmosGraph.out_edges"> -<code class="descname">out_edges</code><a class="headerlink" href="#kadmos.graph.graph_kadmos.KadmosGraph.out_edges" title="Permalink to this definition">¶</a></dt> -<dd><p>An OutEdgeView of the DiGraph as G.edges or G.edges().</p> -<p>edges(self, nbunch=None, data=False, default=None)</p> -<p>The OutEdgeView provides set-like operations on the edge-tuples -as well as edge attribute lookup. When called, it also provides -an EdgeDataView object which allows control of access to edge -attributes (but does not provide set-like operations). -Hence, <cite>G.edges[u, v][‘color’]</cite> provides the value of the color -attribute for edge <cite>(u, v)</cite> while -<cite>for (u, v, c) in G.edges.data(‘color’, default=’red’):</cite> -iterates through all the edges yielding the color attribute -with default <cite>‘red’</cite> if no color attribute exists.</p> -<dl class="docutils"> -<dt>nbunch <span class="classifier-delimiter">:</span> <span class="classifier">single node, container, or all nodes (default= all nodes)</span></dt> -<dd>The view will only report edges incident to these nodes.</dd> -<dt>data <span class="classifier-delimiter">:</span> <span class="classifier">string or bool, optional (default=False)</span></dt> -<dd>The edge attribute returned in 3-tuple (u, v, ddict[data]). -If True, return edge attribute dict in 3-tuple (u, v, ddict). -If False, return 2-tuple (u, v).</dd> -<dt>default <span class="classifier-delimiter">:</span> <span class="classifier">value, optional (default=None)</span></dt> -<dd>Value used for edges that dont have the requested attribute. -Only relevant if data is not True or False.</dd> -</dl> -<dl class="docutils"> -<dt>edges <span class="classifier-delimiter">:</span> <span class="classifier">OutEdgeView</span></dt> -<dd>A view of edge attributes, usually it iterates over (u, v) -or (u, v, d) tuples of edges, but can also be used for -attribute lookup as <cite>edges[u, v][‘foo’]</cite>.</dd> -</dl> -<p>in_edges, out_edges</p> -<p>Nodes in nbunch that are not in the graph will be (quietly) ignored. -For directed graphs this returns the out-edges.</p> -<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">G</span> <span class="o">=</span> <span class="n">nx</span><span class="o">.</span><span class="n">DiGraph</span><span class="p">()</span> <span class="c1"># or MultiDiGraph, etc</span> -<span class="gp">>>> </span><span class="n">nx</span><span class="o">.</span><span class="n">add_path</span><span class="p">(</span><span class="n">G</span><span class="p">,</span> <span class="p">[</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">])</span> -<span class="gp">>>> </span><span class="n">G</span><span class="o">.</span><span class="n">add_edge</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="n">weight</span><span class="o">=</span><span class="mi">5</span><span class="p">)</span> -<span class="gp">>>> </span><span class="p">[</span><span class="n">e</span> <span class="k">for</span> <span class="n">e</span> <span class="ow">in</span> <span class="n">G</span><span class="o">.</span><span class="n">edges</span><span class="p">]</span> -<span class="go">[(0, 1), (1, 2), (2, 3)]</span> -<span class="gp">>>> </span><span class="n">G</span><span class="o">.</span><span class="n">edges</span><span class="o">.</span><span class="n">data</span><span class="p">()</span> <span class="c1"># default data is {} (empty dict)</span> -<span class="go">OutEdgeDataView([(0, 1, {}), (1, 2, {}), (2, 3, {'weight': 5})])</span> -<span class="gp">>>> </span><span class="n">G</span><span class="o">.</span><span class="n">edges</span><span class="o">.</span><span class="n">data</span><span class="p">(</span><span class="s1">'weight'</span><span class="p">,</span> <span class="n">default</span><span class="o">=</span><span class="mi">1</span><span class="p">)</span> -<span class="go">OutEdgeDataView([(0, 1, 1), (1, 2, 1), (2, 3, 5)])</span> -<span class="gp">>>> </span><span class="n">G</span><span class="o">.</span><span class="n">edges</span><span class="p">([</span><span class="mi">0</span><span class="p">,</span> <span class="mi">2</span><span class="p">])</span> <span class="c1"># only edges incident to these nodes</span> -<span class="go">OutEdgeDataView([(0, 1), (2, 3)])</span> -<span class="gp">>>> </span><span class="n">G</span><span class="o">.</span><span class="n">edges</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span> <span class="c1"># only edges incident to a single node (use G.adj[0]?)</span> -<span class="go">OutEdgeDataView([(0, 1)])</span> -</pre></div> -</div> -</dd></dl> - <dl class="method"> <dt id="kadmos.graph.graph_kadmos.KadmosGraph.plot_adjacency_matrix"> <code class="descname">plot_adjacency_matrix</code><span class="sig-paren">(</span><em>fig_num=1</em>, <em>fig_size=(7</em>, <em>7)</em>, <em>show_now=True</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_kadmos.KadmosGraph.plot_adjacency_matrix" title="Permalink to this definition">¶</a></dt> @@ -2652,20 +1760,18 @@ For directed graphs this returns the out-edges.</p> <dt id="kadmos.graph.graph_kadmos.KadmosGraph.plot_graph"> <code class="descname">plot_graph</code><span class="sig-paren">(</span><em>fig_num=1</em>, <em>color_setting='default'</em>, <em>positioning='circular'</em>, <em>save_as=None</em>, <em>show_now=True</em>, <em>title=None</em>, <em>edge_label=False</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_kadmos.KadmosGraph.plot_graph" title="Permalink to this definition">¶</a></dt> <dd><p>Function to plot a graph.</p> -<p>Note that you need to add matplotlib.pyplot.show() at the end of your code to see the plot window.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> -<li><strong>fig_num</strong> – figure number</li> -<li><strong>fig_size</strong> – size of figure window</li> -<li><strong>color_setting</strong> – choose from ‘default’, ‘sinks’, ‘categories’, ‘partitions’</li> -<li><strong>positioning</strong> – choose from ‘circular’, ‘spring’</li> -<li><strong>save_as</strong> – save plot as figure file</li> -<li><strong>show_now</strong> – Boolean whether to plot directly (pausing the execution until the plot is closed), or not.</li> -<li><strong>title</strong> – title string of the graph</li> -<li><strong>edge_label</strong> – edge attribute that will be shown for each edge in graph</li> +<li><strong>fig_num</strong> (<em>int</em>) – figure number</li> +<li><strong>color_setting</strong> (<em>str</em>) – choose from ‘default’, ‘sinks’, ‘categories’, ‘partitions’</li> +<li><strong>positioning</strong> (<em>str</em>) – choose from ‘circular’, ‘spring’</li> +<li><strong>save_as</strong> (<em>bool</em>) – save plot as figure file</li> +<li><strong>show_now</strong> (<em>bool</em>) – Boolean whether to plot directly (pausing the execution until the plot is closed), or not.</li> +<li><strong>title</strong> (<em>str</em>) – title of the graph</li> +<li><strong>edge_label</strong> (<em>str</em>) – edge attribute that will be shown for each edge in graph</li> </ul> </td> </tr> @@ -2674,26 +1780,10 @@ For directed graphs this returns the out-edges.</p> </tr> </tbody> </table> -</dd></dl> - -<dl class="attribute"> -<dt id="kadmos.graph.graph_kadmos.KadmosGraph.pred"> -<code class="descname">pred</code><a class="headerlink" href="#kadmos.graph.graph_kadmos.KadmosGraph.pred" title="Permalink to this definition">¶</a></dt> -<dd><p>Graph adjacency object holding the predecessors of each node.</p> -<p>This object is a read-only dict-like structure with node keys -and neighbor-dict values. The neighbor-dict is keyed by neighbor -to the edge-data-dict. So <cite>G.pred[2][3][‘color’] = ‘blue’</cite> sets -the color of the edge <cite>(3, 2)</cite> to <cite>“blueâ€</cite>.</p> -<p>Iterating over G.pred behaves like a dict. Useful idioms include -<cite>for nbr, datadict in G.pred[n].items():</cite>. A data-view not provided -by dicts also exists: <cite>for nbr, foovalue in G.pred[node].data(‘foo’):</cite> -A default can be set via a <cite>default</cite> argument to the <cite>data</cite> method.</p> -</dd></dl> - -<dl class="method"> -<dt id="kadmos.graph.graph_kadmos.KadmosGraph.predecessors"> -<code class="descname">predecessors</code><span class="sig-paren">(</span><em>n</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_kadmos.KadmosGraph.predecessors" title="Permalink to this definition">¶</a></dt> -<dd><p>Return an iterator over predecessor nodes of n.</p> +<div class="admonition hint"> +<p class="first admonition-title">Hint</p> +<p class="last">if the plot window is not showing, you need to add matplotlib.pyplot.show() at the end of your code</p> +</div> </dd></dl> <dl class="method"> @@ -2718,7 +1808,9 @@ A default can be set via a <cite>default</cite> argument to the <cite>data</cite <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>mapping</strong> (<em>None</em><em>, </em><em>True</em>) – application of mapping required, optional (default=None)</td> +<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>mapping</strong> (<em>None</em><em>, </em><em>bool</em>) – application of mapping required, optional (default=None)</td> +</tr> +<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">relabeled graph</td> </tr> </tbody> </table> @@ -2727,164 +1819,59 @@ A default can be set via a <cite>default</cite> argument to the <cite>data</cite <li>Minimum information: ID</li> <li>Maximum information: ID[modeID][instanceID][version]</li> </ul> -<p>Note: modeID, instanceID and version are only provided if there is a function with the same ID that requires +<div class="admonition note"> +<p class="first admonition-title">Note</p> +<p class="last">modeID, instanceID and version are only provided if there is a function with the same ID that requires this specification to differentiate between the functions.</p> +</div> <p>Example:</p> <p>Design competences (full information):</p> -<ul class="simple"> +<ol class="arabic simple"> <li>Aerodynamics[A][1][v1]</li> <li>Aerodynamics[A][2][v1]</li> <li>Aerodynamics[B][1][v1]</li> <li>Structures[A][1][v1]</li> <li>Structures[A}[1][v2]</li> <li>Propulsion[A][1][v2]</li> -</ul> +</ol> <p>Design competences relabeled:</p> -<ul class="simple"> +<ol class="arabic simple"> <li>Aerodynamics[A][1]</li> <li>Aerodynamics[A][2]</li> <li>Aerodynamics[B][1]</li> <li>Structure[v1]</li> <li>Structure[v2]</li> <li>Propulsion</li> -</ul> -</dd></dl> - -<dl class="method"> -<dt id="kadmos.graph.graph_kadmos.KadmosGraph.remove_edge"> -<code class="descname">remove_edge</code><span class="sig-paren">(</span><em>u</em>, <em>v</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_kadmos.KadmosGraph.remove_edge" title="Permalink to this definition">¶</a></dt> -<dd><p>Remove the edge between u and v.</p> -<dl class="docutils"> -<dt>u, v <span class="classifier-delimiter">:</span> <span class="classifier">nodes</span></dt> -<dd>Remove the edge between nodes u and v.</dd> -</dl> -<dl class="docutils"> -<dt>NetworkXError</dt> -<dd>If there is not an edge between u and v.</dd> -</dl> -<p>remove_edges_from : remove a collection of edges</p> -<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">G</span> <span class="o">=</span> <span class="n">nx</span><span class="o">.</span><span class="n">Graph</span><span class="p">()</span> <span class="c1"># or DiGraph, etc</span> -<span class="gp">>>> </span><span class="n">nx</span><span class="o">.</span><span class="n">add_path</span><span class="p">(</span><span class="n">G</span><span class="p">,</span> <span class="p">[</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">])</span> -<span class="gp">>>> </span><span class="n">G</span><span class="o">.</span><span class="n">remove_edge</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span> -<span class="gp">>>> </span><span class="n">e</span> <span class="o">=</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">)</span> -<span class="gp">>>> </span><span class="n">G</span><span class="o">.</span><span class="n">remove_edge</span><span class="p">(</span><span class="o">*</span><span class="n">e</span><span class="p">)</span> <span class="c1"># unpacks e from an edge tuple</span> -<span class="gp">>>> </span><span class="n">e</span> <span class="o">=</span> <span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="p">{</span><span class="s1">'weight'</span><span class="p">:</span><span class="mi">7</span><span class="p">})</span> <span class="c1"># an edge with attribute data</span> -<span class="gp">>>> </span><span class="n">G</span><span class="o">.</span><span class="n">remove_edge</span><span class="p">(</span><span class="o">*</span><span class="n">e</span><span class="p">[:</span><span class="mi">2</span><span class="p">])</span> <span class="c1"># select first part of edge tuple</span> -</pre></div> -</div> -</dd></dl> - -<dl class="method"> -<dt id="kadmos.graph.graph_kadmos.KadmosGraph.remove_edges_from"> -<code class="descname">remove_edges_from</code><span class="sig-paren">(</span><em>ebunch</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_kadmos.KadmosGraph.remove_edges_from" title="Permalink to this definition">¶</a></dt> -<dd><p>Remove all edges specified in ebunch.</p> -<dl class="docutils"> -<dt>ebunch: list or container of edge tuples</dt> -<dd><p class="first">Each edge given in the list or container will be removed -from the graph. The edges can be:</p> -<blockquote class="last"> -<div><ul class="simple"> -<li>2-tuples (u, v) edge between u and v.</li> -<li>3-tuples (u, v, k) where k is ignored.</li> -</ul> -</div></blockquote> -</dd> -</dl> -<p>remove_edge : remove a single edge</p> -<p>Will fail silently if an edge in ebunch is not in the graph.</p> -<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">G</span> <span class="o">=</span> <span class="n">nx</span><span class="o">.</span><span class="n">path_graph</span><span class="p">(</span><span class="mi">4</span><span class="p">)</span> <span class="c1"># or DiGraph, MultiGraph, MultiDiGraph, etc</span> -<span class="gp">>>> </span><span class="n">ebunch</span> <span class="o">=</span> <span class="p">[(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">),</span> <span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">)]</span> -<span class="gp">>>> </span><span class="n">G</span><span class="o">.</span><span class="n">remove_edges_from</span><span class="p">(</span><span class="n">ebunch</span><span class="p">)</span> -</pre></div> -</div> +</ol> </dd></dl> <dl class="method"> <dt id="kadmos.graph.graph_kadmos.KadmosGraph.remove_function_nodes"> <code class="descname">remove_function_nodes</code><span class="sig-paren">(</span><em>*args</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_kadmos.KadmosGraph.remove_function_nodes" title="Permalink to this definition">¶</a></dt> <dd><p>Function that removes a function node</p> -<p>Also the input and output variables that only have links to this specific function node are deleted. A simple -remove_node of a function node might lead to unconnected variables in the graph.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>args</strong> (<em>str</em><em> or </em><em>list</em>) – function node id(s)</td> +<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>args</strong> (<em>str</em><em>, </em><em>list</em>) – function node id(s)</td> +</tr> +<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">graph with nodes removed</td> +</tr> +<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference internal" href="#kadmos.graph.graph_kadmos.KadmosGraph" title="kadmos.graph.graph_kadmos.KadmosGraph">KadmosGraph</a></td> </tr> </tbody> </table> -</dd></dl> - -<dl class="method"> -<dt id="kadmos.graph.graph_kadmos.KadmosGraph.remove_node"> -<code class="descname">remove_node</code><span class="sig-paren">(</span><em>n</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_kadmos.KadmosGraph.remove_node" title="Permalink to this definition">¶</a></dt> -<dd><p>Remove node n.</p> -<p>Removes the node n and all adjacent edges. -Attempting to remove a non-existent node will raise an exception.</p> -<dl class="docutils"> -<dt>n <span class="classifier-delimiter">:</span> <span class="classifier">node</span></dt> -<dd>A node in the graph</dd> -</dl> -<dl class="docutils"> -<dt>NetworkXError</dt> -<dd>If n is not in the graph.</dd> -</dl> -<p>remove_nodes_from</p> -<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">G</span> <span class="o">=</span> <span class="n">nx</span><span class="o">.</span><span class="n">path_graph</span><span class="p">(</span><span class="mi">3</span><span class="p">)</span> <span class="c1"># or DiGraph, MultiGraph, MultiDiGraph, etc</span> -<span class="gp">>>> </span><span class="nb">list</span><span class="p">(</span><span class="n">G</span><span class="o">.</span><span class="n">edges</span><span class="p">)</span> -<span class="go">[(0, 1), (1, 2)]</span> -<span class="gp">>>> </span><span class="n">G</span><span class="o">.</span><span class="n">remove_node</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span> -<span class="gp">>>> </span><span class="nb">list</span><span class="p">(</span><span class="n">G</span><span class="o">.</span><span class="n">edges</span><span class="p">)</span> -<span class="go">[]</span> -</pre></div> -</div> -</dd></dl> - -<dl class="method"> -<dt id="kadmos.graph.graph_kadmos.KadmosGraph.remove_nodes_from"> -<code class="descname">remove_nodes_from</code><span class="sig-paren">(</span><em>nodes</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_kadmos.KadmosGraph.remove_nodes_from" title="Permalink to this definition">¶</a></dt> -<dd><p>Remove multiple nodes.</p> -<dl class="docutils"> -<dt>nodes <span class="classifier-delimiter">:</span> <span class="classifier">iterable container</span></dt> -<dd>A container of nodes (list, dict, set, etc.). If a node -in the container is not in the graph it is silently ignored.</dd> -</dl> -<p>remove_node</p> -<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">G</span> <span class="o">=</span> <span class="n">nx</span><span class="o">.</span><span class="n">path_graph</span><span class="p">(</span><span class="mi">3</span><span class="p">)</span> <span class="c1"># or DiGraph, MultiGraph, MultiDiGraph, etc</span> -<span class="gp">>>> </span><span class="n">e</span> <span class="o">=</span> <span class="nb">list</span><span class="p">(</span><span class="n">G</span><span class="o">.</span><span class="n">nodes</span><span class="p">)</span> -<span class="gp">>>> </span><span class="n">e</span> -<span class="go">[0, 1, 2]</span> -<span class="gp">>>> </span><span class="n">G</span><span class="o">.</span><span class="n">remove_nodes_from</span><span class="p">(</span><span class="n">e</span><span class="p">)</span> -<span class="gp">>>> </span><span class="nb">list</span><span class="p">(</span><span class="n">G</span><span class="o">.</span><span class="n">nodes</span><span class="p">)</span> -<span class="go">[]</span> -</pre></div> +<div class="admonition attention"> +<p class="first admonition-title">Attention</p> +<p class="last">Also the input and output variables that only have links to this specific function node are +deleted. A simple remove_node of a function node might lead to unconnected variables in the graph.</p> </div> </dd></dl> -<dl class="method"> -<dt id="kadmos.graph.graph_kadmos.KadmosGraph.reverse"> -<code class="descname">reverse</code><span class="sig-paren">(</span><em>copy=True</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_kadmos.KadmosGraph.reverse" title="Permalink to this definition">¶</a></dt> -<dd><p>Return the reverse of the graph.</p> -<p>The reverse is a graph with the same nodes and edges -but with the directions of the edges reversed.</p> -<dl class="docutils"> -<dt>copy <span class="classifier-delimiter">:</span> <span class="classifier">bool optional (default=True)</span></dt> -<dd>If True, return a new DiGraph holding the reversed edges. -If False, the reverse graph is created using a view of -the original graph.</dd> -</dl> -</dd></dl> - <dl class="method"> <dt id="kadmos.graph.graph_kadmos.KadmosGraph.save"> -<code class="descname">save</code><span class="sig-paren">(</span><em>file_name</em>, <em>file_type='kdms'</em>, <em>graph_check_critical=True</em>, <em>destination_folder=None</em>, <em>mpg=None</em>, <em>description=''</em>, <em>creator=''</em>, <em>version='1.0'</em>, <em>timestamp=datetime.datetime(2018</em>, <em>3</em>, <em>31</em>, <em>17</em>, <em>25</em>, <em>15</em>, <em>655000)</em>, <em>keep_empty_elements=False</em>, <em>pretty_print=False</em>, <em>convention=True</em>, <em>integrity=False</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_kadmos.KadmosGraph.save" title="Permalink to this definition">¶</a></dt> +<code class="descname">save</code><span class="sig-paren">(</span><em>file_name</em>, <em>file_type='kdms'</em>, <em>graph_check_critical=True</em>, <em>destination_folder=None</em>, <em>mpg=None</em>, <em>description=''</em>, <em>creator=''</em>, <em>version='1.0'</em>, <em>timestamp=datetime.datetime(2018</em>, <em>4</em>, <em>13</em>, <em>10</em>, <em>36</em>, <em>45</em>, <em>941000)</em>, <em>keep_empty_elements=False</em>, <em>pretty_print=False</em>, <em>convention=True</em>, <em>integrity=False</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_kadmos.KadmosGraph.save" title="Permalink to this definition">¶</a></dt> <dd><p>Method to save the graph.</p> -<p>Different output file types are implemented for saving graphs. They are listed below:</p> -<ul class="simple"> -<li>kdms: the most simple file type which makes use of pickling</li> -<li>cmdows: the most versatile file type especially suited for file exchange with other tools</li> -<li>graphml: another file type especially suited for file exchange with other tools based on graphs</li> -</ul> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> @@ -2897,7 +1884,7 @@ the original graph.</dd> <li><strong>mpg</strong> (<a class="reference internal" href="#kadmos.graph.graph_process.MdaoProcessGraph" title="kadmos.graph.graph_process.MdaoProcessGraph"><em>MdaoProcessGraph</em></a>) – optional MPG graph to be saved with MDG</li> <li><strong>description</strong> (<em>str</em>) – description of the file (only applicable for the cmdows file type)</li> <li><strong>creator</strong> (<em>str</em>) – name of the creator of the file (only applicable for the cmdows file type)</li> -<li><strong>version</strong> (<em>str | float | int</em>) – version of the file (only applicable for the cmdows file type)</li> +<li><strong>version</strong> (<em>str</em><em>, </em><em>float</em><em>, </em><em>int</em>) – version of the file (only applicable for the cmdows file type)</li> <li><strong>timestamp</strong> (<em>datetime</em>) – timestamp to be saved in the file (only applicable for the cmdows file type)</li> <li><strong>keep_empty_elements</strong> (<em>bool</em>) – option for keeping empty XML elements (only applicable for the cmdows file type)</li> <li><strong>pretty_print</strong> (<em>bool</em>) – option for pretty XML printing (only applicable for the cmdows file type)</li> @@ -2908,57 +1895,37 @@ the original graph.</dd> </tr> </tbody> </table> +<div class="admonition note"> +<p class="first admonition-title">Note</p> +<p>Different output file types are implemented for saving graphs. They are listed below:</p> +<ul class="last simple"> +<li>kdms: the most simple file type which makes use of pickling</li> +<li>cmdows: the most versatile file type especially suited for file exchange with other tools</li> +<li>graphml: another file type especially suited for file exchange with other tools based on graphs</li> +</ul> +</div> </dd></dl> <dl class="method"> <dt id="kadmos.graph.graph_kadmos.KadmosGraph.select_objectives_from_graph"> <code class="descname">select_objectives_from_graph</code><span class="sig-paren">(</span><em>*args</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_kadmos.KadmosGraph.select_objectives_from_graph" title="Permalink to this definition">¶</a></dt> <dd><p>This functions lets the user select one or more objective functions from the graph.</p> -<p>Only functions can be selected as objectives. If no arguments are provided, user is prompted to select an -objective from all functions in graph.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Param:</th><td class="field-body">args: objective functions to choose from</td> +<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>args</strong> (<em>str</em>) – objective functions to choose from</td> </tr> <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">list of objective functions</td> </tr> +<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body">list</td> +</tr> </tbody> </table> -</dd></dl> - -<dl class="method"> -<dt id="kadmos.graph.graph_kadmos.KadmosGraph.size"> -<code class="descname">size</code><span class="sig-paren">(</span><em>weight=None</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_kadmos.KadmosGraph.size" title="Permalink to this definition">¶</a></dt> -<dd><p>Return the number of edges or total of all edge weights.</p> -<dl class="docutils"> -<dt>weight <span class="classifier-delimiter">:</span> <span class="classifier">string or None, optional (default=None)</span></dt> -<dd>The edge attribute that holds the numerical value used -as a weight. If None, then each edge has weight 1.</dd> -</dl> -<dl class="docutils"> -<dt>size <span class="classifier-delimiter">:</span> <span class="classifier">numeric</span></dt> -<dd><p class="first">The number of edges or -(if weight keyword is provided) the total weight sum.</p> -<p class="last">If weight is None, returns an int. Otherwise a float -(or more general numeric if the weights are more general).</p> -</dd> -</dl> -<p>number_of_edges</p> -<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">G</span> <span class="o">=</span> <span class="n">nx</span><span class="o">.</span><span class="n">path_graph</span><span class="p">(</span><span class="mi">4</span><span class="p">)</span> <span class="c1"># or DiGraph, MultiGraph, MultiDiGraph, etc</span> -<span class="gp">>>> </span><span class="n">G</span><span class="o">.</span><span class="n">size</span><span class="p">()</span> -<span class="go">3</span> -</pre></div> -</div> -<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">G</span> <span class="o">=</span> <span class="n">nx</span><span class="o">.</span><span class="n">Graph</span><span class="p">()</span> <span class="c1"># or DiGraph, MultiGraph, MultiDiGraph, etc</span> -<span class="gp">>>> </span><span class="n">G</span><span class="o">.</span><span class="n">add_edge</span><span class="p">(</span><span class="s1">'a'</span><span class="p">,</span> <span class="s1">'b'</span><span class="p">,</span> <span class="n">weight</span><span class="o">=</span><span class="mi">2</span><span class="p">)</span> -<span class="gp">>>> </span><span class="n">G</span><span class="o">.</span><span class="n">add_edge</span><span class="p">(</span><span class="s1">'b'</span><span class="p">,</span> <span class="s1">'c'</span><span class="p">,</span> <span class="n">weight</span><span class="o">=</span><span class="mi">4</span><span class="p">)</span> -<span class="gp">>>> </span><span class="n">G</span><span class="o">.</span><span class="n">size</span><span class="p">()</span> -<span class="go">2</span> -<span class="gp">>>> </span><span class="n">G</span><span class="o">.</span><span class="n">size</span><span class="p">(</span><span class="n">weight</span><span class="o">=</span><span class="s1">'weight'</span><span class="p">)</span> -<span class="go">6.0</span> -</pre></div> +<div class="admonition note"> +<p class="first admonition-title">Note</p> +<p class="last">Only functions can be selected as objectives. If no arguments are provided, user is prompted to select +an objective from all functions in graph.</p> </div> </dd></dl> @@ -2966,28 +1933,35 @@ as a weight. If None, then each edge has weight 1.</dd> <dt id="kadmos.graph.graph_kadmos.KadmosGraph.split_variables"> <code class="descname">split_variables</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_kadmos.KadmosGraph.split_variables" title="Permalink to this definition">¶</a></dt> <dd><p>Method to split a problematic variable node into multiple separate valid nodes.</p> +<table class="docutils field-list" frame="void" rules="none"> +<col class="field-name" /> +<col class="field-body" /> +<tbody valign="top"> +<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> +<li><strong>args</strong> (<em>basestring</em><em>, </em><em>list</em>) – problematic node in the graph</li> +<li><strong>kwargs</strong> – </li> +</ul> +</td> +</tr> +<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">graph with split variables</p> +</td> +</tr> +<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last"><a class="reference internal" href="#kadmos.graph.graph_kadmos.KadmosGraph" title="kadmos.graph.graph_kadmos.KadmosGraph">KadmosGraph</a></p> +</td> +</tr> +</tbody> +</table> <p>The following variables are considered problematic and will be handled by this function:</p> -<blockquote> -<div><ul> -<li><p class="first">pure circular coupling</p> -</li> -<li><p class="first">shared circular coupling</p> -</li> -<li><p class="first">collided coupling</p> -</li> -<li><p class="first">collision</p> -</li> -<li><p class="first">collided circular coupling</p> -</li> -<li><p class="first">collided shared coupling</p> -</li> -<li><p class="first">collided shared circular coupling</p> -<blockquote> -<div><p>The following table shows an example situation for each of the different problematic variables:</p> -</div></blockquote> -</li> +<ul class="simple"> +<li>pure circular coupling</li> +<li>shared circular coupling</li> +<li>collided coupling</li> +<li>collision</li> +<li>collided circular coupling</li> +<li>collided shared coupling</li> +<li>collided shared circular coupling</li> </ul> -</div></blockquote> +<p>The following table shows an example situation for each of the different problematic variables:</p> <table border="1" class="docutils"> <colgroup> <col width="22%" /> @@ -3062,322 +2036,124 @@ F5, F6</td> </tr> </tbody> </table> +</dd></dl> + +</dd></dl> + +</div> +<div class="section" id="datagraph"> +<h3>DataGraph<a class="headerlink" href="#datagraph" title="Permalink to this headline">¶</a></h3> +<dl class="class"> +<dt id="kadmos.graph.graph_data.DataGraph"> +<em class="property">class </em><code class="descclassname">kadmos.graph.graph_data.</code><code class="descname">DataGraph</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph" title="Permalink to this definition">¶</a></dt> +<dd><dl class="method"> +<dt id="kadmos.graph.graph_data.DataGraph.get_coupling_dictionary"> +<code class="descname">get_coupling_dictionary</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.get_coupling_dictionary" title="Permalink to this definition">¶</a></dt> +<dd><p>Function to get a coupling dictionary.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>args</strong> (<em>basestring</em><em>, </em><em>list</em>) – problematic node in the graph</td> +<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">coupling dictionary</td> +</tr> +<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">dict</td> </tr> </tbody> </table> +<p>For each function node, the dictionary indicates from which function +nodes it gets its input and the number of variables it gets.</p> +<ul class="simple"> +<li>F2 ==> x1, x2 ==> F1</li> +<li>F3 ==> x3 ==> F1</li> +</ul> +<p>Will give: {F1: {F2: 2, F3: 1}}</p> </dd></dl> <dl class="method"> -<dt id="kadmos.graph.graph_kadmos.KadmosGraph.subgraph"> -<code class="descname">subgraph</code><span class="sig-paren">(</span><em>nodes</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_kadmos.KadmosGraph.subgraph" title="Permalink to this definition">¶</a></dt> -<dd><p>Return a SubGraph view of the subgraph induced on <cite>nodes</cite>.</p> -<p>The induced subgraph of the graph contains the nodes in <cite>nodes</cite> -and the edges between those nodes.</p> -<dl class="docutils"> -<dt>nodes <span class="classifier-delimiter">:</span> <span class="classifier">list, iterable</span></dt> -<dd>A container of nodes which will be iterated through once.</dd> -</dl> -<dl class="docutils"> -<dt>G <span class="classifier-delimiter">:</span> <span class="classifier">SubGraph View</span></dt> -<dd>A subgraph view of the graph. The graph structure cannot be -changed but node/edge attributes can and are shared with the -original graph.</dd> -</dl> -<p>The graph, edge and node attributes are shared with the original graph. -Changes to the graph structure is ruled out by the view, but changes -to attributes are reflected in the original graph.</p> -<p>To create a subgraph with its own copy of the edge/node attributes use: -G.subgraph(nodes).copy()</p> -<p>For an inplace reduction of a graph to a subgraph you can remove nodes: -G.remove_nodes_from([n for n in G if n not in set(nodes)])</p> -<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">G</span> <span class="o">=</span> <span class="n">nx</span><span class="o">.</span><span class="n">path_graph</span><span class="p">(</span><span class="mi">4</span><span class="p">)</span> <span class="c1"># or DiGraph, MultiGraph, MultiDiGraph, etc</span> -<span class="gp">>>> </span><span class="n">H</span> <span class="o">=</span> <span class="n">G</span><span class="o">.</span><span class="n">subgraph</span><span class="p">([</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">])</span> -<span class="gp">>>> </span><span class="nb">list</span><span class="p">(</span><span class="n">H</span><span class="o">.</span><span class="n">edges</span><span class="p">)</span> -<span class="go">[(0, 1), (1, 2)]</span> -</pre></div> -</div> -</dd></dl> - -<dl class="attribute"> -<dt id="kadmos.graph.graph_kadmos.KadmosGraph.succ"> -<code class="descname">succ</code><a class="headerlink" href="#kadmos.graph.graph_kadmos.KadmosGraph.succ" title="Permalink to this definition">¶</a></dt> -<dd><p>Graph adjacency object holding the successors of each node.</p> -<p>This object is a read-only dict-like structure with node keys -and neighbor-dict values. The neighbor-dict is keyed by neighbor -to the edge-data-dict. So <cite>G.succ[3][2][‘color’] = ‘blue’</cite> sets -the color of the edge <cite>(3, 2)</cite> to <cite>“blueâ€</cite>.</p> -<p>Iterating over G.succ behaves like a dict. Useful idioms include -<cite>for nbr, datadict in G.succ[n].items():</cite>. A data-view not provided -by dicts also exists: <cite>for nbr, foovalue in G.succ[node].data(‘foo’):</cite> -and a default can be set via a <cite>default</cite> argument to the <cite>data</cite> method.</p> -<p>The neighbor information is also provided by subscripting the graph. -So <cite>for nbr, foovalue in G[node].data(‘foo’, default=1):</cite> works.</p> -<p>For directed graphs, <cite>G.adj</cite> is identical to <cite>G.succ</cite>.</p> -</dd></dl> - -<dl class="method"> -<dt id="kadmos.graph.graph_kadmos.KadmosGraph.successors"> -<code class="descname">successors</code><span class="sig-paren">(</span><em>n</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_kadmos.KadmosGraph.successors" title="Permalink to this definition">¶</a></dt> -<dd><p>Return an iterator over successor nodes of n.</p> -<p>neighbors() and successors() are the same.</p> -</dd></dl> - -<dl class="method"> -<dt id="kadmos.graph.graph_kadmos.KadmosGraph.to_directed"> -<code class="descname">to_directed</code><span class="sig-paren">(</span><em>as_view=False</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_kadmos.KadmosGraph.to_directed" title="Permalink to this definition">¶</a></dt> -<dd><p>Return a directed representation of the graph.</p> -<dl class="docutils"> -<dt>G <span class="classifier-delimiter">:</span> <span class="classifier">DiGraph</span></dt> -<dd>A directed graph with the same name, same nodes, and with -each edge (u, v, data) replaced by two directed edges -(u, v, data) and (v, u, data).</dd> -</dl> -<p>This returns a “deepcopy†of the edge, node, and -graph attributes which attempts to completely copy -all of the data and references.</p> -<p>This is in contrast to the similar D=DiGraph(G) which returns a -shallow copy of the data.</p> -<p>See the Python copy module for more information on shallow -and deep copies, <a class="reference external" href="https://docs.python.org/2/library/copy.html">https://docs.python.org/2/library/copy.html</a>.</p> -<p>Warning: If you have subclassed Graph to use dict-like objects -in the data structure, those changes do not transfer to the -DiGraph created by this method.</p> -<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">G</span> <span class="o">=</span> <span class="n">nx</span><span class="o">.</span><span class="n">Graph</span><span class="p">()</span> <span class="c1"># or MultiGraph, etc</span> -<span class="gp">>>> </span><span class="n">G</span><span class="o">.</span><span class="n">add_edge</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span> -<span class="gp">>>> </span><span class="n">H</span> <span class="o">=</span> <span class="n">G</span><span class="o">.</span><span class="n">to_directed</span><span class="p">()</span> -<span class="gp">>>> </span><span class="nb">list</span><span class="p">(</span><span class="n">H</span><span class="o">.</span><span class="n">edges</span><span class="p">)</span> -<span class="go">[(0, 1), (1, 0)]</span> -</pre></div> -</div> -<p>If already directed, return a (deep) copy</p> -<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">G</span> <span class="o">=</span> <span class="n">nx</span><span class="o">.</span><span class="n">DiGraph</span><span class="p">()</span> <span class="c1"># or MultiDiGraph, etc</span> -<span class="gp">>>> </span><span class="n">G</span><span class="o">.</span><span class="n">add_edge</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span> -<span class="gp">>>> </span><span class="n">H</span> <span class="o">=</span> <span class="n">G</span><span class="o">.</span><span class="n">to_directed</span><span class="p">()</span> -<span class="gp">>>> </span><span class="nb">list</span><span class="p">(</span><span class="n">H</span><span class="o">.</span><span class="n">edges</span><span class="p">)</span> -<span class="go">[(0, 1)]</span> -</pre></div> -</div> -</dd></dl> - -<dl class="method"> -<dt id="kadmos.graph.graph_kadmos.KadmosGraph.to_undirected"> -<code class="descname">to_undirected</code><span class="sig-paren">(</span><em>reciprocal=False</em>, <em>as_view=False</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_kadmos.KadmosGraph.to_undirected" title="Permalink to this definition">¶</a></dt> -<dd><p>Return an undirected representation of the digraph.</p> -<dl class="docutils"> -<dt>reciprocal <span class="classifier-delimiter">:</span> <span class="classifier">bool (optional)</span></dt> -<dd>If True only keep edges that appear in both directions -in the original digraph.</dd> -<dt>as_view <span class="classifier-delimiter">:</span> <span class="classifier">bool (optional, default=False)</span></dt> -<dd>If True return an undirected view of the original directed graph.</dd> -</dl> -<dl class="docutils"> -<dt>G <span class="classifier-delimiter">:</span> <span class="classifier">Graph</span></dt> -<dd>An undirected graph with the same name and nodes and -with edge (u, v, data) if either (u, v, data) or (v, u, data) -is in the digraph. If both edges exist in digraph and -their edge data is different, only one edge is created -with an arbitrary choice of which edge data to use. -You must check and correct for this manually if desired.</dd> -</dl> -<p>Graph, copy, add_edge, add_edges_from</p> -<p>If edges in both directions (u, v) and (v, u) exist in the -graph, attributes for the new undirected edge will be a combination of -the attributes of the directed edges. The edge data is updated -in the (arbitrary) order that the edges are encountered. For -more customized control of the edge attributes use add_edge().</p> -<p>This returns a “deepcopy†of the edge, node, and -graph attributes which attempts to completely copy -all of the data and references.</p> -<p>This is in contrast to the similar G=DiGraph(D) which returns a -shallow copy of the data.</p> -<p>See the Python copy module for more information on shallow -and deep copies, <a class="reference external" href="https://docs.python.org/2/library/copy.html">https://docs.python.org/2/library/copy.html</a>.</p> -<p>Warning: If you have subclassed DiGraph to use dict-like objects -in the data structure, those changes do not transfer to the -Graph created by this method.</p> -<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">G</span> <span class="o">=</span> <span class="n">nx</span><span class="o">.</span><span class="n">path_graph</span><span class="p">(</span><span class="mi">2</span><span class="p">)</span> <span class="c1"># or MultiGraph, etc</span> -<span class="gp">>>> </span><span class="n">H</span> <span class="o">=</span> <span class="n">G</span><span class="o">.</span><span class="n">to_directed</span><span class="p">()</span> -<span class="gp">>>> </span><span class="nb">list</span><span class="p">(</span><span class="n">H</span><span class="o">.</span><span class="n">edges</span><span class="p">)</span> -<span class="go">[(0, 1), (1, 0)]</span> -<span class="gp">>>> </span><span class="n">G2</span> <span class="o">=</span> <span class="n">H</span><span class="o">.</span><span class="n">to_undirected</span><span class="p">()</span> -<span class="gp">>>> </span><span class="nb">list</span><span class="p">(</span><span class="n">G2</span><span class="o">.</span><span class="n">edges</span><span class="p">)</span> -<span class="go">[(0, 1)]</span> -</pre></div> -</div> -</dd></dl> - -<dl class="method"> -<dt id="kadmos.graph.graph_kadmos.KadmosGraph.vistoms_add"> -<code class="descname">vistoms_add</code><span class="sig-paren">(</span><em>vistoms_dir</em>, <em>mpg=None</em>, <em>function_order=None</em>, <em>reference_file=None</em>, <em>compress=False</em>, <em>remove_after_compress=True</em>, <em>graph_id=None</em>, <em>replacement_id=None</em>, <em>xml_file=None</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_kadmos.KadmosGraph.vistoms_add" title="Permalink to this definition">¶</a></dt> -<dd><p>Function to add a graph to a existing VISTOMS instance.</p> -<p>In one VISTOMS instance different graphs can be shown. For example it is possible to include different -architectures for the same problem in one VISTOMS instance.</p> +<dt id="kadmos.graph.graph_data.DataGraph.get_coupling_matrix"> +<code class="descname">get_coupling_matrix</code><span class="sig-paren">(</span><em>function_order_method='manual'</em>, <em>node_selection=None</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.get_coupling_matrix" title="Permalink to this definition">¶</a></dt> +<dd><p>Function to determine the role of the different functions in the FPG.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple"> -<li><strong>vistoms_dir</strong> (<em>str</em>) – directory of the VISTOMS directory to be used for addition</li> -<li><strong>mpg</strong> (<a class="reference internal" href="#kadmos.graph.graph_process.MdaoProcessGraph" title="kadmos.graph.graph_process.MdaoProcessGraph"><em>MdaoProcessGraph</em></a>) – optional MPG graph to be saved with MDG as XDSM (if None a DSM is created)</li> -<li><strong>function_order</strong> (<em>list</em>) – optional function order for the diagonal of the graph (only applicable for DSMs)</li> -<li><strong>reference_file</strong> (<em>str</em>) – file from which reference values are extracted (either full path or file in same folder)</li> -<li><strong>compress</strong> (<em>bool</em>) – setting whether to compress the final VISTOMS instance folder to a zip file</li> -<li><strong>remove_after_compress</strong> (<em>bool</em>) – setting whether to remove the original folder after compression</li> -<li><strong>replacement_id</strong> (<em>basestr</em>) – indentifier of the graph to be replaced</li> -<li><strong>xml_file</strong> (<em>file</em>) – Name of the CMDOWS xml-file</li> +<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> +<li><strong>function_order_method</strong> (<em>basestring</em>) – algorithm to be used for the order in which the functions are executed.</li> +<li><strong>node_selection</strong> (<em>list</em>) – selection of nodes for which the coupling matrix will be calculated only</li> </ul> </td> </tr> +<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">graph with enriched function node attributes and function problem role dictionary</p> +</td> +</tr> +<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last"><a class="reference internal" href="#kadmos.graph.graph_data.FundamentalProblemGraph" title="kadmos.graph.graph_data.FundamentalProblemGraph">FundamentalProblemGraph</a></p> +</td> +</tr> </tbody> </table> </dd></dl> <dl class="method"> -<dt id="kadmos.graph.graph_kadmos.KadmosGraph.vistoms_create"> -<code class="descname">vistoms_create</code><span class="sig-paren">(</span><em>vistoms_dir</em>, <em>vistoms_version=None</em>, <em>mpg=None</em>, <em>function_order=None</em>, <em>reference_file=None</em>, <em>compress=False</em>, <em>remove_after_compress=True</em>, <em>graph_id=None</em>, <em>use_png_figs=False</em>, <em>file_refs=None</em>, <em>xml_file=None</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_kadmos.KadmosGraph.vistoms_create" title="Permalink to this definition">¶</a></dt> -<dd><p>Function to create a new VISTOMS instance from a graph.</p> +<dt id="kadmos.graph.graph_data.DataGraph.get_feedback_info"> +<code class="descname">get_feedback_info</code><span class="sig-paren">(</span><em>function_order</em>, <em>coupling_dict</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.get_feedback_info" title="Permalink to this definition">¶</a></dt> +<dd><p>Function to determine the number of feedback loops for a given function order</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple"> -<li><strong>vistoms_dir</strong> (<em>str</em>) – directory of the VISTOMS directory to be created</li> -<li><strong>vistoms_version</strong> – version of the VISTOMS instance to be used (as stored in the package itself)</li> -<li><strong>vispack_version</strong> – str</li> -<li><strong>mpg</strong> (<a class="reference internal" href="#kadmos.graph.graph_process.MdaoProcessGraph" title="kadmos.graph.graph_process.MdaoProcessGraph"><em>MdaoProcessGraph</em></a>) – optional MPG graph to be saved with MDG as XDSM (if None a DSM is created)</li> -<li><strong>function_order</strong> (<em>list</em>) – optional function order for the diagonal of the graph (only applicable for DSMs)</li> -<li><strong>reference_file</strong> (<em>str</em>) – file from which reference values are extracted (either full path or file in same folder)</li> -<li><strong>compress</strong> (<em>bool</em>) – setting whether to compress the final VISTOMS instance folder to a zip file</li> -<li><strong>remove_after_compress</strong> (<em>bool</em>) – setting whether to remove the original folder after compression</li> -<li><strong>graph_id</strong> (<em>basestring</em>) – identifier of the new graph</li> -<li><strong>use_png_figs</strong> (<em>bool</em>) – setting whether to use the PNG figures instead of the SVG figures for local execution</li> -<li><strong>file_refs</strong> (<em>dict</em>) – setting to provide file references manually (to use VISTOMS on a server)</li> -<li><strong>xml_file</strong> (<em>file</em>) – Name of the CMDOWS xml file</li> +<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> +<li><strong>function_order</strong> (<em>list</em>) – function order of the nodes</li> +<li><strong>coupling_dict</strong> (<em>dict</em>) – function couplings</li> </ul> </td> </tr> +<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">number of feedback loops</p> +</td> +</tr> +<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">int</p> +</td> +</tr> </tbody> </table> </dd></dl> -</dd></dl> - -</div> -<div class="section" id="datagraph"> -<h3>DataGraph<a class="headerlink" href="#datagraph" title="Permalink to this headline">¶</a></h3> -<dl class="class"> -<dt id="kadmos.graph.graph_data.DataGraph"> -<em class="property">class </em><code class="descclassname">kadmos.graph.graph_data.</code><code class="descname">DataGraph</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph" title="Permalink to this definition">¶</a></dt> -<dd><dl class="method"> -<dt id="kadmos.graph.graph_data.DataGraph.add_contact"> -<code class="descname">add_contact</code><span class="sig-paren">(</span><em>name</em>, <em>email</em>, <em>uid</em>, <em>company=None</em>, <em>department=None</em>, <em>function=None</em>, <em>address=None</em>, <em>telephone=None</em>, <em>country=None</em>, <em>roles=None</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.add_contact" title="Permalink to this definition">¶</a></dt> -<dd><p>Method to add a contact to the graph organization.</p> +<dl class="method"> +<dt id="kadmos.graph.graph_data.DataGraph.get_highest_instance"> +<code class="descname">get_highest_instance</code><span class="sig-paren">(</span><em>node</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.get_highest_instance" title="Permalink to this definition">¶</a></dt> +<dd><p>Method to get the highest instance of a node.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> -<li><strong>name</strong> (<em>str</em>) – name of the contact</li> -<li><strong>email</strong> (<em>str</em>) – email adress of the contact</li> -<li><strong>uid</strong> (<em>str</em>) – uid of the contact</li> -<li><strong>company</strong> (<em>str</em>) – company of which the contact is an employee, optional</li> -<li><strong>department</strong> (<em>str</em>) – department of company that the contact works at, optional</li> -<li><strong>function</strong> (<em>str</em>) – the function of the contact, optional</li> -<li><strong>address</strong> (<em>str</em>) – company address, optional</li> -<li><strong>telephone</strong> (<em>int</em>) – telephone number of the contact, optional</li> -<li><strong>country</strong> (<em>str</em>) – country of company, optional</li> -<li><strong>roles</strong> – organizational role(s) of contact within the project, optional</li> -</ul> -</td> +<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>node</strong> (<em>str</em>) – node</td> </tr> -<tr class="field-even field"><th class="field-name">Type:</th><td class="field-body"><p class="first last">str, list</p> -</td> +<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">highest instance of the node</td> +</tr> +<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body">int</td> </tr> </tbody> </table> -<p>Optional organizational contact roles:</p> -<ul class="simple"> -<li>‘architect’</li> -<li>‘integrator’</li> -<li>‘collaborativeEngineer’</li> -<li>‘toolSpecialist’</li> -<li>‘customer’</li> -</ul> -<p>Adding a contact with one organizational role:</p> -<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">add_contact</span><span class="p">(</span><span class="s1">'Maaike de Wit'</span><span class="p">,</span> <span class="s1">'M.D.deWit@student.tudelft.nl'</span><span class="p">,</span> <span class="s1">'mddewit'</span><span class="p">,</span> <span class="n">company</span><span class="o">=</span><span class="s1">'TU Delft'</span><span class="p">,</span> -<span class="gp">>>> </span> <span class="n">roles</span><span class="o">=</span><span class="s1">'integrator'</span><span class="p">)</span> -</pre></div> -</div> -<p>Adding a contact with two (or more) organizational roles:</p> -<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">roles</span> <span class="o">=</span> <span class="p">[</span><span class="s1">'integrator'</span><span class="p">,</span> <span class="s1">'architect'</span><span class="p">]</span> -<span class="gp">>>> </span><span class="n">add_contact</span><span class="p">(</span><span class="s1">'Maaike de Wit'</span><span class="p">,</span> <span class="s1">'M.D.deWit@student.tudelft.nl'</span><span class="p">,</span> <span class="s1">'mddewit'</span><span class="p">,</span> <span class="n">company</span><span class="o">=</span><span class="s1">'TU Delft'</span><span class="p">,</span> <span class="n">roles</span><span class="o">=</span><span class="n">roles</span><span class="p">)</span> -</pre></div> -</div> -<p>In case the contact uid already exists the old contact attributes are conserved and only new roles are added to -the roles already present for that contact. To change old contact information, this has to be adjusted in the -XML-file from which the old contact information is loaded.</p> -<p>To add (more) roles to the existing contact, it is recommended to use the method: add_contact_roles()</p> </dd></dl> <dl class="method"> -<dt id="kadmos.graph.graph_data.DataGraph.add_contact_roles"> -<code class="descname">add_contact_roles</code><span class="sig-paren">(</span><em>uid</em>, <em>roles</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.add_contact_roles" title="Permalink to this definition">¶</a></dt> -<dd><p>Method to add roles to existing contacts</p> +<dt id="kadmos.graph.graph_data.DataGraph.get_possible_function_order"> +<code class="descname">get_possible_function_order</code><span class="sig-paren">(</span><em>method</em>, <em>multi_start=None</em>, <em>check_graph=False</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.get_possible_function_order" title="Permalink to this definition">¶</a></dt> +<dd><p>Method to find a possible function order, in the order: pre-coupled, coupled, post-coupled functions</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple"> -<li><strong>uid</strong> (<em>str</em>) – uid of the contact</li> -<li><strong>roles</strong> (<em>str</em><em>, </em><em>list</em>) – organizational role(s) to be added to the existing contact</li> +<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> +<li><strong>method</strong> (<em>str</em>) – algorithm which will be used to minimize the feedback loops</li> +<li><strong>multi_start</strong> (<em>int</em>) – start the algorithm from multiple starting points</li> +<li><strong>check_graph</strong> (<em>bool</em>) – check whether graph has problematic variables</li> </ul> </td> </tr> -</tbody> -</table> -<p>Optional organizational contact roles:</p> -<ul class="simple"> -<li>‘architect’</li> -<li>‘integrator’</li> -<li>‘collaborativeEngineer’</li> -<li>‘toolSpecialist’</li> -<li>‘customer’</li> -</ul> -<p>Adding an organizational role to an existing contact:</p> -<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">add_contact</span><span class="p">(</span><span class="s1">'mddewit'</span><span class="p">,</span> <span class="n">roles</span><span class="o">=</span><span class="s1">'integrator'</span><span class="p">)</span> -</pre></div> -</div> -<p>Adding two (or more) organizational roles to an existing contact:</p> -<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">roles</span> <span class="o">=</span> <span class="p">[</span><span class="s1">'integrator'</span><span class="p">,</span> <span class="s1">'architect'</span><span class="p">]</span> -<span class="gp">>>> </span><span class="n">add_contact</span><span class="p">(</span><span class="s1">'mddewit'</span><span class="p">,</span> <span class="n">company</span><span class="o">=</span><span class="s1">'TU Delft'</span><span class="p">,</span> <span class="n">roles</span><span class="o">=</span><span class="n">roles</span><span class="p">)</span> -</pre></div> -</div> -<p>This method only works for existing contacts. To add a contact use the method: add_contact()</p> -</dd></dl> - -<dl class="method"> -<dt id="kadmos.graph.graph_data.DataGraph.add_dc_general_info"> -<code class="descname">add_dc_general_info</code><span class="sig-paren">(</span><em>dc_uid</em>, <em>description</em>, <em>status=None</em>, <em>creation_date=None</em>, <em>owner_uid=None</em>, <em>creator_uid=None</em>, <em>operator_uid=None</em>, <em>model_definition=None</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.add_dc_general_info" title="Permalink to this definition">¶</a></dt> -<dd><p>Method to add general info to a design competence</p> -<table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple"> -<li><strong>dc_uid</strong> (<em>str</em>) – uid of the design competence</li> -<li><strong>description</strong> (<em>str</em>) – description of the design competence</li> -<li><strong>status</strong> (<em>str</em>) – status of the design competence, optional</li> -<li><strong>creation_date</strong> (<em>date</em>) – creation date of the design competence, optional</li> -<li><strong>owner_uid</strong> (<em>str</em>) – uid of the owner of the design competence, optional</li> -<li><strong>creator_uid</strong> (<em>str</em>) – uid of the creator of the design competence, optional</li> -<li><strong>operator_uid</strong> (<em>str</em>) – uid of the operator of the design competence, optional</li> -<li><strong>model_definition</strong> (<em>str</em>) – model definition of the design competence, optional</li> -</ul> +<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">Possible function order</p> +</td> +</tr> +<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">list</p> </td> </tr> </tbody> @@ -3385,175 +2161,134 @@ XML-file from which the old contact information is loaded.</p> </dd></dl> <dl class="method"> -<dt id="kadmos.graph.graph_data.DataGraph.add_dc_performance_info"> -<code class="descname">add_dc_performance_info</code><span class="sig-paren">(</span><em>dc_uid</em>, <em>precision=None</em>, <em>fidelity_level=None</em>, <em>run_time=None</em>, <em>verification=None</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.add_dc_performance_info" title="Permalink to this definition">¶</a></dt> -<dd><p>Method to add performance information to a design competence</p> +<dt id="kadmos.graph.graph_data.DataGraph.mark_as_constraint"> +<code class="descname">mark_as_constraint</code><span class="sig-paren">(</span><em>node</em>, <em>operator</em>, <em>reference_value</em>, <em>remove_unused_outputs=False</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.mark_as_constraint" title="Permalink to this definition">¶</a></dt> +<dd><p>Method to mark a node as a constraint.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple"> -<li><strong>dc_uid</strong> (<em>str</em>) – uid of the design competence</li> -<li><strong>precision</strong> (<em>float</em>) – precision of the design competence, optional</li> -<li><strong>fidelity_level</strong> (<em>int</em>) – the level of fidelity of the design competence, optional</li> -<li><strong>run_time</strong> (<em>float</em>) – the run time of the design competence, optional</li> -<li><strong>verification</strong> (<em>str</em>) – verification method of the design competence, optional</li> +<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> +<li><strong>node</strong> (<em>str</em>) – node to be marked (on the left side of the operator</li> +<li><strong>operator</strong> (<em>str</em><em> or </em><em>string list</em>) – constraint operator or list of constraint operators</li> +<li><strong>reference_value</strong> (<em>numbers.Number</em><em> or </em><em>list</em>) – value on the right side of the operator or list of values corresponding to the list of +operators</li> +<li><strong>remove_unused_outputs</strong> (<em>bool</em>) – option to remove unused outputs</li> </ul> </td> </tr> +<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">graph with enriched constraint node</p> +</td> +</tr> </tbody> </table> -<p>At least one of the optional elements for the performance information has to be defined.</p> </dd></dl> <dl class="method"> -<dt id="kadmos.graph.graph_data.DataGraph.add_dc_remote_component_info"> -<code class="descname">add_dc_remote_component_info</code><span class="sig-paren">(</span><em>dc_uid</em>, <em>single_or_multi_execution</em>, <em>job_name</em>, <em>remote_engineer</em>, <em>notification_message</em>, <em>data_exchange_dict=None</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.add_dc_remote_component_info" title="Permalink to this definition">¶</a></dt> -<dd><p>Method to add execution information to a design competence</p> +<dt id="kadmos.graph.graph_data.DataGraph.mark_as_constraints"> +<code class="descname">mark_as_constraints</code><span class="sig-paren">(</span><em>nodes</em>, <em>operators</em>, <em>reference_values</em>, <em>remove_unused_outputs=False</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.mark_as_constraints" title="Permalink to this definition">¶</a></dt> +<dd><p>Method to mark multiple nodes as constraints.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple"> -<li><strong>dc_uid</strong> (<em>str</em>) – uid of the design competence</li> -<li><strong>single_or_multi_execution</strong> (<em>'single'</em><em> or </em><em>'multiple'</em>) – execution type</li> -<li><strong>job_name</strong> (<em>str</em>) – job name of the design competence</li> -<li><strong>remote_engineer</strong> (<em>str</em>) – contact uid of remote engineering of the design competence</li> -<li><strong>notification_message</strong> (<em>str</em>) – message to notify remote_engineer</li> -<li><strong>data_exchange_dict</strong> (<em>str</em>) – data exchange settings of the design competence</li> +<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> +<li><strong>nodes</strong> (<em>list</em>) – nodes to be marked.</li> +<li><strong>operators</strong> (<em>str</em><em>, </em><em>list</em>) – operators to be implemented (as list per node or as single operator for all)</li> +<li><strong>reference_values</strong> (<em>float</em><em>, </em><em>list</em>) – reference values to be used (as list of values per node or as single value for all)</li> +<li><strong>remove_unused_outputs</strong> (<em>bool</em>) – option to remove unused outputs</li> </ul> </td> </tr> +<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">graph with enriched constraint nodes</p> +</td> +</tr> </tbody> </table> -<p>Example use:</p> -<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">single_or_multi</span> <span class="o">=</span> <span class="s2">"single"</span> -<span class="gp">>>> </span><span class="n">job_name</span> <span class="o">=</span> <span class="s1">'job_</span><span class="si">{}</span><span class="s1">'</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">fpg</span><span class="o">.</span><span class="n">node</span><span class="p">[</span><span class="n">node</span><span class="p">][</span><span class="s1">'label'</span><span class="p">]</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="s1">' '</span><span class="p">,</span> <span class="s1">''</span><span class="p">))</span> -<span class="gp">>>> </span><span class="n">notification_message</span> <span class="o">=</span> <span class="s1">'Hi, could you please run this tool </span><span class="si">{}</span><span class="s1"> for me for my </span><span class="si">{}</span><span class="s1"> AGILE workflow '</span> <span class="s1">'execution. Thanks.'</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">fpg</span><span class="o">.</span><span class="n">node</span><span class="p">[</span><span class="n">node</span><span class="p">][</span><span class="s1">'label'</span><span class="p">]</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="s1">' '</span><span class="p">,</span> <span class="s1">''</span><span class="p">),</span> <span class="n">architecture</span><span class="p">)</span> -<span class="gp">>>> </span><span class="n">fpg</span><span class="o">.</span><span class="n">add_dc_remote_component_info</span><span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="n">single_or_multi</span><span class="p">,</span> <span class="n">job_name</span><span class="p">,</span> <span class="s1">'ivangent'</span><span class="p">,</span> <span class="n">notification_message</span><span class="p">,</span> -<span class="gp">>>> </span> <span class="n">data_exchange_dict</span><span class="o">=</span><span class="p">{</span><span class="s1">'urlsite'</span><span class="p">:</span> <span class="s1">'some_url'</span><span class="p">,</span> -<span class="gp">>>> </span> <span class="s1">'folder'</span><span class="p">:</span> <span class="s1">'some_folder'</span><span class="p">})</span> -</pre></div> -</div> +<p>Operators: ‘==’, ‘>’, ‘<’, ‘>=’ and ‘<=’</p> </dd></dl> <dl class="method"> -<dt id="kadmos.graph.graph_data.DataGraph.add_default_description"> -<code class="descname">add_default_description</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.add_default_description" title="Permalink to this definition">¶</a></dt> -<dd><p>Method to add a default description attribute to a graph</p> +<dt id="kadmos.graph.graph_data.DataGraph.mark_as_design_variable"> +<code class="descname">mark_as_design_variable</code><span class="sig-paren">(</span><em>node</em>, <em>lower_bound=None</em>, <em>upper_bound=None</em>, <em>samples=None</em>, <em>nominal_value=0.0</em>, <em>ignore_outdegree=False</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.mark_as_design_variable" title="Permalink to this definition">¶</a></dt> +<dd><p>Method to mark a single node as a design variable and add the required metadata for its definition.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">graph with default attribute description</td> +<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> +<li><strong>node</strong> (<em>str</em>) – node</li> +<li><strong>lower_bound</strong> (<em>float</em>) – lower bound of design variable</li> +<li><strong>upper_bound</strong> (<em>float</em>) – upper bound of design variable</li> +<li><strong>samples</strong> (<em>list</em>) – samples of design variable</li> +<li><strong>nominal_value</strong> (<em>float</em>) – nominal value of design variable</li> +<li><strong>ignore_outdegree</strong> (<em>bool</em>) – option to ignore the outdegree required</li> +</ul> +</td> </tr> -<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference internal" href="#kadmos.graph.graph_kadmos.KadmosGraph" title="kadmos.graph.graph_kadmos.KadmosGraph">KadmosGraph</a></td> +<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">graph with enriched design variable node</p> +</td> </tr> </tbody> </table> </dd></dl> <dl class="method"> -<dt id="kadmos.graph.graph_data.DataGraph.add_default_name"> -<code class="descname">add_default_name</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.add_default_name" title="Permalink to this definition">¶</a></dt> -<dd><p>Method to add a default name attribute to a graph</p> +<dt id="kadmos.graph.graph_data.DataGraph.mark_as_design_variables"> +<code class="descname">mark_as_design_variables</code><span class="sig-paren">(</span><em>nodes</em>, <em>lower_bounds=None</em>, <em>upper_bounds=None</em>, <em>samples=None</em>, <em>nominal_values=None</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.mark_as_design_variables" title="Permalink to this definition">¶</a></dt> +<dd><p>Method to mark a list of nodes as design variable and add metadata.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">graph with default attribute name</td> +<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> +<li><strong>nodes</strong> (<em>list</em><em> or </em><em>str</em>) – list of nodes present in the graph</li> +<li><strong>lower_bounds</strong> (<em>list</em><em>, </em><em>numbers.Number</em>) – list of lower bound values</li> +<li><strong>upper_bounds</strong> (<em>list</em><em>, </em><em>numbers.Number</em>) – list of upper bounds</li> +<li><strong>samples</strong> (<em>list</em>) – nested list of kadmos values</li> +<li><strong>nominal_values</strong> (<em>list</em><em>, </em><em>numbers.Number</em>) – list of nominal values</li> +</ul> +</td> </tr> -<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference internal" href="#kadmos.graph.graph_kadmos.KadmosGraph" title="kadmos.graph.graph_kadmos.KadmosGraph">KadmosGraph</a></td> +<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">graph with enriched design variable nodes</p> +</td> </tr> </tbody> </table> </dd></dl> <dl class="method"> -<dt id="kadmos.graph.graph_data.DataGraph.add_edge"> -<code class="descname">add_edge</code><span class="sig-paren">(</span><em>u</em>, <em>v</em>, <em>attr_dict=None</em>, <em>**attr</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.add_edge" title="Permalink to this definition">¶</a></dt> -<dd><p>Add an edge between u and v.</p> -<p>The nodes u and v will be automatically added if they are not already in the graph.</p> -<p>Adding an existing edge results in an update of the edge data.</p> -<p>Edge attributes can be specified with keywords or by directly accessing the edge’s attribute dictionary. -See examples below.</p> +<dt id="kadmos.graph.graph_data.DataGraph.mark_as_objective"> +<code class="descname">mark_as_objective</code><span class="sig-paren">(</span><em>node</em>, <em>remove_unused_outputs=False</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.mark_as_objective" title="Permalink to this definition">¶</a></dt> +<dd><p>Method to mark a single node as objective.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple"> -<li><strong>v</strong> (<em>u</em><em>,</em>) – nodes</li> -<li><strong>attr</strong> (<em>Edge data</em><em> (or </em><em>labels</em><em> or </em><em>objects</em><em>) </em><em>can be assigned using keyword arguments.</em>) – keyword arguments, optional</li> +<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> +<li><strong>node</strong> (<em>basestring</em>) – variable node</li> +<li><strong>remove_unused_outputs</strong> (<em>bool</em>) – option to remove unused outputs</li> </ul> </td> </tr> +<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">graph enriched with objective node</p> +</td> +</tr> </tbody> </table> -<p>The following examples both add the edge e=(1,2) to graph G:</p> -<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">G</span> <span class="o">=</span> <span class="n">nx</span><span class="o">.</span><span class="n">Graph</span><span class="p">()</span> <span class="c1"># or DiGraph, MultiGraph, MultiDiGraph, etc</span> -<span class="gp">>>> </span><span class="n">e</span> <span class="o">=</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">)</span> -<span class="gp">>>> </span><span class="n">G</span><span class="o">.</span><span class="n">add_edge</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">)</span> <span class="c1"># explicit two-node form</span> -<span class="gp">>>> </span><span class="n">G</span><span class="o">.</span><span class="n">add_edge</span><span class="p">(</span><span class="o">*</span><span class="n">e</span><span class="p">)</span> <span class="c1"># single edge as tuple of two nodes</span> -</pre></div> -</div> -<p>Many NetworkX algorithms designed for weighted graphs use an edge attribute (by default ‘weight’) to hold a -numerical value. Associate date to edge using keywords:</p> -<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">G</span><span class="o">.</span><span class="n">add_edge</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="n">weight</span><span class="o">=</span><span class="mi">3</span><span class="p">)</span> -<span class="gp">>>> </span><span class="n">G</span><span class="o">.</span><span class="n">add_edge</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="n">weight</span><span class="o">=</span><span class="mi">7</span><span class="p">,</span> <span class="n">capacity</span><span class="o">=</span><span class="mi">15</span><span class="p">,</span> <span class="n">length</span><span class="o">=</span><span class="mf">342.7</span><span class="p">)</span> -</pre></div> -</div> -<p>For non-string attribute keys, use subscript notation.</p> -<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">G</span><span class="o">.</span><span class="n">add_edge</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">)</span> -<span class="gp">>>> </span><span class="n">G</span><span class="p">[</span><span class="mi">1</span><span class="p">][</span><span class="mi">2</span><span class="p">}</span><span class="o">.</span><span class="n">update</span><span class="p">({</span><span class="mi">0</span><span class="p">:</span> <span class="mi">5</span><span class="p">})</span> -<span class="gp">>>> </span><span class="n">G</span><span class="o">.</span><span class="n">edges</span><span class="p">[</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">]</span><span class="o">.</span><span class="n">update</span><span class="p">({</span><span class="mi">0</span><span class="p">:</span> <span class="mi">5</span><span class="p">})</span> -</pre></div> -</div> -</dd></dl> - -<dl class="method"> -<dt id="kadmos.graph.graph_data.DataGraph.add_edges_from"> -<code class="descname">add_edges_from</code><span class="sig-paren">(</span><em>ebunch_to_add</em>, <em>**attr</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.add_edges_from" title="Permalink to this definition">¶</a></dt> -<dd><p>Add all the edges in ebunch_to_add.</p> -<dl class="docutils"> -<dt>ebunch_to_add <span class="classifier-delimiter">:</span> <span class="classifier">container of edges</span></dt> -<dd>Each edge given in the container will be added to the -graph. The edges must be given as 2-tuples (u, v) or -3-tuples (u, v, d) where d is a dictionary containing edge data.</dd> -<dt>attr <span class="classifier-delimiter">:</span> <span class="classifier">keyword arguments, optional</span></dt> -<dd>Edge data (or labels or objects) can be assigned using -keyword arguments.</dd> -</dl> -<p>add_edge : add a single edge -add_weighted_edges_from : convenient way to add weighted edges</p> -<p>Adding the same edge twice has no effect but any edge data -will be updated when each duplicate edge is added.</p> -<p>Edge attributes specified in an ebunch take precedence over -attributes specified via keyword arguments.</p> -<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">G</span> <span class="o">=</span> <span class="n">nx</span><span class="o">.</span><span class="n">Graph</span><span class="p">()</span> <span class="c1"># or DiGraph, MultiGraph, MultiDiGraph, etc</span> -<span class="gp">>>> </span><span class="n">G</span><span class="o">.</span><span class="n">add_edges_from</span><span class="p">([(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">)])</span> <span class="c1"># using a list of edge tuples</span> -<span class="gp">>>> </span><span class="n">e</span> <span class="o">=</span> <span class="nb">zip</span><span class="p">(</span><span class="nb">range</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">3</span><span class="p">),</span> <span class="nb">range</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">4</span><span class="p">))</span> -<span class="gp">>>> </span><span class="n">G</span><span class="o">.</span><span class="n">add_edges_from</span><span class="p">(</span><span class="n">e</span><span class="p">)</span> <span class="c1"># Add the path graph 0-1-2-3</span> -</pre></div> -</div> -<p>Associate data to edges</p> -<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">G</span><span class="o">.</span><span class="n">add_edges_from</span><span class="p">([(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">),</span> <span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">)],</span> <span class="n">weight</span><span class="o">=</span><span class="mi">3</span><span class="p">)</span> -<span class="gp">>>> </span><span class="n">G</span><span class="o">.</span><span class="n">add_edges_from</span><span class="p">([(</span><span class="mi">3</span><span class="p">,</span> <span class="mi">4</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">4</span><span class="p">)],</span> <span class="n">label</span><span class="o">=</span><span class="s1">'WN2898'</span><span class="p">)</span> -</pre></div> -</div> </dd></dl> <dl class="method"> -<dt id="kadmos.graph.graph_data.DataGraph.add_equation"> -<code class="descname">add_equation</code><span class="sig-paren">(</span><em>edge_or_node</em>, <em>equation</em>, <em>language='Python'</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.add_equation" title="Permalink to this definition">¶</a></dt> -<dd><p>Method to add an equation to an output edge.</p> +<dt id="kadmos.graph.graph_data.DataGraph.mark_as_qois"> +<code class="descname">mark_as_qois</code><span class="sig-paren">(</span><em>nodes</em>, <em>remove_unused_outputs=False</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.mark_as_qois" title="Permalink to this definition">¶</a></dt> +<dd><p>Function to mark a list of nodes as quantity of interest.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple"> -<li><strong>edge_or_node</strong> (<em>list</em><em>, </em><em>str</em>) – graph edge or node under consideration.</li> -<li><strong>equation</strong> (<em>str</em>) – equation to be added</li> -<li><strong>language</strong> (<em>str</em>) – equation language used for the equation</li> +<li><strong>nodes</strong> (<em>list</em>) – list of nodes present in the graph</li> +<li><strong>remove_unused_outputs</strong> (<em>bool</em>) – option to remove unused outputs</li> </ul> </td> </tr> @@ -3562,43 +2297,31 @@ attributes specified via keyword arguments.</p> </dd></dl> <dl class="method"> -<dt id="kadmos.graph.graph_data.DataGraph.add_equation_label"> -<code class="descname">add_equation_label</code><span class="sig-paren">(</span><em>edge</em>, <em>labeling_method='node_label'</em>, <em>language='Python'</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.add_equation_label" title="Permalink to this definition">¶</a></dt> -<dd><p>Method to add an equation label to a edge that can (safely) be used as reference in an equation.</p> +<dt id="kadmos.graph.graph_data.DataGraph.minimize_feedback"> +<code class="descname">minimize_feedback</code><span class="sig-paren">(</span><em>nodes</em>, <em>method</em>, <em>multi_start=None</em>, <em>get_evaluations=False</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.minimize_feedback" title="Permalink to this definition">¶</a></dt> +<dd><p>Function to find the function order with minimum feedback</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> -<li><strong>edge</strong> (<em>str</em>) – graph edge under consideration</li> -<li><strong>labeling_method</strong> (<em>str</em>) – select method for automatic label string determination (node_id or node_label)</li> -<li><strong>language</strong> (<em>str</em>) – equation language used for the equation label</li> +<li><strong>nodes</strong> (<em>list</em>) – nodes for which the feedback needs to be minimized</li> +<li><strong>method</strong> (<em>str</em>) – algorithm used to find optimal function order</li> +<li><strong>multi_start</strong> (<em>int</em>) – start the algorithm from multiple starting points</li> +<li><strong>get_evaluations</strong> (<em>bool</em>) – option to give the number of evaluations as output</li> </ul> </td> </tr> -<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">label</p> +<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">function order</p> </td> </tr> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">str</p> +<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first">list</p> </td> </tr> -</tbody> -</table> -</dd></dl> - -<dl class="method"> -<dt id="kadmos.graph.graph_data.DataGraph.add_equation_labels"> -<code class="descname">add_equation_labels</code><span class="sig-paren">(</span><em>nodes</em>, <em>language='Python'</em>, <em>labeling_method='node_id'</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.add_equation_labels" title="Permalink to this definition">¶</a></dt> -<dd><p>Method to add equation labels automatically to all input edges connected to the specified list of nodes</p> -<table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple"> -<li><strong>nodes</strong> (<em>list</em>) – list of nodes</li> -<li><strong>language</strong> (<em>str</em>) – equation language used for the equation label</li> -<li><strong>labeling_method</strong> (<em>str</em>) – select method for automatic label string determination (node_id or node_label)</li> -</ul> +<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">number of evaluations</p> +</td> +</tr> +<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">list</p> </td> </tr> </tbody> @@ -3606,283 +2329,143 @@ attributes specified via keyword arguments.</p> </dd></dl> <dl class="method"> -<dt id="kadmos.graph.graph_data.DataGraph.add_instance"> -<code class="descname">add_instance</code><span class="sig-paren">(</span><em>node</em>, <em>instance=None</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.add_instance" title="Permalink to this definition">¶</a></dt> -<dd><p>Method to change the instance of a node</p> +<dt id="kadmos.graph.graph_data.DataGraph.remove_unused_outputs"> +<code class="descname">remove_unused_outputs</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.remove_unused_outputs" title="Permalink to this definition">¶</a></dt> +<dd><p>Function to remove output nodes from an FPG which do not have a problem role.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple"> -<li><strong>node</strong> (<em>str</em>) – node to change the instance of</li> -<li><strong>instance</strong> (<em>int</em>) – new instance, optional (default=None)</li> -</ul> -</td> +<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">the nodes that were removed</td> +</tr> +<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">list</td> </tr> </tbody> </table> -<p>In case the default is used the instance added is the highest current instance + 1.</p> </dd></dl> <dl class="method"> -<dt id="kadmos.graph.graph_data.DataGraph.add_mathematical_function"> -<code class="descname">add_mathematical_function</code><span class="sig-paren">(</span><em>input_nodes</em>, <em>function_node</em>, <em>output_nodes</em>, <em>function_type='regular'</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.add_mathematical_function" title="Permalink to this definition">¶</a></dt> -<dd><p>Method to add mathematical function to graph</p> +<dt id="kadmos.graph.graph_data.DataGraph.sort_nodes_for_process"> +<code class="descname">sort_nodes_for_process</code><span class="sig-paren">(</span><em>nodes</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.sort_nodes_for_process" title="Permalink to this definition">¶</a></dt> +<dd><p>Method to sort function nodes such that the process order is optimized, while not increasing the number of +feedback loops</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple"> -<li><strong>input_nodes</strong> (<em>str</em><em>, </em><em>list</em>) – input nodes of the mathematical function</li> -<li><strong>function_node</strong> (<em>str</em>) – function node of the mathematical function</li> -<li><strong>output_nodes</strong> (<em>str</em><em>, </em><em>list</em>) – output nodes of the mathematical function</li> -<li><strong>function_type</strong> (<em>'regular'</em><em> or </em><em>'consistency'</em>) – type of function, optional (default=’regular’)</li> -</ul> -</td> +<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>nodes</strong> (<em>list</em>) – function nodes to sort</td> +</tr> +<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">nodes in sorted order</td> +</tr> +<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body">list</td> </tr> </tbody> </table> </dd></dl> <dl class="method"> -<dt id="kadmos.graph.graph_data.DataGraph.add_node"> -<code class="descname">add_node</code><span class="sig-paren">(</span><em>n</em>, <em>attr_dict=None</em>, <em>**attr</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.add_node" title="Permalink to this definition">¶</a></dt> -<dd><p>Add a single node and update node attributes.</p> +<dt id="kadmos.graph.graph_data.DataGraph.unmark_variable"> +<code class="descname">unmark_variable</code><span class="sig-paren">(</span><em>node</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.unmark_variable" title="Permalink to this definition">¶</a></dt> +<dd><p>Function to unmark any marked variable.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple"> -<li><strong>n</strong> (<em>A node can be any hashable Python object except None.</em>) – node</li> -<li><strong>attr_dict</strong> (<em>dict</em>) – dictionary of attribute keyword arguments.</li> -<li><strong>attr</strong> (<em>Set</em><em> or </em><em>change node attributes using attr_dict.</em>) – keyword arguments, optional</li> -</ul> -</td> +<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>node</strong> (<em>basestring</em>) – variable node to be unmarked</td> +</tr> +<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">graph with unmarked node</td> </tr> </tbody> </table> -<p>Examples:</p> -<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">G</span> <span class="o">=</span> <span class="n">nx</span><span class="o">.</span><span class="n">Graph</span><span class="p">()</span> <span class="c1"># or DiGraph, MultiGraph, MultiDiGraph, etc</span> -<span class="gp">>>> </span><span class="n">G</span><span class="o">.</span><span class="n">add_node</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span> -<span class="gp">>>> </span><span class="n">G</span><span class="o">.</span><span class="n">add_node</span><span class="p">(</span><span class="s1">'Hello'</span><span class="p">)</span> -<span class="gp">>>> </span><span class="n">K3</span> <span class="o">=</span> <span class="n">nx</span><span class="o">.</span><span class="n">Graph</span><span class="p">([(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">),</span> <span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="mi">0</span><span class="p">)])</span> -<span class="gp">>>> </span><span class="n">G</span><span class="o">.</span><span class="n">add_node</span><span class="p">(</span><span class="n">K3</span><span class="p">)</span> -<span class="gp">>>> </span><span class="n">G</span><span class="o">.</span><span class="n">number_of_nodes</span><span class="p">()</span> -</pre></div> -</div> -<p>Use keywords set/change node attributes:</p> -<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">G</span><span class="o">.</span><span class="n">add_node</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="mi">10</span><span class="p">)</span> -<span class="gp">>>> </span><span class="n">G</span><span class="o">.</span><span class="n">add_node</span><span class="p">(</span><span class="mi">3</span><span class="p">,</span> <span class="n">weight</span><span class="o">=</span><span class="mf">0.4</span><span class="p">,</span> <span class="n">UTM</span><span class="o">=</span><span class="p">(</span><span class="s1">'13S'</span><span class="p">,</span> <span class="mi">382871</span><span class="p">,</span> <span class="mi">3972649</span><span class="p">))</span> -</pre></div> -</div> -<p>Notes:</p> -<p>A hashable object is one that can be used as a key in a Python -dictionary. This includes strings, numbers, tuples of strings -and numbers, etc.</p> -<p>On many platforms hashable items also include mutables such as -NetworkX Graphs, though one should be careful that the hash -doesn’t change on mutables.</p> </dd></dl> -<dl class="method"> -<dt id="kadmos.graph.graph_data.DataGraph.add_nodes_from"> -<code class="descname">add_nodes_from</code><span class="sig-paren">(</span><em>nodes_for_adding</em>, <em>**attr</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.add_nodes_from" title="Permalink to this definition">¶</a></dt> -<dd><p>Add multiple nodes.</p> -<dl class="docutils"> -<dt>nodes_for_adding <span class="classifier-delimiter">:</span> <span class="classifier">iterable container</span></dt> -<dd>A container of nodes (list, dict, set, etc.). -OR -A container of (node, attribute dict) tuples. -Node attributes are updated using the attribute dict.</dd> -<dt>attr <span class="classifier-delimiter">:</span> <span class="classifier">keyword arguments, optional (default= no attributes)</span></dt> -<dd>Update attributes for all nodes in nodes. -Node attributes specified in nodes as a tuple take -precedence over attributes specified via keyword arguments.</dd> -</dl> -<p>add_node</p> -<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">G</span> <span class="o">=</span> <span class="n">nx</span><span class="o">.</span><span class="n">Graph</span><span class="p">()</span> <span class="c1"># or DiGraph, MultiGraph, MultiDiGraph, etc</span> -<span class="gp">>>> </span><span class="n">G</span><span class="o">.</span><span class="n">add_nodes_from</span><span class="p">(</span><span class="s1">'Hello'</span><span class="p">)</span> -<span class="gp">>>> </span><span class="n">K3</span> <span class="o">=</span> <span class="n">nx</span><span class="o">.</span><span class="n">Graph</span><span class="p">([(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">),</span> <span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="mi">0</span><span class="p">)])</span> -<span class="gp">>>> </span><span class="n">G</span><span class="o">.</span><span class="n">add_nodes_from</span><span class="p">(</span><span class="n">K3</span><span class="p">)</span> -<span class="gp">>>> </span><span class="nb">sorted</span><span class="p">(</span><span class="n">G</span><span class="o">.</span><span class="n">nodes</span><span class="p">(),</span> <span class="n">key</span><span class="o">=</span><span class="nb">str</span><span class="p">)</span> -<span class="go">[0, 1, 2, 'H', 'e', 'l', 'o']</span> -</pre></div> -</div> -<p>Use keywords to update specific node attributes for every node.</p> -<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">G</span><span class="o">.</span><span class="n">add_nodes_from</span><span class="p">([</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">],</span> <span class="n">size</span><span class="o">=</span><span class="mi">10</span><span class="p">)</span> -<span class="gp">>>> </span><span class="n">G</span><span class="o">.</span><span class="n">add_nodes_from</span><span class="p">([</span><span class="mi">3</span><span class="p">,</span> <span class="mi">4</span><span class="p">],</span> <span class="n">weight</span><span class="o">=</span><span class="mf">0.4</span><span class="p">)</span> -</pre></div> -</div> -<p>Use (node, attrdict) tuples to update attributes for specific nodes.</p> -<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">G</span><span class="o">.</span><span class="n">add_nodes_from</span><span class="p">([(</span><span class="mi">1</span><span class="p">,</span> <span class="nb">dict</span><span class="p">(</span><span class="n">size</span><span class="o">=</span><span class="mi">11</span><span class="p">)),</span> <span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="p">{</span><span class="s1">'color'</span><span class="p">:</span><span class="s1">'blue'</span><span class="p">})])</span> -<span class="gp">>>> </span><span class="n">G</span><span class="o">.</span><span class="n">nodes</span><span class="p">[</span><span class="mi">1</span><span class="p">][</span><span class="s1">'size'</span><span class="p">]</span> -<span class="go">11</span> -<span class="gp">>>> </span><span class="n">H</span> <span class="o">=</span> <span class="n">nx</span><span class="o">.</span><span class="n">Graph</span><span class="p">()</span> -<span class="gp">>>> </span><span class="n">H</span><span class="o">.</span><span class="n">add_nodes_from</span><span class="p">(</span><span class="n">G</span><span class="o">.</span><span class="n">nodes</span><span class="p">(</span><span class="n">data</span><span class="o">=</span><span class="kc">True</span><span class="p">))</span> -<span class="gp">>>> </span><span class="n">H</span><span class="o">.</span><span class="n">nodes</span><span class="p">[</span><span class="mi">1</span><span class="p">][</span><span class="s1">'size'</span><span class="p">]</span> -<span class="go">11</span> -</pre></div> -</div> </dd></dl> -<dl class="method"> -<dt id="kadmos.graph.graph_data.DataGraph.add_objective_function_by_nodes"> -<code class="descname">add_objective_function_by_nodes</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.add_objective_function_by_nodes" title="Permalink to this definition">¶</a></dt> -<dd><p>This function adds objective functions to the graph using lists of variable nodes.</p> -<p>Each list produces a separate objective function node in the graph. If the list if passed as a keyword argument, -the keyword is taken as the name of the objective function node. Otherwise, a standard name will be given to the -node. Each objective function node has one output variable, and takes the nodes given in the argument list as -input nodes.</p> -<p>If the provided nodes do not exist in the graph, a warning is given to the user on whether to continue the -addition of the objective function to the graph using valid nodes.</p> -<p>Example:</p> -<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">unnamed_function</span> <span class="o">=</span> <span class="nb">list</span><span class="p">(</span><span class="o">>></span><span class="nb">list</span> <span class="n">of</span> <span class="n">graph</span> <span class="n">nodes</span><span class="o"><<</span><span class="p">)</span> -<span class="gp">>>> </span><span class="n">named_obj_fcn</span> <span class="o">=</span> <span class="nb">list</span><span class="p">(</span><span class="o">>></span><span class="nb">list</span> <span class="n">of</span> <span class="n">graph</span> <span class="n">nodes</span><span class="o"><<</span><span class="p">)</span> -<span class="gp">>>> </span><span class="n">MyGraph</span><span class="o">.</span><span class="n">add_objective_function_by_nodes</span><span class="p">(</span><span class="n">unnamed_function</span><span class="p">,</span> <span class="n">My_obj_fcn_name</span> <span class="o">=</span> <span class="n">named_obj_fcn</span><span class="p">)</span> -</pre></div> -</div> -<p>The added objective function nodes can be queried by the attribute:</p> -<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">Graph</span><span class="o">.</span><span class="n">node</span><span class="p">[</span><span class="n">node</span><span class="p">][</span><span class="s2">"name"</span><span class="p">]</span> <span class="o">==</span> <span class="s2">"Objective"</span> -</pre></div> </div> +<div class="section" id="repositoryconnectivitygraph"> +<h3>RepositoryConnectivityGraph<a class="headerlink" href="#repositoryconnectivitygraph" title="Permalink to this headline">¶</a></h3> +<dl class="class"> +<dt id="kadmos.graph.graph_data.RepositoryConnectivityGraph"> +<em class="property">class </em><code class="descclassname">kadmos.graph.graph_data.</code><code class="descname">RepositoryConnectivityGraph</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.RepositoryConnectivityGraph" title="Permalink to this definition">¶</a></dt> +<dd><dl class="method"> +<dt id="kadmos.graph.graph_data.RepositoryConnectivityGraph.create_mathematical_problem"> +<code class="descname">create_mathematical_problem</code><span class="sig-paren">(</span><em>n_disciplines</em>, <em>coupling_strength=None</em>, <em>n_global_var=None</em>, <em>n_local_var=None</em>, <em>n_coupling_var=None</em>, <em>n_local_constraints=None</em>, <em>n_global_constraints=None</em>, <em>B=None</em>, <em>C=None</em>, <em>D=None</em>, <em>E=None</em>, <em>F=None</em>, <em>G=None</em>, <em>H=None</em>, <em>I=None</em>, <em>J=None</em>, <em>r=None</em>, <em>s=None</em>, <em>write_problem_to_textfile=False</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.RepositoryConnectivityGraph.create_mathematical_problem" title="Permalink to this definition">¶</a></dt> +<dd><p>Function to get a mathematical problem according to the variable complexity problem as described in: +Zhang D., Song B., Wang P. and He Y. ‘Performance Evaluation of MDO Architectures within a Variable +Complexity Problem’, Mathematical Problems in Engineering, 2017.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> -<li><strong>args</strong> (<em>list</em>) – list of nodes (list elements must be strings)</li> -<li><strong>kwargs</strong> (<em>list</em>) – list of nodes (list elements must be strings)</li> +<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple"> +<li><strong>n_disciplines</strong> (<em>int</em>) – Number of disciplines</li> +<li><strong>coupling_strength</strong> (<em>int</em>) – percentage of couplings, 0 no couplings, 1 all possible couplings</li> +<li><strong>n_global_var</strong> (<em>int</em>) – Number of global design variables</li> +<li><strong>n_local_var</strong> (<em>int</em>) – Number of local design variables for each discipline</li> +<li><strong>n_coupling_var</strong> (<em>int</em>) – Number of output variables for each discipline</li> +<li><strong>n_local_constraints</strong> (<em>int</em>) – Number of local constraints</li> +<li><strong>n_global_constraints</strong> (<em>int</em>) – Number of global constraints</li> +<li><strong>B</strong> – relation between the coupling variables</li> +<li><strong>C</strong> – relation between the global design variables and coupling variables</li> +<li><strong>D</strong> – relation between the local design variables and coupling variables</li> +<li><strong>E</strong> – relation between the global design variables and local constraints</li> +<li><strong>F</strong> – relation between the local design variables and local constraints</li> +<li><strong>G</strong> – relation between the coupling variables and local constraints</li> +<li><strong>H</strong> – relation between the global design variables and global constraints</li> +<li><strong>I</strong> – relation between the local design variables and global constraints</li> +<li><strong>J</strong> – relation between the coupling variables and global constraints</li> +<li><strong>r</strong> (<em>float</em>) – positive scalars to be used for the local constraints</li> +<li><strong>s</strong> (<em>float</em>) – positive scalars to be used for the global constraints</li> +<li><strong>write_problem_to_textfile</strong> (<em>bool</em>) – option to write generated problem to a textfile</li> </ul> </td> </tr> -<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">list of Objective Functions added to Graph</p> -</td> -</tr> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">list</p> -</td> -</tr> </tbody> </table> </dd></dl> <dl class="method"> -<dt id="kadmos.graph.graph_data.DataGraph.add_weighted_edges_from"> -<code class="descname">add_weighted_edges_from</code><span class="sig-paren">(</span><em>ebunch_to_add</em>, <em>weight='weight'</em>, <em>**attr</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.add_weighted_edges_from" title="Permalink to this definition">¶</a></dt> -<dd><p>Add weighted edges in <cite>ebunch_to_add</cite> with specified weight attr</p> -<dl class="docutils"> -<dt>ebunch_to_add <span class="classifier-delimiter">:</span> <span class="classifier">container of edges</span></dt> -<dd>Each edge given in the list or container will be added -to the graph. The edges must be given as 3-tuples (u, v, w) -where w is a number.</dd> -<dt>weight <span class="classifier-delimiter">:</span> <span class="classifier">string, optional (default= ‘weight’)</span></dt> -<dd>The attribute name for the edge weights to be added.</dd> -<dt>attr <span class="classifier-delimiter">:</span> <span class="classifier">keyword arguments, optional (default= no attributes)</span></dt> -<dd>Edge attributes to add/update for all edges.</dd> -</dl> -<p>add_edge : add a single edge -add_edges_from : add multiple edges</p> -<p>Adding the same edge twice for Graph/DiGraph simply updates -the edge data. For MultiGraph/MultiDiGraph, duplicate edges -are stored.</p> -<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">G</span> <span class="o">=</span> <span class="n">nx</span><span class="o">.</span><span class="n">Graph</span><span class="p">()</span> <span class="c1"># or DiGraph, MultiGraph, MultiDiGraph, etc</span> -<span class="gp">>>> </span><span class="n">G</span><span class="o">.</span><span class="n">add_weighted_edges_from</span><span class="p">([(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mf">3.0</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mf">7.5</span><span class="p">)])</span> -</pre></div> -</div> -</dd></dl> - -<dl class="attribute"> -<dt id="kadmos.graph.graph_data.DataGraph.adj"> -<code class="descname">adj</code><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.adj" title="Permalink to this definition">¶</a></dt> -<dd><p>Graph adjacency object holding the neighbors of each node.</p> -<p>This object is a read-only dict-like structure with node keys -and neighbor-dict values. The neighbor-dict is keyed by neighbor -to the edge-data-dict. So <cite>G.adj[3][2][‘color’] = ‘blue’</cite> sets -the color of the edge <cite>(3, 2)</cite> to <cite>“blueâ€</cite>.</p> -<p>Iterating over G.adj behaves like a dict. Useful idioms include -<cite>for nbr, datadict in G.adj[n].items():</cite>.</p> -<p>The neighbor information is also provided by subscripting the graph. -So <cite>for nbr, foovalue in G[node].data(‘foo’, default=1):</cite> works.</p> -<p>For directed graphs, <cite>G.adj</cite> holds outgoing (successor) info.</p> -</dd></dl> - -<dl class="method"> -<dt id="kadmos.graph.graph_data.DataGraph.adjacency"> -<code class="descname">adjacency</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.adjacency" title="Permalink to this definition">¶</a></dt> -<dd><p>Return an iterator over (node, adjacency dict) tuples for all nodes.</p> -<p>For directed graphs, only outgoing neighbors/adjacencies are included.</p> -<dl class="docutils"> -<dt>adj_iter <span class="classifier-delimiter">:</span> <span class="classifier">iterator</span></dt> -<dd>An iterator over (node, adjacency dictionary) for all nodes in -the graph.</dd> -</dl> -<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">G</span> <span class="o">=</span> <span class="n">nx</span><span class="o">.</span><span class="n">path_graph</span><span class="p">(</span><span class="mi">4</span><span class="p">)</span> <span class="c1"># or DiGraph, MultiGraph, MultiDiGraph, etc</span> -<span class="gp">>>> </span><span class="p">[(</span><span class="n">n</span><span class="p">,</span> <span class="n">nbrdict</span><span class="p">)</span> <span class="k">for</span> <span class="n">n</span><span class="p">,</span> <span class="n">nbrdict</span> <span class="ow">in</span> <span class="n">G</span><span class="o">.</span><span class="n">adjacency</span><span class="p">()]</span> -<span class="go">[(0, {1: {}}), (1, {0: {}, 2: {}}), (2, {1: {}, 3: {}}), (3, {2: {}})]</span> -</pre></div> -</div> -</dd></dl> - -<dl class="attribute"> -<dt id="kadmos.graph.graph_data.DataGraph.adjlist_inner_dict_factory"> -<code class="descname">adjlist_inner_dict_factory</code><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.adjlist_inner_dict_factory" title="Permalink to this definition">¶</a></dt> -<dd><p>alias of <code class="xref py py-class docutils literal notranslate"><span class="pre">__builtin__.dict</span></code></p> -</dd></dl> - -<dl class="attribute"> -<dt id="kadmos.graph.graph_data.DataGraph.adjlist_outer_dict_factory"> -<code class="descname">adjlist_outer_dict_factory</code><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.adjlist_outer_dict_factory" title="Permalink to this definition">¶</a></dt> -<dd><p>alias of <code class="xref py py-class docutils literal notranslate"><span class="pre">__builtin__.dict</span></code></p> -</dd></dl> - -<dl class="method"> -<dt id="kadmos.graph.graph_data.DataGraph.change_graph_class"> -<code class="descname">change_graph_class</code><span class="sig-paren">(</span><em>graph_class</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.change_graph_class" title="Permalink to this definition">¶</a></dt> -<dd><p>Method to adjust the class of a graph.</p> -</dd></dl> - -<dl class="method"> -<dt id="kadmos.graph.graph_data.DataGraph.check"> -<code class="descname">check</code><span class="sig-paren">(</span><em>raise_error=False</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.check" title="Permalink to this definition">¶</a></dt> -<dd><p>Method to check the graph for validity and completeness.</p> -<p>Several checks are performed. However the method does not guarantee the validity of the graph.</p> -<p>The checks are split into several categories and the methods _check_category_a, _check_category_b and -_check_category_c are used to determine the overall validity and completeness. These sub methods are generally -defined below and are then further refined in child classes.</p> +<dt id="kadmos.graph.graph_data.RepositoryConnectivityGraph.get_fpg_based_on_function_nodes"> +<code class="descname">get_fpg_based_on_function_nodes</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.RepositoryConnectivityGraph.get_fpg_based_on_function_nodes" title="Permalink to this definition">¶</a></dt> +<dd><p>Function to get the Fundamental Problem Graph based on a list of (or a single) function.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>raise_error</strong> (<em>bool</em>) – determines if an error should be raised in case of an invalid graph</td> +<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> +<li><strong>args</strong> (<em>str</em>) – node names of functions of interest</li> +<li><strong>kwargs</strong> (<em>name: str</em>) – name: name of the graph to be generated</li> +</ul> +</td> </tr> -<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">result of the check</td> +<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">Fundamental Problem Graph object</p> +</td> </tr> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body">bool</td> +<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last"><a class="reference internal" href="#kadmos.graph.graph_data.FundamentalProblemGraph" title="kadmos.graph.graph_data.FundamentalProblemGraph">FundamentalProblemGraph</a></p> +</td> </tr> </tbody> </table> </dd></dl> <dl class="method"> -<dt id="kadmos.graph.graph_data.DataGraph.check_cmdows_integrity"> -<code class="descname">check_cmdows_integrity</code><span class="sig-paren">(</span><em>convention=True</em>, <em>mpg=None</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.check_cmdows_integrity" title="Permalink to this definition">¶</a></dt> -<dd><p>Method to check the integrity of the CMDOWS file that can be created with the save method.</p> -<p>The integrity check is graph specific and thus needs to be executed for every graph before saving as CMDOWS if -one wants to be sure that the CMDOWS file is integer. Due to its relative long runtime this check is however not -performed automatically when using the save method.</p> +<dt id="kadmos.graph.graph_data.RepositoryConnectivityGraph.get_fpg_based_on_list_functions"> +<code class="descname">get_fpg_based_on_list_functions</code><span class="sig-paren">(</span><em>list_of_functions</em>, <em>name='FPG'</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.RepositoryConnectivityGraph.get_fpg_based_on_list_functions" title="Permalink to this definition">¶</a></dt> +<dd><p>Function to get a Fundamental Problem Graph based on a list of functions.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> -<li><strong>convention</strong> (<em>bool</em>) – option for applying a UID convention</li> -<li><strong>mpg</strong> (<a class="reference internal" href="#kadmos.graph.graph_process.MdaoProcessGraph" title="kadmos.graph.graph_process.MdaoProcessGraph"><em>MdaoProcessGraph</em></a>) – MPG to be saved together with graph</li> +<li><strong>list_of_functions</strong> (<em>list</em>) – list with strings that specify the desired functions</li> +<li><strong>name</strong> (<em>str</em>) – name of the graph to be generated</li> </ul> </td> </tr> -<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">check result</p> +<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">Fundamental Problem Graph object</p> </td> </tr> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">bool</p> +<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last"><a class="reference internal" href="#kadmos.graph.graph_data.FundamentalProblemGraph" title="kadmos.graph.graph_data.FundamentalProblemGraph">FundamentalProblemGraph</a></p> </td> </tr> </tbody> @@ -3890,25 +2473,23 @@ performed automatically when using the save method.</p> </dd></dl> <dl class="method"> -<dt id="kadmos.graph.graph_data.DataGraph.check_for_coupling"> -<code class="descname">check_for_coupling</code><span class="sig-paren">(</span><em>function_order</em>, <em>only_feedback=False</em>, <em>raise_error_if_true=False</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.check_for_coupling" title="Permalink to this definition">¶</a></dt> -<dd><p>Function to check for the presence of coupling in a graph for a list of analyses in a given analysis order.</p> -<p>Note that only the functions in the function_order list are checked for feedback.</p> +<dt id="kadmos.graph.graph_data.RepositoryConnectivityGraph.get_fpg_based_on_sinks"> +<code class="descname">get_fpg_based_on_sinks</code><span class="sig-paren">(</span><em>list_of_sinks</em>, <em>name='FPG'</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.RepositoryConnectivityGraph.get_fpg_based_on_sinks" title="Permalink to this definition">¶</a></dt> +<dd><p>Function to get the a Fundamental Problem Graph based on a list of sinks/required output variables.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> -<li><strong>function_order</strong> (<em>list</em>) – list with node names of functions</li> -<li><strong>only_feedback</strong> (<em>bool</em>) – Boolean on whether to check for feedback coupling only (this is useful for Gauss-Seidel)</li> -<li><strong>raise_error_if_true</strong> (<em>bool</em>) – Boolean on whether to raise an error if coupling exists</li> +<li><strong>list_of_sinks</strong> (<em>list</em>) – list with strings that specify the desired output</li> +<li><strong>name</strong> (<em>str</em>) – name of the graph to be generated</li> </ul> </td> </tr> -<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">Boolean value on whether coupling exists</p> +<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">Fundamental Problem Graph object</p> </td> </tr> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">bool</p> +<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last"><a class="reference internal" href="#kadmos.graph.graph_data.FundamentalProblemGraph" title="kadmos.graph.graph_data.FundamentalProblemGraph">FundamentalProblemGraph</a></p> </td> </tr> </tbody> @@ -3916,557 +2497,333 @@ performed automatically when using the save method.</p> </dd></dl> <dl class="method"> -<dt id="kadmos.graph.graph_data.DataGraph.clear"> -<code class="descname">clear</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.clear" title="Permalink to this definition">¶</a></dt> -<dd><p>Remove all nodes and edges from the graph.</p> -<p>This also removes the name, and all graph, node, and edge attributes.</p> -<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">G</span> <span class="o">=</span> <span class="n">nx</span><span class="o">.</span><span class="n">path_graph</span><span class="p">(</span><span class="mi">4</span><span class="p">)</span> <span class="c1"># or DiGraph, MultiGraph, MultiDiGraph, etc</span> -<span class="gp">>>> </span><span class="n">G</span><span class="o">.</span><span class="n">clear</span><span class="p">()</span> -<span class="gp">>>> </span><span class="nb">list</span><span class="p">(</span><span class="n">G</span><span class="o">.</span><span class="n">nodes</span><span class="p">)</span> -<span class="go">[]</span> -<span class="gp">>>> </span><span class="nb">list</span><span class="p">(</span><span class="n">G</span><span class="o">.</span><span class="n">edges</span><span class="p">)</span> -<span class="go">[]</span> -</pre></div> -</div> -</dd></dl> - -<dl class="method"> -<dt id="kadmos.graph.graph_data.DataGraph.copy"> -<code class="descname">copy</code><span class="sig-paren">(</span><em>as_view=False</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.copy" title="Permalink to this definition">¶</a></dt> -<dd><p>Return a copy of the graph.</p> -<p>The copy method by default returns a shallow copy of the graph -and attributes. That is, if an attribute is a container, that -container is shared by the original an the copy. -Use Python’s <cite>copy.deepcopy</cite> for new containers.</p> -<p>If <cite>as_view</cite> is True then a view is returned instead of a copy.</p> -<p>All copies reproduce the graph structure, but data attributes -may be handled in different ways. There are four types of copies -of a graph that people might want.</p> -<p>Deepcopy – The default behavior is a “deepcopy†where the graph -structure as well as all data attributes and any objects they might -contain are copied. The entire graph object is new so that changes -in the copy do not affect the original object. (see Python’s -copy.deepcopy)</p> -<p>Data Reference (Shallow) – For a shallow copy the graph structure -is copied but the edge, node and graph attribute dicts are -references to those in the original graph. This saves -time and memory but could cause confusion if you change an attribute -in one graph and it changes the attribute in the other. -NetworkX does not provide this level of shallow copy.</p> -<p>Independent Shallow – This copy creates new independent attribute -dicts and then does a shallow copy of the attributes. That is, any -attributes that are containers are shared between the new graph -and the original. This is exactly what <cite>dict.copy()</cite> provides. -You can obtain this style copy using:</p> -<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">G</span> <span class="o">=</span> <span class="n">nx</span><span class="o">.</span><span class="n">path_graph</span><span class="p">(</span><span class="mi">5</span><span class="p">)</span> -<span class="gp">>>> </span><span class="n">H</span> <span class="o">=</span> <span class="n">G</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span> -<span class="gp">>>> </span><span class="n">H</span> <span class="o">=</span> <span class="n">G</span><span class="o">.</span><span class="n">copy</span><span class="p">(</span><span class="n">as_view</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span> -<span class="gp">>>> </span><span class="n">H</span> <span class="o">=</span> <span class="n">nx</span><span class="o">.</span><span class="n">Graph</span><span class="p">(</span><span class="n">G</span><span class="p">)</span> -<span class="gp">>>> </span><span class="n">H</span> <span class="o">=</span> <span class="n">G</span><span class="o">.</span><span class="n">fresh_copy</span><span class="p">()</span><span class="o">.</span><span class="vm">__class__</span><span class="p">(</span><span class="n">G</span><span class="p">)</span> -</pre></div> -</div> -<p>Fresh Data – For fresh data, the graph structure is copied while -new empty data attribute dicts are created. The resulting graph -is independent of the original and it has no edge, node or graph -attributes. Fresh copies are not enabled. Instead use:</p> -<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">H</span> <span class="o">=</span> <span class="n">G</span><span class="o">.</span><span class="n">fresh_copy</span><span class="p">()</span> -<span class="gp">>>> </span><span class="n">H</span><span class="o">.</span><span class="n">add_nodes_from</span><span class="p">(</span><span class="n">G</span><span class="p">)</span> -<span class="gp">>>> </span><span class="n">H</span><span class="o">.</span><span class="n">add_edges_from</span><span class="p">(</span><span class="n">G</span><span class="o">.</span><span class="n">edges</span><span class="p">)</span> -</pre></div> -</div> -<p>View – Inspired by dict-views, graph-views act like read-only -versions of the original graph, providing a copy of the original -structure without requiring any memory for copying the information.</p> -<p>See the Python copy module for more information on shallow -and deep copies, <a class="reference external" href="https://docs.python.org/2/library/copy.html">https://docs.python.org/2/library/copy.html</a>.</p> -<dl class="docutils"> -<dt>as_view <span class="classifier-delimiter">:</span> <span class="classifier">bool, optional (default=False)</span></dt> -<dd>If True, the returned graph-view provides a read-only view -of the original graph without actually copying any data.</dd> -</dl> -<dl class="docutils"> -<dt>G <span class="classifier-delimiter">:</span> <span class="classifier">Graph</span></dt> -<dd>A copy of the graph.</dd> -</dl> -<p>to_directed: return a directed copy of the graph.</p> -<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">G</span> <span class="o">=</span> <span class="n">nx</span><span class="o">.</span><span class="n">path_graph</span><span class="p">(</span><span class="mi">4</span><span class="p">)</span> <span class="c1"># or DiGraph, MultiGraph, MultiDiGraph, etc</span> -<span class="gp">>>> </span><span class="n">H</span> <span class="o">=</span> <span class="n">G</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span> -</pre></div> -</div> +<dt id="kadmos.graph.graph_data.RepositoryConnectivityGraph.get_fpg_by_function_nodes"> +<code class="descname">get_fpg_by_function_nodes</code><span class="sig-paren">(</span><em>*args</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.RepositoryConnectivityGraph.get_fpg_by_function_nodes" title="Permalink to this definition">¶</a></dt> +<dd><p>This function creates a new (FPG)-graph based on the selected function nodes.</p> +<table class="docutils field-list" frame="void" rules="none"> +<col class="field-name" /> +<col class="field-body" /> +<tbody valign="top"> +<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>args</strong> (<em>list</em><em>, </em><em>str</em>) – arbitrary amount of graph nodes</td> +</tr> +<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">new fpg graph</td> +</tr> +<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference internal" href="#kadmos.graph.graph_data.FundamentalProblemGraph" title="kadmos.graph.graph_data.FundamentalProblemGraph">FundamentalProblemGraph</a></td> +</tr> +</tbody> +</table> </dd></dl> <dl class="method"> -<dt id="kadmos.graph.graph_data.DataGraph.copy_as"> -<code class="descname">copy_as</code><span class="sig-paren">(</span><em>graph_class</em>, <em>as_view=False</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.copy_as" title="Permalink to this definition">¶</a></dt> -<dd><p>Method to make a copy of a graph and make it into another KADMOS graph class.</p> +<dt id="kadmos.graph.graph_data.RepositoryConnectivityGraph.get_function_paths_by_objective"> +<code class="descname">get_function_paths_by_objective</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.RepositoryConnectivityGraph.get_function_paths_by_objective" title="Permalink to this definition">¶</a></dt> +<dd><p>This function takes an arbitrary amount of objective nodes as graph sinks and returns all path combinations +of tools.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">copy of the graph</td> +<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> +<li><strong>args</strong> (<em>list</em><em>, </em><em>str</em>) – arbitrary amount of objective nodes</li> +<li><strong>kwargs</strong> (<em>bool</em><em>, </em><em>str</em>) – filter options to limit possible path combinations</li> +</ul> +</td> </tr> -<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference internal" href="#kadmos.graph.graph_kadmos.KadmosGraph" title="kadmos.graph.graph_kadmos.KadmosGraph">KadmosGraph</a></td> +<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">all possible FPG path combinations for the provided objective nodes</p> +</td> </tr> </tbody> </table> +<p>If no arguments are given, user is prompted to select objectives from the graph.</p> +<div class="admonition hint"> +<p class="first admonition-title">Hint</p> +<p class="last">The tool combinations are found using the function itertools.product() and can lead to significant +computation times for large graphs. If this is the case, the user is prompted whether to continue or not.</p> +</div> +<p>A variety of filters can be applied to the search of possible tools combinations, some of which reduce the +computation time.</p> +<div class="admonition note"> +<p class="first admonition-title">Note</p> +<p>kwargs:</p> +<ul class="last simple"> +<li>obj_vars_covered - ensures that all objective variables are used in tool configurations</li> +<li>ignore_funcs - ignores functions for the config</li> +<li>source - source node; if provided, must be in config</li> +</ul> +</div> </dd></dl> <dl class="method"> -<dt id="kadmos.graph.graph_data.DataGraph.copy_edge"> -<code class="descname">copy_edge</code><span class="sig-paren">(</span><em>old_edge</em>, <em>new_edge</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.copy_edge" title="Permalink to this definition">¶</a></dt> -<dd><p>Method to copy an edge so that attributes of the old edge are maintained.</p> +<dt id="kadmos.graph.graph_data.RepositoryConnectivityGraph.get_path_combinations"> +<code class="descname">get_path_combinations</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.RepositoryConnectivityGraph.get_path_combinations" title="Permalink to this definition">¶</a></dt> +<dd><p>This function takes lists of subsets and generates all possible combinations between them.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> -<li><strong>old_edge</strong> (<em>tuple</em>) – edge to be copied</li> -<li><strong>new_edge</strong> (<em>tuple</em>) – edge to be created</li> +<li><strong>args</strong> (<em>list</em>) – lists of subsets that will be used to find configurations</li> +<li><strong>kwargs</strong> (<em>int</em>) – see optional arguments</li> </ul> </td> </tr> -<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">created edge</p> -</td> -</tr> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">tuple</p> +<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">set of all unique path combinations</p> </td> </tr> </tbody> </table> +<p>This is done by using the itertools.product() function. If the amount of expected evaluations exceeds a pre-set +minimum, the user will be asked if to continue or not; because the process can take a long time and use up many +resources.</p> +<div class="admonition note"> +<p class="first admonition-title">Note</p> +<p>Optional arguments:</p> +<ul class="last simple"> +<li>min_func: minimum amount of functions in each configuration</li> +<li>max_func: maximum amount of functions in each configuration</li> +</ul> +</div> </dd></dl> <dl class="method"> -<dt id="kadmos.graph.graph_data.DataGraph.copy_node_with_suffix"> -<code class="descname">copy_node_with_suffix</code><span class="sig-paren">(</span><em>node</em>, <em>suffix</em>, <em>label_extension</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.copy_node_with_suffix" title="Permalink to this definition">¶</a></dt> -<dd><p>Method to simply copy a node and its attributes by creating a new node with a suffix.</p> +<dt id="kadmos.graph.graph_data.RepositoryConnectivityGraph.select_function_combination_from"> +<code class="descname">select_function_combination_from</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.RepositoryConnectivityGraph.select_function_combination_from" title="Permalink to this definition">¶</a></dt> +<dd><p>This function takes all provided workflow configurations and lists them according to their characteristics.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> -<li><strong>node</strong> (<em>str</em>) – node to be copied</li> -<li><strong>suffix</strong> (<em>str</em>) – suffix to be added to the node ID</li> -<li><strong>label_extension</strong> (<em>str</em>) – extension for labels</li> -<li><strong>kwargs</strong> (<em>dict</em>) – keyword arguments will be added as node attributes</li> +<li><strong>args</strong> (<em>list</em>) – workflow configurations</li> +<li><strong>kwargs</strong> (<em>bool</em><em>, </em><em>str</em><em>, </em><em>int</em>) – see optional arguments</li> </ul> </td> </tr> -<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">new node name and enriched graph</p> +<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">sorted list of workflow configurations</p> </td> </tr> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">str</p> +<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">list</p> </td> </tr> </tbody> </table> +<div class="admonition note"> +<p class="first admonition-title">Note</p> +<p>Optional arguments:</p> +<ul class="last simple"> +<li>‘print_combos’ - option to print the combinations in a table</li> +<li>‘n_limit’ - amount of combinations that will be printed in the table</li> +<li>‘sort_by’ - characteristic to sort workflow configurations by</li> +<li>‘sort_by ascending’ - option to sort workflow configurations by ascension</li> +<li>‘plot_combos’ - option to plot the combinations in a graph</li> +</ul> +</div> +<p>The user can choose the workflow configuration from the list.</p> +<p>A warning is given to the user if the amount of total configurations exceeds n = 1e4. +Print limit is set to [0-20] by default.</p> +<div class="admonition note"> +<p class="first admonition-title">Note</p> +<p class="last">sort_by must be one of [“couplingsâ€, “system_inputsâ€, “edgesâ€, “nodesâ€].</p> +</div> </dd></dl> -<dl class="method"> -<dt id="kadmos.graph.graph_data.DataGraph.count_function_nodes"> -<code class="descname">count_function_nodes</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.count_function_nodes" title="Permalink to this definition">¶</a></dt> -<dd><p>This function counts the amount function nodes that are present in the graph.</p> +</dd></dl> + +</div> +<div class="section" id="fundamentalproblemgraph"> +<h3>FundamentalProblemGraph<a class="headerlink" href="#fundamentalproblemgraph" title="Permalink to this headline">¶</a></h3> +<dl class="class"> +<dt id="kadmos.graph.graph_data.FundamentalProblemGraph"> +<em class="property">class </em><code class="descclassname">kadmos.graph.graph_data.</code><code class="descname">FundamentalProblemGraph</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.FundamentalProblemGraph" title="Permalink to this definition">¶</a></dt> +<dd><dl class="method"> +<dt id="kadmos.graph.graph_data.FundamentalProblemGraph.add_function_problem_roles"> +<code class="descname">add_function_problem_roles</code><span class="sig-paren">(</span><em>function_order_method='manual'</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.FundamentalProblemGraph.add_function_problem_roles" title="Permalink to this definition">¶</a></dt> +<dd><p>Method to add the function problem roles (pre-coupled, coupled, post-coupled functions).</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">amount of function nodes counted in graph</td> +<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>function_order_method</strong> (<em>basestring</em>) – algorithm to be used for the order in which the functions are executed.</td> </tr> -<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">int</td> +<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">graph with problem roles added to functions</td> +</tr> +<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference internal" href="#kadmos.graph.graph_data.FundamentalProblemGraph" title="kadmos.graph.graph_data.FundamentalProblemGraph">FundamentalProblemGraph</a></td> </tr> </tbody> </table> +<p>Algorithm options:</p> +<ul class="simple"> +<li>‘manual’ - function order attributed to the problem formulation of the graph is used</li> +</ul> </dd></dl> <dl class="method"> -<dt id="kadmos.graph.graph_data.DataGraph.create_dsm"> -<code class="descname">create_dsm</code><span class="sig-paren">(</span><em>file_name</em>, <em>destination_folder=None</em>, <em>open_pdf=False</em>, <em>mpg=None</em>, <em>include_system_vars=True</em>, <em>summarize_vars=False</em>, <em>function_order=None</em>, <em>keep_tex_file=False</em>, <em>abbreviate_keywords=False</em>, <em>compile_pdf=True</em>, <em>colors_based_on='problem_roles'</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.create_dsm" title="Permalink to this definition">¶</a></dt> -<dd><p>Method to create a (X)DSM PDF file</p> +<dt id="kadmos.graph.graph_data.FundamentalProblemGraph.add_problem_formulation"> +<code class="descname">add_problem_formulation</code><span class="sig-paren">(</span><em>mdao_definition</em>, <em>function_order</em>, <em>doe_settings=None</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.FundamentalProblemGraph.add_problem_formulation" title="Permalink to this definition">¶</a></dt> +<dd><p>Method to add the problem formulation.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple"> -<li><strong>file_name</strong> (<em>str</em>) – name of the file to be saved</li> -<li><strong>destination_folder</strong> (<em>str</em>) – destination folder for the file to be saved</li> -<li><strong>open_pdf</strong> (<em>bool</em>) – option for opening the created file directly</li> -<li><strong>mpg</strong> (<a class="reference internal" href="#kadmos.graph.graph_process.MdaoProcessGraph" title="kadmos.graph.graph_process.MdaoProcessGraph"><em>MdaoProcessGraph</em></a>) – optional MPG graph to be saved with MDG as XDSM (if None a DSM is created)</li> -<li><strong>include_system_vars</strong> (<em>bool</em>) – option for including system variables (only applicable for DSMs)</li> -<li><strong>summarize_vars</strong> (<em>bool</em>) – option for summarizing label</li> -<li><strong>function_order</strong> (<em>list</em>) – optional function order for the diagonal of the graph (only applicable for DSMs)</li> -<li><strong>keep_tex_file</strong> (<em>bool</em>) – optional argument to keep the tex file of the PDF</li> -<li><strong>abbreviate_keywords</strong> (<em>bool</em>) – optional argument to keep make keywords shorter (input -> inp., output -> outp.)</li> -<li><strong>compile_pdf</strong> (<em>bool</em>) – optional argument to compile the PDF</li> -<li><strong>colors_based_on</strong> (<em>str</em>) – option to base the colors either on the problem role or the partitions</li> +<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> +<li><strong>mdao_definition</strong> (<em>str</em>) – MDF-GS, MDF-J, IDF, CO, BLIS-2000</li> +<li><strong>function_order</strong> (<em>list</em>) – order or functions to be included in graph</li> +<li><strong>doe_settings</strong> (<em>dict</em>) – doe settings of the graph</li> </ul> </td> </tr> +<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">graph enriched with problem formulation</p> +</td> +</tr> +<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">Fundamental ProblemGraph</p> +</td> +</tr> </tbody> </table> </dd></dl> <dl class="method"> -<dt id="kadmos.graph.graph_data.DataGraph.deepcopy"> -<code class="descname">deepcopy</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.deepcopy" title="Permalink to this definition">¶</a></dt> -<dd><p>Method to make a deep copy of a graph.</p> +<dt id="kadmos.graph.graph_data.FundamentalProblemGraph.check_and_get_coupled_functions_groups"> +<code class="descname">check_and_get_coupled_functions_groups</code><span class="sig-paren">(</span><em>coupled_functions_groups=None</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.FundamentalProblemGraph.check_and_get_coupled_functions_groups" title="Permalink to this definition">¶</a></dt> +<dd><p>Method to obtain the coupled functions and check them if provided</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">deepcopy of the graph</td> +<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>coupling_functions_groups</strong> (<em>list</em>) – (optional) coupled function groups</td> </tr> -<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference internal" href="#kadmos.graph.graph_kadmos.KadmosGraph" title="kadmos.graph.graph_kadmos.KadmosGraph">KadmosGraph</a></td> +<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">coupled function groups</td> +</tr> +<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body">list</td> </tr> </tbody> </table> +<p>Checks whether the function is a node of the graph with the problem role ‘coupled’</p> </dd></dl> <dl class="method"> -<dt id="kadmos.graph.graph_data.DataGraph.deepcopy_as"> -<code class="descname">deepcopy_as</code><span class="sig-paren">(</span><em>graph_class</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.deepcopy_as" title="Permalink to this definition">¶</a></dt> -<dd><p>Method to make a deep copy of a graph and make it into another KADMOS graph class.</p> +<dt id="kadmos.graph.graph_data.FundamentalProblemGraph.check_and_get_design_variables"> +<code class="descname">check_and_get_design_variables</code><span class="sig-paren">(</span><em>des_vars=None</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.FundamentalProblemGraph.check_and_get_design_variables" title="Permalink to this definition">¶</a></dt> +<dd><p>Method to obtain the design variable nodes and check them if provided</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">deepcopy of the graph</td> +<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>des_vars</strong> (<em>list</em>) – (optional) design variable nodes</td> </tr> -<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference internal" href="#kadmos.graph.graph_kadmos.KadmosGraph" title="kadmos.graph.graph_kadmos.KadmosGraph">KadmosGraph</a></td> +<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">design variable nodes</td> +</tr> +<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body">list</td> </tr> </tbody> </table> -</dd></dl> - -<dl class="attribute"> -<dt id="kadmos.graph.graph_data.DataGraph.degree"> -<code class="descname">degree</code><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.degree" title="Permalink to this definition">¶</a></dt> -<dd><p>A DegreeView for the Graph as G.degree or G.degree().</p> -<p>The node degree is the number of edges adjacent to the node. -The weighted node degree is the sum of the edge weights for -edges incident to that node.</p> -<p>This object provides an iterator for (node, degree) as well as -lookup for the degree for a single node.</p> -<dl class="docutils"> -<dt>nbunch <span class="classifier-delimiter">:</span> <span class="classifier">single node, container, or all nodes (default= all nodes)</span></dt> -<dd>The view will only report edges incident to these nodes.</dd> -<dt>weight <span class="classifier-delimiter">:</span> <span class="classifier">string or None, optional (default=None)</span></dt> -<dd>The name of an edge attribute that holds the numerical value used -as a weight. If None, then each edge has weight 1. -The degree is the sum of the edge weights adjacent to the node.</dd> -</dl> -<p>If a single node is requested -deg : int</p> -<blockquote> -<div>Degree of the node</div></blockquote> -<p>OR if multiple nodes are requested -nd_iter : iterator</p> -<blockquote> -<div>The iterator returns two-tuples of (node, degree).</div></blockquote> -<p>in_degree, out_degree</p> -<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">G</span> <span class="o">=</span> <span class="n">nx</span><span class="o">.</span><span class="n">DiGraph</span><span class="p">()</span> <span class="c1"># or MultiDiGraph</span> -<span class="gp">>>> </span><span class="n">nx</span><span class="o">.</span><span class="n">add_path</span><span class="p">(</span><span class="n">G</span><span class="p">,</span> <span class="p">[</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">])</span> -<span class="gp">>>> </span><span class="n">G</span><span class="o">.</span><span class="n">degree</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span> <span class="c1"># node 0 with degree 1</span> -<span class="go">1</span> -<span class="gp">>>> </span><span class="nb">list</span><span class="p">(</span><span class="n">G</span><span class="o">.</span><span class="n">degree</span><span class="p">([</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">]))</span> -<span class="go">[(0, 1), (1, 2), (2, 2)]</span> -</pre></div> -</div> +<p>Checks whether the function is a node of the graph with the problem role ‘design variable’</p> </dd></dl> <dl class="method"> -<dt id="kadmos.graph.graph_data.DataGraph.disconnect_problematic_variables_from"> -<code class="descname">disconnect_problematic_variables_from</code><span class="sig-paren">(</span><em>function</em>, <em>disconnect_collided_targets=True</em>, <em>disconnect_shared_sources=True</em>, <em>ignore_list=[]</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.disconnect_problematic_variables_from" title="Permalink to this definition">¶</a></dt> -<dd><p>Method to automatically disconnect certain problematic variables with respect to a given function.</p> -<p>If given as setting (disconnect_collided_targets=True) then the collided targets will be disconnected from this -function. Also, if given as setting (disconnect_shared_sources=True), shared sources are also disconnected.</p> +<dt id="kadmos.graph.graph_data.FundamentalProblemGraph.check_and_get_post_coupling_functions"> +<code class="descname">check_and_get_post_coupling_functions</code><span class="sig-paren">(</span><em>post_coupling_functions=None</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.FundamentalProblemGraph.check_and_get_post_coupling_functions" title="Permalink to this definition">¶</a></dt> +<dd><p>Method to obtain the post-coupled functions and check them if provided</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple"> -<li><strong>function</strong> (<em>basestring</em>) – function around which problematic variables are disconnected</li> -<li><strong>disconnect_collided_targets</strong> (<em>bool</em>) – setting to disconnect collided targets</li> -<li><strong>disconnect_shared_sources</strong> (<em>list</em>) – setting to disconnect shared sources</li> -<li><strong>disconnect_shared_sources</strong> – setting to ignore certain nodes</li> -</ul> -</td> +<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>post_coupling_functions</strong> (<em>list</em>) – (optional) post-coupled function nodes</td> +</tr> +<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">post-coupled function nodes</td> +</tr> +<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body">list</td> </tr> </tbody> </table> -</dd></dl> - -<dl class="attribute"> -<dt id="kadmos.graph.graph_data.DataGraph.edge_attr_dict_factory"> -<code class="descname">edge_attr_dict_factory</code><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.edge_attr_dict_factory" title="Permalink to this definition">¶</a></dt> -<dd><p>alias of <code class="xref py py-class docutils literal notranslate"><span class="pre">__builtin__.dict</span></code></p> +<p>Checks whether the function is a node of the graph with the problem role ‘post-coupled’</p> </dd></dl> <dl class="method"> -<dt id="kadmos.graph.graph_data.DataGraph.edge_subgraph"> -<code class="descname">edge_subgraph</code><span class="sig-paren">(</span><em>edges</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.edge_subgraph" title="Permalink to this definition">¶</a></dt> -<dd><p>Returns the subgraph induced by the specified edges.</p> -<p>The induced subgraph contains each edge in <cite>edges</cite> and each -node incident to any one of those edges.</p> -<dl class="docutils"> -<dt>edges <span class="classifier-delimiter">:</span> <span class="classifier">iterable</span></dt> -<dd>An iterable of edges in this graph.</dd> -</dl> -<dl class="docutils"> -<dt>G <span class="classifier-delimiter">:</span> <span class="classifier">Graph</span></dt> -<dd>An edge-induced subgraph of this graph with the same edge -attributes.</dd> -</dl> -<p>The graph, edge, and node attributes in the returned subgraph -view are references to the corresponding attributes in the original -graph. The view is read-only.</p> -<p>To create a full graph version of the subgraph with its own copy -of the edge or node attributes, use:</p> -<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">G</span><span class="o">.</span><span class="n">edge_subgraph</span><span class="p">(</span><span class="n">edges</span><span class="p">)</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span> -</pre></div> -</div> -<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">G</span> <span class="o">=</span> <span class="n">nx</span><span class="o">.</span><span class="n">path_graph</span><span class="p">(</span><span class="mi">5</span><span class="p">)</span> -<span class="gp">>>> </span><span class="n">H</span> <span class="o">=</span> <span class="n">G</span><span class="o">.</span><span class="n">edge_subgraph</span><span class="p">([(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="p">(</span><span class="mi">3</span><span class="p">,</span> <span class="mi">4</span><span class="p">)])</span> -<span class="gp">>>> </span><span class="nb">list</span><span class="p">(</span><span class="n">H</span><span class="o">.</span><span class="n">nodes</span><span class="p">)</span> -<span class="go">[0, 1, 3, 4]</span> -<span class="gp">>>> </span><span class="nb">list</span><span class="p">(</span><span class="n">H</span><span class="o">.</span><span class="n">edges</span><span class="p">)</span> -<span class="go">[(0, 1), (3, 4)]</span> -</pre></div> -</div> -</dd></dl> - -<dl class="attribute"> -<dt id="kadmos.graph.graph_data.DataGraph.edges"> -<code class="descname">edges</code><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.edges" title="Permalink to this definition">¶</a></dt> -<dd><p>An OutEdgeView of the DiGraph as G.edges or G.edges().</p> -<p>edges(self, nbunch=None, data=False, default=None)</p> -<p>The OutEdgeView provides set-like operations on the edge-tuples -as well as edge attribute lookup. When called, it also provides -an EdgeDataView object which allows control of access to edge -attributes (but does not provide set-like operations). -Hence, <cite>G.edges[u, v][‘color’]</cite> provides the value of the color -attribute for edge <cite>(u, v)</cite> while -<cite>for (u, v, c) in G.edges.data(‘color’, default=’red’):</cite> -iterates through all the edges yielding the color attribute -with default <cite>‘red’</cite> if no color attribute exists.</p> -<dl class="docutils"> -<dt>nbunch <span class="classifier-delimiter">:</span> <span class="classifier">single node, container, or all nodes (default= all nodes)</span></dt> -<dd>The view will only report edges incident to these nodes.</dd> -<dt>data <span class="classifier-delimiter">:</span> <span class="classifier">string or bool, optional (default=False)</span></dt> -<dd>The edge attribute returned in 3-tuple (u, v, ddict[data]). -If True, return edge attribute dict in 3-tuple (u, v, ddict). -If False, return 2-tuple (u, v).</dd> -<dt>default <span class="classifier-delimiter">:</span> <span class="classifier">value, optional (default=None)</span></dt> -<dd>Value used for edges that dont have the requested attribute. -Only relevant if data is not True or False.</dd> -</dl> -<dl class="docutils"> -<dt>edges <span class="classifier-delimiter">:</span> <span class="classifier">OutEdgeView</span></dt> -<dd>A view of edge attributes, usually it iterates over (u, v) -or (u, v, d) tuples of edges, but can also be used for -attribute lookup as <cite>edges[u, v][‘foo’]</cite>.</dd> -</dl> -<p>in_edges, out_edges</p> -<p>Nodes in nbunch that are not in the graph will be (quietly) ignored. -For directed graphs this returns the out-edges.</p> -<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">G</span> <span class="o">=</span> <span class="n">nx</span><span class="o">.</span><span class="n">DiGraph</span><span class="p">()</span> <span class="c1"># or MultiDiGraph, etc</span> -<span class="gp">>>> </span><span class="n">nx</span><span class="o">.</span><span class="n">add_path</span><span class="p">(</span><span class="n">G</span><span class="p">,</span> <span class="p">[</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">])</span> -<span class="gp">>>> </span><span class="n">G</span><span class="o">.</span><span class="n">add_edge</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="n">weight</span><span class="o">=</span><span class="mi">5</span><span class="p">)</span> -<span class="gp">>>> </span><span class="p">[</span><span class="n">e</span> <span class="k">for</span> <span class="n">e</span> <span class="ow">in</span> <span class="n">G</span><span class="o">.</span><span class="n">edges</span><span class="p">]</span> -<span class="go">[(0, 1), (1, 2), (2, 3)]</span> -<span class="gp">>>> </span><span class="n">G</span><span class="o">.</span><span class="n">edges</span><span class="o">.</span><span class="n">data</span><span class="p">()</span> <span class="c1"># default data is {} (empty dict)</span> -<span class="go">OutEdgeDataView([(0, 1, {}), (1, 2, {}), (2, 3, {'weight': 5})])</span> -<span class="gp">>>> </span><span class="n">G</span><span class="o">.</span><span class="n">edges</span><span class="o">.</span><span class="n">data</span><span class="p">(</span><span class="s1">'weight'</span><span class="p">,</span> <span class="n">default</span><span class="o">=</span><span class="mi">1</span><span class="p">)</span> -<span class="go">OutEdgeDataView([(0, 1, 1), (1, 2, 1), (2, 3, 5)])</span> -<span class="gp">>>> </span><span class="n">G</span><span class="o">.</span><span class="n">edges</span><span class="p">([</span><span class="mi">0</span><span class="p">,</span> <span class="mi">2</span><span class="p">])</span> <span class="c1"># only edges incident to these nodes</span> -<span class="go">OutEdgeDataView([(0, 1), (2, 3)])</span> -<span class="gp">>>> </span><span class="n">G</span><span class="o">.</span><span class="n">edges</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span> <span class="c1"># only edges incident to a single node (use G.adj[0]?)</span> -<span class="go">OutEdgeDataView([(0, 1)])</span> -</pre></div> -</div> +<dt id="kadmos.graph.graph_data.FundamentalProblemGraph.check_and_get_pre_coupling_functions"> +<code class="descname">check_and_get_pre_coupling_functions</code><span class="sig-paren">(</span><em>pre_coupling_functions=None</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.FundamentalProblemGraph.check_and_get_pre_coupling_functions" title="Permalink to this definition">¶</a></dt> +<dd><p>Method to obtain the pre-coupled functions and check them if provided</p> +<table class="docutils field-list" frame="void" rules="none"> +<col class="field-name" /> +<col class="field-body" /> +<tbody valign="top"> +<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>pre_coupling_functions</strong> (<em>list</em>) – (optional) pre-coupled function nodes</td> +</tr> +<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">pre-coupled function nodes</td> +</tr> +<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body">list</td> +</tr> +</tbody> +</table> +<p>Checks whether the function is a node of the graph with the problem role ‘pre-coupled’</p> </dd></dl> <dl class="method"> -<dt id="kadmos.graph.graph_data.DataGraph.find_all_nodes"> -<code class="descname">find_all_nodes</code><span class="sig-paren">(</span><em>category='all'</em>, <em>subcategory='all'</em>, <em>attr_cond=None</em>, <em>attr_include=None</em>, <em>attr_exclude=None</em>, <em>xpath_include=None</em>, <em>xpath_exclude=None</em>, <em>print_in_log=False</em>, <em>print_attributes='all'</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.find_all_nodes" title="Permalink to this definition">¶</a></dt> -<dd><p>Advanced search function to get nodes and their properties.</p> +<dt id="kadmos.graph.graph_data.FundamentalProblemGraph.create_mdg"> +<code class="descname">create_mdg</code><span class="sig-paren">(</span><em>mg_function_ordering</em>, <em>name='MDG'</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.FundamentalProblemGraph.create_mdg" title="Permalink to this definition">¶</a></dt> +<dd><p>Function to automatically create an MDG based on an FPG.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> -<li><strong>category</strong> (<em>str</em>) – category of the node (you can specify multiple in a list), see note for allowed values.</li> -<li><strong>subcategory</strong> (<em>str</em>) – subcategory of the node (you can specify multiple in a list), see note for allowed values.</li> -<li><strong>attr_cond</strong> (<em>list</em>) – conditional on the node attribute value (e.g. [‘execution time’,’>’,200])</li> -<li><strong>attr_include</strong> (<em>list</em>) – attributes to exclusively include in search</li> -<li><strong>attr_exclude</strong> (<em>list</em>) – attributes to exclude from search</li> -<li><strong>xpath_include</strong> (<em>list</em>) – xpaths to exclusively include in search</li> -<li><strong>xpath_exclude</strong> (<em>list</em>) – xpaths to exclude from search</li> -<li><strong>print_in_log</strong> (<em>bool</em>) – parameter to set printing in log on or off</li> -<li><strong>print_attributes</strong> (<em>str</em><em> or </em><em>list</em>) – attributes that should be printed in the log</li> +<li><strong>mg_function_ordering</strong> (<em>dict</em>) – dictionary with MDAO graph function ordering</li> +<li><strong>name</strong> (<em>basestring</em>) – name for the MDG graph</li> </ul> </td> </tr> -<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">list of all nodes that meet the search criteria</p> +<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">baseline MDG (only added additional action blocks, no changed connections)</p> </td> </tr> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">list</p> +<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">MdaoDataGraph</p> </td> </tr> </tbody> </table> -<div class="admonition note"> -<p class="first admonition-title">Note</p> -<p>The following categories are allowed:</p> -<ul class="last simple"> -<li>all</li> -<li>variable</li> -<li>variable group</li> -<li>function</li> -<li>architecture element</li> -<li>RCE component</li> -</ul> -</div> -<div class="admonition note"> -<p class="first admonition-title">Note</p> -<p>The following subcategories are allowed:</p> -<p>GROUPS:</p> -<ul class="simple"> -<li>all</li> -<li>all variables</li> -<li>all inputs</li> -<li>all outputs</li> -<li>all couplings</li> -<li>all circular variables</li> -<li>all PSG blocks</li> -<li>all iterative blocks</li> -<li>all design variables</li> -</ul> -<p>VARIABLES:</p> -<ul class="simple"> -<li>hole</li> -<li>supplied input</li> -<li>supplied shared input</li> -<li>output</li> -<li>collision</li> -<li>coupling</li> -<li>pure circular coupling</li> -<li>shared coupling</li> -<li>shared circular coupling</li> -<li>collided coupling</li> -<li>collided circular coupling</li> -<li>collided shared coupling</li> -<li>collided shared circular coupling</li> -</ul> -<p>VARIABLE GROUPS:</p> -<ul class="simple"> -<li>hole group</li> -<li>supplied input group</li> -<li>supplied shared input group</li> -<li>output group</li> -<li>coupling group</li> -<li>shared coupling group</li> -</ul> -<p>FUNCTIONS:</p> -<ul class="simple"> -<li>hole</li> -<li>inputless</li> -<li>outputless</li> -<li>complete</li> -</ul> -<p>ARCHITECTURE ELEMENTS:</p> -<p>Action blocks:</p> -<ul class="simple"> -<li>optimizer</li> -<li>MDA</li> -<li>optimizer function</li> -<li>MDA analysis</li> -<li>independent output function</li> -</ul> -<p>Parameters:</p> -<ul class="simple"> -<li>initial guess design variable</li> -<li>final design variable</li> -<li>final output variable</li> -<li>MDA coupling variable</li> -<li>initial guess MDA coupling variable</li> -<li>final MDA coupling variable</li> -<li>consistency constraint variable</li> -</ul> -<p>RCE COMPONENTS:</p> -<ul class="last simple"> -<li>Input Provider</li> -<li>XML Merger</li> -<li>XML PyMerger</li> -<li>CPACS Tool</li> -<li>Converger</li> -<li>Optimizer</li> -<li>Consistency constraint function</li> -</ul> -</div> -<p>Example usage: -Just get all nodes of a graph in a list:</p> -<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">all_nodes</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">find_all_nodes</span><span class="p">()</span> -</pre></div> -</div> -<p>Get all input nodes in a list and print them in the log as well:</p> -<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">all_nodes</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">find_all_nodes</span><span class="p">(</span><span class="n">category</span><span class="o">=</span><span class="s1">'all'</span><span class="p">,</span> <span class="n">subcategory</span><span class="o">=</span><span class="s1">'all inputs'</span><span class="p">,</span> <span class="n">print_in_log</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> -</pre></div> -</div> -<p>Get all input nodes with a certain attribute value:</p> -<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">all_nodes</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">find_all_nodes</span><span class="p">(</span><span class="n">category</span><span class="o">=</span><span class="s1">'all'</span><span class="p">,</span> <span class="n">subcategory</span><span class="o">=</span><span class="s1">'all inputs'</span><span class="p">,</span> -<span class="gp">>>> </span> <span class="n">attr_cond</span><span class="o">=</span><span class="p">[</span><span class="s1">'execution time'</span><span class="p">,</span> <span class="s1">'>'</span><span class="p">,</span> <span class="mi">5</span><span class="p">],</span> <span class="n">print_in_log</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> -</pre></div> -</div> -<p>Get all nodes with any of the listed attribute values:</p> -<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">all_nodes</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">find_all_nodes</span><span class="p">(</span><span class="n">category</span><span class="o">=</span><span class="s1">'all'</span><span class="p">,</span> <span class="n">subcategory</span><span class="o">=</span><span class="s1">'all'</span><span class="p">,</span> -<span class="gp">>>> </span> <span class="n">attr_include</span><span class="o">=</span><span class="p">[[</span><span class="s1">'problem_role'</span><span class="p">,</span> <span class="p">[</span><span class="s1">'constraint'</span><span class="p">,</span> <span class="s1">'objective'</span><span class="p">]],</span> <span class="p">[</span><span class="s1">'instance'</span><span class="p">,</span> <span class="mi">1</span><span class="p">]])</span> -</pre></div> -</div> -</dd></dl> - -<dl class="method"> -<dt id="kadmos.graph.graph_data.DataGraph.fresh_copy"> -<code class="descname">fresh_copy</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.fresh_copy" title="Permalink to this definition">¶</a></dt> -<dd><p>Return a fresh copy graph with the same data structure.</p> -<p>A fresh copy has no nodes, edges or graph attributes. It is -the same data structure as the current graph. This method is -typically used to create an empty version of the graph.</p> -<p>If you subclass the base class you should overwrite this method -to return your class of graph.</p> </dd></dl> <dl class="method"> -<dt id="kadmos.graph.graph_data.DataGraph.get_adjacency_matrix"> -<code class="descname">get_adjacency_matrix</code><span class="sig-paren">(</span><em>print_in_log=True</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.get_adjacency_matrix" title="Permalink to this definition">¶</a></dt> -<dd><p>Function to determine the adjacency matrix of a graph.</p> +<dt id="kadmos.graph.graph_data.FundamentalProblemGraph.create_mpg"> +<code class="descname">create_mpg</code><span class="sig-paren">(</span><em>mg_function_ordering</em>, <em>name='MPG'</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.FundamentalProblemGraph.create_mpg" title="Permalink to this definition">¶</a></dt> +<dd><p>Function to automatically create a MPG based on a FPG.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>print_in_log</strong> (<em>bool</em>) – option for printing the results</td> +<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> +<li><strong>mg_function_ordering</strong> (<em>dict</em>) – dictionary with MDAO graph function ordering</li> +<li><strong>name</strong> (<em>basestring</em>) – name for the MPG graph</li> +</ul> +</td> </tr> -<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">different methods of storing the same adjacency matrix in one dictionary</td> +<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">unconnected FPG (only action blocks and their diagonal position)</p> +</td> </tr> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body">dict</td> +<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last"><a class="reference internal" href="#kadmos.graph.graph_process.MdaoProcessGraph" title="kadmos.graph.graph_process.MdaoProcessGraph">MdaoProcessGraph</a></p> +</td> </tr> </tbody> </table> </dd></dl> <dl class="method"> -<dt id="kadmos.graph.graph_data.DataGraph.get_architecture_node_ids"> -<code class="descname">get_architecture_node_ids</code><span class="sig-paren">(</span><em>mdao_architecture</em>, <em>number_of_groups=None</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.get_architecture_node_ids" title="Permalink to this definition">¶</a></dt> -<dd><p>Method to get the IDs of architecture nodes specific for a certain MDAO architecture.</p> +<dt id="kadmos.graph.graph_data.FundamentalProblemGraph.determine_scope_constraint_functions"> +<code class="descname">determine_scope_constraint_functions</code><span class="sig-paren">(</span><em>cnstrnt_vars=None</em>, <em>coupled_functions_groups=None</em>, <em>post_coupling_functions=None</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.FundamentalProblemGraph.determine_scope_constraint_functions" title="Permalink to this definition">¶</a></dt> +<dd><p>Method to determine the scope (global, local) of the constraint functions based on the constraint variables +and to determine on which coupled function groups the constraint function depends.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> -<li><strong>mdao_architecture</strong> (<em>basestring</em>) – specified architecture (CO, BLISS-2000, etc)</li> -<li><strong>number_of_groups</strong> (<em>int</em><em>, </em><em>None</em>) – number of subgroups in distributed architectures</li> +<li><strong>cnstrnt_vars</strong> (<em>list</em>) – (optional) constraint variables to be determined</li> +<li><strong>coupled_functions_groups</strong> (<em>list</em>) – (optional) list of lists with coupled functions groups</li> +<li><strong>post_coupling_functions</strong> (<em>list</em>) – (optional) list with post-coupling functions</li> </ul> </td> </tr> -<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">node IDs</p> +<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">global constraint variables and functions, local constraint variables and functions, groups indices +per constraint function</p> </td> </tr> <tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">tuple</p> @@ -4477,20 +2834,22 @@ to return your class of graph.</p> </dd></dl> <dl class="method"> -<dt id="kadmos.graph.graph_data.DataGraph.get_architecture_node_labels"> -<code class="descname">get_architecture_node_labels</code><span class="sig-paren">(</span><em>mdao_architecture</em>, <em>number_of_groups=None</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.get_architecture_node_labels" title="Permalink to this definition">¶</a></dt> -<dd><p>Method to get the labels of architecture nodes specific for a certain MDAO architecture.</p> +<dt id="kadmos.graph.graph_data.FundamentalProblemGraph.determine_scope_design_variables"> +<code class="descname">determine_scope_design_variables</code><span class="sig-paren">(</span><em>des_vars=None</em>, <em>coupled_functions_groups=None</em>, <em>pre_coupling_functions=None</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.FundamentalProblemGraph.determine_scope_design_variables" title="Permalink to this definition">¶</a></dt> +<dd><p>Method to determine the scope (global, local) of the design variables and to determine to which coupled +function groups the design variable belongs.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> -<li><strong>mdao_architecture</strong> (<em>basestring</em>) – specified architecture (CO, BLISS-2000, etc)</li> -<li><strong>number_of_groups</strong> (<em>int</em><em>, </em><em>None</em>) – number of subgroups in distributed architectures</li> +<li><strong>des_vars</strong> (<em>list</em>) – list of design variables (if not given, it is taken from the graph)</li> +<li><strong>coupled_functions_groups</strong> (<em>list</em>) – list with list of coupled function groups</li> +<li><strong>pre_coupling_functions</strong> (<em>list</em>) – list with list of pre-coupled function groups</li> </ul> </td> </tr> -<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">node labels</p> +<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">list of global design variables, list of local design variables, dictionary with dependencies</p> </td> </tr> <tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">tuple</p> @@ -4501,16 +2860,20 @@ to return your class of graph.</p> </dd></dl> <dl class="method"> -<dt id="kadmos.graph.graph_data.DataGraph.get_categorized_nodes"> -<code class="descname">get_categorized_nodes</code><span class="sig-paren">(</span><em>print_in_log=False</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.get_categorized_nodes" title="Permalink to this definition">¶</a></dt> -<dd><p>Function that returns a dictionary with graph nodes grouped according to category and subcategory.</p> +<dt id="kadmos.graph.graph_data.FundamentalProblemGraph.get_group_couplings"> +<code class="descname">get_group_couplings</code><span class="sig-paren">(</span><em>coupled_functions_groups=None</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.FundamentalProblemGraph.get_group_couplings" title="Permalink to this definition">¶</a></dt> +<dd><p>Method to obtain group couplings and their indices.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>print_in_log</strong> (<em>bool</em>) – option for printing the categories</td> +<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>coupled_functions_groups</strong> (<em>list</em>) – (optional) list of coupled function groups</td> </tr> -<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">dictionary with analysis results</td> +<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">group couplings present</td> +</tr> +<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body">list</td> +</tr> +<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">index of coupled groups</td> </tr> <tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body">dict</td> </tr> @@ -4519,2453 +2882,142 @@ to return your class of graph.</p> </dd></dl> <dl class="method"> -<dt id="kadmos.graph.graph_data.DataGraph.get_contracted_graph"> -<code class="descname">get_contracted_graph</code><span class="sig-paren">(</span><em>contraction_level</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.get_contracted_graph" title="Permalink to this definition">¶</a></dt> -<dd><p>This function contracts the nodes of a graph to the provided contraction level.</p> -<p>The contraction level refers to the xpath-level, which represents the position of the descendant with respect -to its predecessors. The example below represents a level 3 node, with “cpacs†being at level zero.</p> -<p>/cpacs/aircraft/wings/wing</p> -<p>–cpacs</p> -<p>—-aircraft</p> -<p>——–wings</p> -<p>————wing</p> -<p>All nodes above the contraction level are removed from the graph and replaced by a “variable group†node, which -groups the removed nodes in a node at contraction level. This allows for a “de-cluttering†of the graph, with -the graph connections still being represented.</p> +<dt id="kadmos.graph.graph_data.FundamentalProblemGraph.get_mdg"> +<code class="descname">get_mdg</code><span class="sig-paren">(</span><em>name='MDG'</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.FundamentalProblemGraph.get_mdg" title="Permalink to this definition">¶</a></dt> +<dd><p>Create the MDAO data graph for a given FPG.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>contraction_level</strong> (<em>int</em>) – from 0 (highest level) to X (lowest level existing in XML schema)</td> +<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>name</strong> (<em>basestring</em>) – name of the new graph</td> </tr> -<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">contracted_graph: graph with contracted nodes</td> +<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">MDAO data graph</td> +</tr> +<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body">MdaoDataGraph</td> </tr> </tbody> </table> </dd></dl> <dl class="method"> -<dt id="kadmos.graph.graph_data.DataGraph.get_coupling_matrix"> -<code class="descname">get_coupling_matrix</code><span class="sig-paren">(</span><em>function_order_method='manual'</em>, <em>node_selection=None</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.get_coupling_matrix" title="Permalink to this definition">¶</a></dt> -<dd><p>Function to determine the role of the different functions in the FPG.</p> +<dt id="kadmos.graph.graph_data.FundamentalProblemGraph.get_mg_function_ordering"> +<code class="descname">get_mg_function_ordering</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.FundamentalProblemGraph.get_mg_function_ordering" title="Permalink to this definition">¶</a></dt> +<dd><p>Method to determine the function ordering for MDAO graphs (FPG and MDG) based on an FPG.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> -<li><strong>function_order_method</strong> (<em>basestring</em>) – algorithm to be used for the order in which the functions are executed.</li> -<li><strong>node_selection</strong> (<em>list</em>) – selection of nodes for which the coupling matrix will be calculated only</li> -</ul> -</td> -</tr> -<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">graph with enriched function node attributes and function problem role dictionary</p> -</td> -</tr> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last"><a class="reference internal" href="#kadmos.graph.graph_data.FundamentalProblemGraph" title="kadmos.graph.graph_data.FundamentalProblemGraph">FundamentalProblemGraph</a></p> -</td> -</tr> -</tbody> -</table> -</dd></dl> - -<dl class="method"> -<dt id="kadmos.graph.graph_data.DataGraph.get_direct_coupling_nodes"> -<code class="descname">get_direct_coupling_nodes</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.get_direct_coupling_nodes" title="Permalink to this definition">¶</a></dt> -<dd><p>This method returns the direct couplings between two nodes in a graph.</p> -<p>This method is specifically written (and tested) with function nodes in mind. Direct coupling is defined as -coupling with between two nodes through a third node.</p> -<p>In this function, each combination between the provided arguments is tested for couplings (in pairs). First, -the two nodes in each pair are checked for common neighbors. If they do, the edges of the common neighbors are -iterated to determine whether the node-pair is connected to each other, or only the neighbor. The direction of -the coupling is also checked.</p> -<p>Example:</p> -<p>The connection:</p> -<p>F1 => N1 => F2</p> -<p>leads to:</p> -<p>[(F1, F2, N1)]</p> -<table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> -<li><strong>args</strong> (<em>str</em><em>, </em><em>list</em>) – nodes to be checked for couplings; at least two must be provided</li> -<li><strong>kwargs</strong> (<em>direction: str</em>) – print_couplings: option for printing all couplings with coupling direction and node (optional)</li> -<li><strong>kwargs</strong> – direction: set only coupling in certain direction (optional)</li> -</ul> -</td> -</tr> -<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">couplings: list of tuples containing the coupled nodes and the coupling node</p> -</td> -</tr> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">list</p> -</td> -</tr> -</tbody> -</table> -</dd></dl> - -<dl class="method"> -<dt id="kadmos.graph.graph_data.DataGraph.get_edge_data"> -<code class="descname">get_edge_data</code><span class="sig-paren">(</span><em>u</em>, <em>v</em>, <em>default=None</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.get_edge_data" title="Permalink to this definition">¶</a></dt> -<dd><p>Return the attribute dictionary associated with edge (u, v).</p> -<p>This is identical to <cite>G[u][v]</cite> except the default is returned -instead of an exception is the edge doesn’t exist.</p> -<p>u, v : nodes -default: any Python object (default=None)</p> -<blockquote> -<div>Value to return if the edge (u, v) is not found.</div></blockquote> -<dl class="docutils"> -<dt>edge_dict <span class="classifier-delimiter">:</span> <span class="classifier">dictionary</span></dt> -<dd>The edge attribute dictionary.</dd> -</dl> -<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">G</span> <span class="o">=</span> <span class="n">nx</span><span class="o">.</span><span class="n">path_graph</span><span class="p">(</span><span class="mi">4</span><span class="p">)</span> <span class="c1"># or DiGraph, MultiGraph, MultiDiGraph, etc</span> -<span class="gp">>>> </span><span class="n">G</span><span class="p">[</span><span class="mi">0</span><span class="p">][</span><span class="mi">1</span><span class="p">]</span> -<span class="go">{}</span> -</pre></div> -</div> -<p>Warning: Assigning to <cite>G[u][v]</cite> is not permitted. -But it is safe to assign attributes <cite>G[u][v][‘foo’]</cite></p> -<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">G</span><span class="p">[</span><span class="mi">0</span><span class="p">][</span><span class="mi">1</span><span class="p">][</span><span class="s1">'weight'</span><span class="p">]</span> <span class="o">=</span> <span class="mi">7</span> -<span class="gp">>>> </span><span class="n">G</span><span class="p">[</span><span class="mi">0</span><span class="p">][</span><span class="mi">1</span><span class="p">][</span><span class="s1">'weight'</span><span class="p">]</span> -<span class="go">7</span> -<span class="gp">>>> </span><span class="n">G</span><span class="p">[</span><span class="mi">1</span><span class="p">][</span><span class="mi">0</span><span class="p">][</span><span class="s1">'weight'</span><span class="p">]</span> -<span class="go">7</span> -</pre></div> -</div> -<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">G</span> <span class="o">=</span> <span class="n">nx</span><span class="o">.</span><span class="n">path_graph</span><span class="p">(</span><span class="mi">4</span><span class="p">)</span> <span class="c1"># or DiGraph, MultiGraph, MultiDiGraph, etc</span> -<span class="gp">>>> </span><span class="n">G</span><span class="o">.</span><span class="n">get_edge_data</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span> <span class="c1"># default edge data is {}</span> -<span class="go">{}</span> -<span class="gp">>>> </span><span class="n">e</span> <span class="o">=</span> <span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span> -<span class="gp">>>> </span><span class="n">G</span><span class="o">.</span><span class="n">get_edge_data</span><span class="p">(</span><span class="o">*</span><span class="n">e</span><span class="p">)</span> <span class="c1"># tuple form</span> -<span class="go">{}</span> -<span class="gp">>>> </span><span class="n">G</span><span class="o">.</span><span class="n">get_edge_data</span><span class="p">(</span><span class="s1">'a'</span><span class="p">,</span> <span class="s1">'b'</span><span class="p">,</span> <span class="n">default</span><span class="o">=</span><span class="mi">0</span><span class="p">)</span> <span class="c1"># edge not in graph, return 0</span> -<span class="go">0</span> -</pre></div> -</div> -</dd></dl> - -<dl class="method"> -<dt id="kadmos.graph.graph_data.DataGraph.get_feedback_info"> -<code class="descname">get_feedback_info</code><span class="sig-paren">(</span><em>function_order</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.get_feedback_info" title="Permalink to this definition">¶</a></dt> -<dd><p>Function to determine the number of feedback loops for a given function order</p> -<table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>function_order</strong> (<em>list</em>) – function order of the nodes</td> -</tr> -<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">number of feedback loops</td> -</tr> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body">int</td> -</tr> -</tbody> -</table> -</dd></dl> - -<dl class="method"> -<dt id="kadmos.graph.graph_data.DataGraph.get_first_node_instance"> -<code class="descname">get_first_node_instance</code><span class="sig-paren">(</span><em>node</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.get_first_node_instance" title="Permalink to this definition">¶</a></dt> -<dd><p>Method to obtain the first instance of a node</p> -<table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>node</strong> (<em>str</em>) – node to find first instance of</td> -</tr> -<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">node of first instance</td> -</tr> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body">str</td> -</tr> -</tbody> -</table> -</dd></dl> - -<dl class="method"> -<dt id="kadmos.graph.graph_data.DataGraph.get_function_graph"> -<code class="descname">get_function_graph</code><span class="sig-paren">(</span><em>keep_objective_variables=False</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.get_function_graph" title="Permalink to this definition">¶</a></dt> -<dd><p>Method for replacing variable nodes by function connections.</p> -<p>This function removes all variable nodes from the graph and replaces the variable connections of each function -with function connections, such that:</p> -<p>F(1) => N(1) => F(2) => N(2) => F(3)</p> -<p>becomes:</p> -<p>F(1) => F(2) => F(3)</p> -<p>Note: N(i) is a variable node, and F(i) a function node.</p> -<table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Param:</th><td class="field-body">keep_objective_variables: if given the objective variables will remain in graph</td> -</tr> -<tr class="field-even field"><th class="field-name">Type:</th><td class="field-body">keep_objective_variables: bool</td> -</tr> -<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">new graph without variable nodes</td> -</tr> -</tbody> -</table> -</dd></dl> - -<dl class="method"> -<dt id="kadmos.graph.graph_data.DataGraph.get_function_metadata"> -<code class="descname">get_function_metadata</code><span class="sig-paren">(</span><em>node</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.get_function_metadata" title="Permalink to this definition">¶</a></dt> -<dd><p>Function to get the node metadata in a list (used in the dynamic visualization package).</p> -<table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>node</strong> (<em>basestring</em>) – function node to collect the metadata for.</td> -</tr> -<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">list with metadata</td> -</tr> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body">list</td> -</tr> -</tbody> -</table> -</dd></dl> - -<dl class="method"> -<dt id="kadmos.graph.graph_data.DataGraph.get_function_nodes"> -<code class="descname">get_function_nodes</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.get_function_nodes" title="Permalink to this definition">¶</a></dt> -<dd><p>This function returns a list of all function nodes in the graph.</p> -</dd></dl> - -<dl class="method"> -<dt id="kadmos.graph.graph_data.DataGraph.get_graph_properties"> -<code class="descname">get_graph_properties</code><span class="sig-paren">(</span><em>*args</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.get_graph_properties" title="Permalink to this definition">¶</a></dt> -<dd><p>This function retrieves the properties of a graph.</p> -<p>If no argument is given, the standard list of properties GRAPH_PROPERTIES is analyzed and their values are -returned in a dict. If arguments are given, only this list will be used as standard list of properties.</p> -<table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Param:</th><td class="field-body">args: specific properties to be retrieved (optional)</td> -</tr> -<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">dictionary containing the properties of the graph</td> -</tr> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body">dict</td> -</tr> -</tbody> -</table> -</dd></dl> - -<dl class="method"> -<dt id="kadmos.graph.graph_data.DataGraph.get_node_attributes"> -<code class="descname">get_node_attributes</code><span class="sig-paren">(</span><em>node</em>, <em>attr_list</em>, <em>print_in_log=False</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.get_node_attributes" title="Permalink to this definition">¶</a></dt> -<dd><p>Function to get and print certain attributes of a node from the graph.</p> -<table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> -<li><strong>node</strong> (<em>str</em>) – node name</li> -<li><strong>attr_list</strong> (<em>list</em>) – list with attributes to be pulled</li> -<li><strong>print_in_log</strong> (<em>bool</em>) – option for printing to log</li> -</ul> -</td> -</tr> -<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">dictionary with node attributes</p> -</td> -</tr> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">dict</p> -</td> -</tr> -</tbody> -</table> -</dd></dl> - -<dl class="method"> -<dt id="kadmos.graph.graph_data.DataGraph.get_node_subcategory"> -<code class="descname">get_node_subcategory</code><span class="sig-paren">(</span><em>node</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.get_node_subcategory" title="Permalink to this definition">¶</a></dt> -<dd><p>Method to analyse a node and to update the subcategory attribute of the node.</p> -<p>The following table illustrates how the subcategory is determined based on the category, indegree and outdegree:</p> -<table border="1" class="docutils"> -<colgroup> -<col width="25%" /> -<col width="47%" /> -<col width="13%" /> -<col width="15%" /> -</colgroup> -<thead valign="bottom"> -<tr class="row-odd"><th class="head">NODE CATEGORY</th> -<th class="head">SUBCATEGORY</th> -<th class="head">INDEGREE</th> -<th class="head">OUTDEGREE</th> -</tr> -</thead> -<tbody valign="top"> -<tr class="row-even"><td rowspan="9">variable</td> -<td>hole</td> -<td>0</td> -<td>0</td> -</tr> -<tr class="row-odd"><td>supplied input</td> -<td>0</td> -<td>1</td> -</tr> -<tr class="row-even"><td>supplied shared input</td> -<td>0</td> -<td>>1</td> -</tr> -<tr class="row-odd"><td>output</td> -<td>1</td> -<td>0</td> -</tr> -<tr class="row-even"><td>collision</td> -<td>>1</td> -<td>0</td> -</tr> -<tr class="row-odd"><td>coupling -or -pure circular coupling</td> -<td>1</td> -<td>1</td> -</tr> -<tr class="row-even"><td>shared coupling -or -shared circular coupling</td> -<td>1</td> -<td>>1</td> -</tr> -<tr class="row-odd"><td>collided coupling -or -collided circular coupling</td> -<td>>1</td> -<td>1</td> -</tr> -<tr class="row-even"><td>collided shared coupling -or -collided shared circular coupling</td> -<td>>1</td> -<td>>1</td> -</tr> -<tr class="row-odd"><td rowspan="4">function</td> -<td>hole</td> -<td>0</td> -<td>0</td> -</tr> -<tr class="row-even"><td>inputless</td> -<td>0</td> -<td>>0</td> -</tr> -<tr class="row-odd"><td>outputless</td> -<td>>0</td> -<td>0</td> -</tr> -<tr class="row-even"><td>complete</td> -<td>>0</td> -<td>>0</td> -</tr> -</tbody> -</table> -<table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>node</strong> (<em>basestring</em>) – node in the graph</td> -</tr> -<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">subcategory of the node</td> -</tr> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body">basestring</td> -</tr> -</tbody> -</table> -</dd></dl> - -<dl class="method"> -<dt id="kadmos.graph.graph_data.DataGraph.get_nodes_based_on_strings"> -<code class="descname">get_nodes_based_on_strings</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.get_nodes_based_on_strings" title="Permalink to this definition">¶</a></dt> -<dd><p>This function enables the user to search graph nodes for specific strings.</p> -<p>Each provided string will be searched for, and if multiple node are found for each string, the user will be able -to select the ones desired. The other matched nodes are disregarded.</p> -<table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> -<li><strong>args</strong> (<em>str</em>) – strings that graph nodes being searched for</li> -<li><strong>kwargs</strong> (<em>include_all: bool</em>) – include_all: If include_all is set to True, all matching nodes are added to returned list</li> -</ul> -</td> -</tr> -<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">matching nodes that user selected (all if include_all is True)</p> -</td> -</tr> -</tbody> -</table> -</dd></dl> - -<dl class="method"> -<dt id="kadmos.graph.graph_data.DataGraph.get_nodes_indegree"> -<code class="descname">get_nodes_indegree</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.get_nodes_indegree" title="Permalink to this definition">¶</a></dt> -<dd><p>Function to get the indegree of all the graph nodes and store them in a dictionary.</p> -<table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">dictionary with node name key and indegree integer value.</td> -</tr> -<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">dict</td> -</tr> -</tbody> -</table> -</dd></dl> - -<dl class="method"> -<dt id="kadmos.graph.graph_data.DataGraph.get_nodes_outdegree"> -<code class="descname">get_nodes_outdegree</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.get_nodes_outdegree" title="Permalink to this definition">¶</a></dt> -<dd><p>Function to get the outdegree of all the graph nodes and store them in a dictionary.</p> -<table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">dictionary with node name key and outdegree integer value.</td> -</tr> -<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">dict</td> -</tr> -</tbody> -</table> -</dd></dl> - -<dl class="method"> -<dt id="kadmos.graph.graph_data.DataGraph.get_nodes_subcategory"> -<code class="descname">get_nodes_subcategory</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.get_nodes_subcategory" title="Permalink to this definition">¶</a></dt> -<dd><p>Method to analyse all nodes and to update the subcategory attributes of the nodes.</p> -</dd></dl> - -<dl class="method"> -<dt id="kadmos.graph.graph_data.DataGraph.get_number_of_couplings"> -<code class="descname">get_number_of_couplings</code><span class="sig-paren">(</span><em>node</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.get_number_of_couplings" title="Permalink to this definition">¶</a></dt> -<dd><p>This function returns the number of couplings of a node in the graph.</p> -<table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>node</strong> – input node</td> -</tr> -<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">number of couplings for the input node</td> -</tr> -<tr class="field-odd field"><th class="field-name">Type:</th><td class="field-body">int</td> -</tr> -</tbody> -</table> -</dd></dl> - -<dl class="method"> -<dt id="kadmos.graph.graph_data.DataGraph.get_possible_function_order"> -<code class="descname">get_possible_function_order</code><span class="sig-paren">(</span><em>method</em>, <em>multi_start=None</em>, <em>check_graph=False</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.get_possible_function_order" title="Permalink to this definition">¶</a></dt> -<dd><p>Method to find a possible function order, in the order: pre-coupled, coupled, post-coupled functions</p> -<table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> -<li><strong>method</strong> (<em>str</em>) – algorithm which will be used to minimize the feedback loops</li> -<li><strong>multi_start</strong> (<em>int</em>) – start the algorithm from multiple starting points</li> -<li><strong>check_graph</strong> (<em>bool</em>) – check whether graph has problematic variables</li> -</ul> -</td> -</tr> -<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">Possible function order</p> -</td> -</tr> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">list</p> -</td> -</tr> -</tbody> -</table> -</dd></dl> - -<dl class="method"> -<dt id="kadmos.graph.graph_data.DataGraph.get_same_graph_class"> -<code class="descname">get_same_graph_class</code><span class="sig-paren">(</span><em>graph</em>, <em>copy_type='deep'</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.get_same_graph_class" title="Permalink to this definition">¶</a></dt> -<dd><p>Method to reinstantiate a given graph according to the same graph class as the self.</p> -<table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> -<li><strong>graph</strong> (<em>DiGraph</em>) – graph object to be reinstantiated</li> -<li><strong>copy_type</strong> (<em>basestring</em>) – setting to have a deep or shallow copy of the graph</li> -</ul> -</td> -</tr> -<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">reinstantiated graph</p> -</td> -</tr> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last"><a class="reference internal" href="#kadmos.graph.graph_kadmos.KadmosGraph" title="kadmos.graph.graph_kadmos.KadmosGraph">KadmosGraph</a></p> -</td> -</tr> -</tbody> -</table> -</dd></dl> - -<dl class="method"> -<dt id="kadmos.graph.graph_data.DataGraph.get_sources"> -<code class="descname">get_sources</code><span class="sig-paren">(</span><em>node</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.get_sources" title="Permalink to this definition">¶</a></dt> -<dd><p>Function to determine the sources of a given node.</p> -<table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>node</strong> (<em>basestring</em>) – node for which sources should be found</td> -</tr> -<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">list with sources</td> -</tr> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body">list</td> -</tr> -</tbody> -</table> -</dd></dl> - -<dl class="method"> -<dt id="kadmos.graph.graph_data.DataGraph.get_subgraph_by_function_nodes"> -<code class="descname">get_subgraph_by_function_nodes</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.get_subgraph_by_function_nodes" title="Permalink to this definition">¶</a></dt> -<dd><p>This function retrieves a subgraph from the original graph only containing the argument nodes.</p> -<p>All arguments must be found in the graph.</p> -<table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> -<li><strong>args</strong> (<em>list</em><em>, </em><em>str</em>) – arbitrary amount of graph nodes</li> -<li><strong>kwargs</strong> (<em>copy_type: str</em>) – copy_type: type of copy (clean or deep)</li> -</ul> -</td> -</tr> -<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">sub-graph only containing nodes provided as arguments, and their edges</p> -</td> -</tr> -</tbody> -</table> -</dd></dl> - -<dl class="method"> -<dt id="kadmos.graph.graph_data.DataGraph.get_system_inputs"> -<code class="descname">get_system_inputs</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.get_system_inputs" title="Permalink to this definition">¶</a></dt> -<dd><p>This method checks whether there are system inputs in the graph using the function nodes provided.</p> -<p>The function nodes should be provided in the args. If system inputs exist they are returned.</p> -<table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>args</strong> – function nodes</td> -</tr> -<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">system input nodes dictionary</td> -</tr> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body">dict</td> -</tr> -</tbody> -</table> -</dd></dl> - -<dl class="method"> -<dt id="kadmos.graph.graph_data.DataGraph.get_targets"> -<code class="descname">get_targets</code><span class="sig-paren">(</span><em>node</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.get_targets" title="Permalink to this definition">¶</a></dt> -<dd><p>Function to determine the targets of a given node.</p> -<table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>node</strong> (<em>basestring</em>) – node for which targets should be found</td> -</tr> -<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">list with targets</td> -</tr> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body">list</td> -</tr> -</tbody> -</table> -</dd></dl> - -<dl class="method"> -<dt id="kadmos.graph.graph_data.DataGraph.graph_has_nested_attributes"> -<code class="descname">graph_has_nested_attributes</code><span class="sig-paren">(</span><em>*attrbs</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.graph_has_nested_attributes" title="Permalink to this definition">¶</a></dt> -<dd><p>Method to test if graph has nested attributes</p> -<table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>attrbs</strong> (<em>str</em>) – attributes to check for nesting in graph</td> -</tr> -<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">presence of nested attribute</td> -</tr> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body">bool</td> -</tr> -</tbody> -</table> -</dd></dl> - -<dl class="method"> -<dt id="kadmos.graph.graph_data.DataGraph.has_edge"> -<code class="descname">has_edge</code><span class="sig-paren">(</span><em>u</em>, <em>v</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.has_edge" title="Permalink to this definition">¶</a></dt> -<dd><p>Return True if the edge (u, v) is in the graph.</p> -<p>This is the same as <cite>v in G[u]</cite> without KeyError exceptions.</p> -<dl class="docutils"> -<dt>u, v <span class="classifier-delimiter">:</span> <span class="classifier">nodes</span></dt> -<dd>Nodes can be, for example, strings or numbers. -Nodes must be hashable (and not None) Python objects.</dd> -</dl> -<dl class="docutils"> -<dt>edge_ind <span class="classifier-delimiter">:</span> <span class="classifier">bool</span></dt> -<dd>True if edge is in the graph, False otherwise.</dd> -</dl> -<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">G</span> <span class="o">=</span> <span class="n">nx</span><span class="o">.</span><span class="n">path_graph</span><span class="p">(</span><span class="mi">4</span><span class="p">)</span> <span class="c1"># or DiGraph, MultiGraph, MultiDiGraph, etc</span> -<span class="gp">>>> </span><span class="n">G</span><span class="o">.</span><span class="n">has_edge</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span> <span class="c1"># using two nodes</span> -<span class="go">True</span> -<span class="gp">>>> </span><span class="n">e</span> <span class="o">=</span> <span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span> -<span class="gp">>>> </span><span class="n">G</span><span class="o">.</span><span class="n">has_edge</span><span class="p">(</span><span class="o">*</span><span class="n">e</span><span class="p">)</span> <span class="c1"># e is a 2-tuple (u, v)</span> -<span class="go">True</span> -<span class="gp">>>> </span><span class="n">e</span> <span class="o">=</span> <span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="p">{</span><span class="s1">'weight'</span><span class="p">:</span><span class="mi">7</span><span class="p">})</span> -<span class="gp">>>> </span><span class="n">G</span><span class="o">.</span><span class="n">has_edge</span><span class="p">(</span><span class="o">*</span><span class="n">e</span><span class="p">[:</span><span class="mi">2</span><span class="p">])</span> <span class="c1"># e is a 3-tuple (u, v, data_dictionary)</span> -<span class="go">True</span> -</pre></div> -</div> -<p>The following syntax are equivalent:</p> -<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">G</span><span class="o">.</span><span class="n">has_edge</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span> -<span class="go">True</span> -<span class="gp">>>> </span><span class="mi">1</span> <span class="ow">in</span> <span class="n">G</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="c1"># though this gives KeyError if 0 not in G</span> -<span class="go">True</span> -</pre></div> -</div> -</dd></dl> - -<dl class="method"> -<dt id="kadmos.graph.graph_data.DataGraph.has_node"> -<code class="descname">has_node</code><span class="sig-paren">(</span><em>n</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.has_node" title="Permalink to this definition">¶</a></dt> -<dd><p>Return True if the graph contains the node n.</p> -<p>Identical to <cite>n in G</cite></p> -<p>n : node</p> -<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">G</span> <span class="o">=</span> <span class="n">nx</span><span class="o">.</span><span class="n">path_graph</span><span class="p">(</span><span class="mi">3</span><span class="p">)</span> <span class="c1"># or DiGraph, MultiGraph, MultiDiGraph, etc</span> -<span class="gp">>>> </span><span class="n">G</span><span class="o">.</span><span class="n">has_node</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span> -<span class="go">True</span> -</pre></div> -</div> -<p>It is more readable and simpler to use</p> -<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="mi">0</span> <span class="ow">in</span> <span class="n">G</span> -<span class="go">True</span> -</pre></div> -</div> -</dd></dl> - -<dl class="method"> -<dt id="kadmos.graph.graph_data.DataGraph.has_nodes"> -<code class="descname">has_nodes</code><span class="sig-paren">(</span><em>nodes</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.has_nodes" title="Permalink to this definition">¶</a></dt> -<dd><p>Function that checks whether all nodes given in a list are present in the graph.</p> -<table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>nodes</strong> (<em>list</em>) – list of nodes to be checked</td> -</tr> -<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">boolean whether all nodes have been found</td> -</tr> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body">bool</td> -</tr> -</tbody> -</table> -</dd></dl> - -<dl class="method"> -<dt id="kadmos.graph.graph_data.DataGraph.has_predecessor"> -<code class="descname">has_predecessor</code><span class="sig-paren">(</span><em>u</em>, <em>v</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.has_predecessor" title="Permalink to this definition">¶</a></dt> -<dd><p>Return True if node u has predecessor v.</p> -<p>This is true if graph has the edge u<-v.</p> -</dd></dl> - -<dl class="method"> -<dt id="kadmos.graph.graph_data.DataGraph.has_successor"> -<code class="descname">has_successor</code><span class="sig-paren">(</span><em>u</em>, <em>v</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.has_successor" title="Permalink to this definition">¶</a></dt> -<dd><p>Return True if node u has successor v.</p> -<p>This is true if graph has the edge u->v.</p> -</dd></dl> - -<dl class="attribute"> -<dt id="kadmos.graph.graph_data.DataGraph.in_degree"> -<code class="descname">in_degree</code><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.in_degree" title="Permalink to this definition">¶</a></dt> -<dd><p>An InDegreeView for (node, in_degree) or in_degree for single node.</p> -<p>The node in_degree is the number of edges pointing to the node. -The weighted node degree is the sum of the edge weights for -edges incident to that node.</p> -<p>This object provides an iteration over (node, in_degree) as well as -lookup for the degree for a single node.</p> -<dl class="docutils"> -<dt>nbunch <span class="classifier-delimiter">:</span> <span class="classifier">single node, container, or all nodes (default= all nodes)</span></dt> -<dd>The view will only report edges incident to these nodes.</dd> -<dt>weight <span class="classifier-delimiter">:</span> <span class="classifier">string or None, optional (default=None)</span></dt> -<dd>The name of an edge attribute that holds the numerical value used -as a weight. If None, then each edge has weight 1. -The degree is the sum of the edge weights adjacent to the node.</dd> -</dl> -<p>If a single node is requested -deg : int</p> -<blockquote> -<div>In-degree of the node</div></blockquote> -<p>OR if multiple nodes are requested -nd_iter : iterator</p> -<blockquote> -<div>The iterator returns two-tuples of (node, in-degree).</div></blockquote> -<p>degree, out_degree</p> -<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">G</span> <span class="o">=</span> <span class="n">nx</span><span class="o">.</span><span class="n">DiGraph</span><span class="p">()</span> -<span class="gp">>>> </span><span class="n">nx</span><span class="o">.</span><span class="n">add_path</span><span class="p">(</span><span class="n">G</span><span class="p">,</span> <span class="p">[</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">])</span> -<span class="gp">>>> </span><span class="n">G</span><span class="o">.</span><span class="n">in_degree</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span> <span class="c1"># node 0 with degree 0</span> -<span class="go">0</span> -<span class="gp">>>> </span><span class="nb">list</span><span class="p">(</span><span class="n">G</span><span class="o">.</span><span class="n">in_degree</span><span class="p">([</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">]))</span> -<span class="go">[(0, 0), (1, 1), (2, 1)]</span> -</pre></div> -</div> -</dd></dl> - -<dl class="attribute"> -<dt id="kadmos.graph.graph_data.DataGraph.in_edges"> -<code class="descname">in_edges</code><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.in_edges" title="Permalink to this definition">¶</a></dt> -<dd><p>An InEdgeView of the Graph as G.in_edges or G.in_edges().</p> -<p>in_edges(self, nbunch=None, data=False, default=None):</p> -<dl class="docutils"> -<dt>nbunch <span class="classifier-delimiter">:</span> <span class="classifier">single node, container, or all nodes (default= all nodes)</span></dt> -<dd>The view will only report edges incident to these nodes.</dd> -<dt>data <span class="classifier-delimiter">:</span> <span class="classifier">string or bool, optional (default=False)</span></dt> -<dd>The edge attribute returned in 3-tuple (u, v, ddict[data]). -If True, return edge attribute dict in 3-tuple (u, v, ddict). -If False, return 2-tuple (u, v).</dd> -<dt>default <span class="classifier-delimiter">:</span> <span class="classifier">value, optional (default=None)</span></dt> -<dd>Value used for edges that dont have the requested attribute. -Only relevant if data is not True or False.</dd> -</dl> -<dl class="docutils"> -<dt>in_edges <span class="classifier-delimiter">:</span> <span class="classifier">InEdgeView</span></dt> -<dd>A view of edge attributes, usually it iterates over (u, v) -or (u, v, d) tuples of edges, but can also be used for -attribute lookup as <cite>edges[u, v][‘foo’]</cite>.</dd> -</dl> -<p>edges</p> -</dd></dl> - -<dl class="method"> -<dt id="kadmos.graph.graph_data.DataGraph.inspect"> -<code class="descname">inspect</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.inspect" title="Permalink to this definition">¶</a></dt> -<dd><p>Method to print an overview of the graph.</p> -</dd></dl> - -<dl class="method"> -<dt id="kadmos.graph.graph_data.DataGraph.inspect_node"> -<code class="descname">inspect_node</code><span class="sig-paren">(</span><em>node</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.inspect_node" title="Permalink to this definition">¶</a></dt> -<dd><p>Method to print a node with details.</p> -<table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>node</strong> (<em>str</em>) – node</td> -</tr> -</tbody> -</table> -</dd></dl> - -<dl class="method"> -<dt id="kadmos.graph.graph_data.DataGraph.inspect_nodes"> -<code class="descname">inspect_nodes</code><span class="sig-paren">(</span><em>list_of_nodes</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.inspect_nodes" title="Permalink to this definition">¶</a></dt> -<dd><p>Method to inspect/print a list of nodes with details.</p> -<table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>list_of_nodes</strong> (<em>list</em>) – node list</td> -</tr> -</tbody> -</table> -</dd></dl> - -<dl class="method"> -<dt id="kadmos.graph.graph_data.DataGraph.is_directed"> -<code class="descname">is_directed</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.is_directed" title="Permalink to this definition">¶</a></dt> -<dd><p>Return True if graph is directed, False otherwise.</p> -</dd></dl> - -<dl class="method"> -<dt id="kadmos.graph.graph_data.DataGraph.is_multigraph"> -<code class="descname">is_multigraph</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.is_multigraph" title="Permalink to this definition">¶</a></dt> -<dd><p>Return True if graph is a multigraph, False otherwise.</p> -</dd></dl> - -<dl class="method"> -<dt id="kadmos.graph.graph_data.DataGraph.load_cmdows"> -<code class="descname">load_cmdows</code><span class="sig-paren">(</span><em>cmdows</em>, <em>check_list</em>, <em>ignore_modes=False</em>, <em>keep_running=False</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.load_cmdows" title="Permalink to this definition">¶</a></dt> -<dd><p>Method to load the graph from a CMDOWS file</p> -<table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> -<li><strong>cmdows</strong> (<em>str</em>) – CMDOWS file path</li> -<li><strong>check_list</strong> (<em>list</em>) – checks to be performed. See below.</li> -<li><strong>ignore_modes</strong> (<em>bool</em>) – for determining if modes are taken into account</li> -<li><strong>keep_running</strong> (<em>bool</em>) – for determining if errors should be raised</li> -</ul> -</td> -</tr> -<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">mpg</p> -</td> -</tr> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last"><a class="reference internal" href="#kadmos.graph.graph_process.MdaoProcessGraph" title="kadmos.graph.graph_process.MdaoProcessGraph">MdaoProcessGraph</a></p> -</td> -</tr> -</tbody> -</table> -<p>Check_list options:</p> -<ul class="simple"> -<li>‘consistent_root’: check if all in-/output files have the same root element</li> -<li>‘invalid_leaf_elements’: check for leaf elements that still have child elements in other in-/output files</li> -<li>‘schemas’: check if the in-/output files are consistent with the schema.</li> -</ul> -<p>To perform all of the checks without stopping if an error is found by the checks:</p> -<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">check_list</span> <span class="o">=</span> <span class="p">[</span><span class="s1">'consistent_root'</span><span class="p">,</span> <span class="s1">'invalid_leaf_elements'</span><span class="p">,</span> <span class="s1">'schemas'</span><span class="p">]</span> -<span class="gp">>>> </span><span class="n">graph</span><span class="o">.</span><span class="n">load_cmdows</span><span class="p">(</span><span class="n">cmdows</span><span class="p">,</span> <span class="n">check_list</span><span class="p">,</span> <span class="n">keep_running</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> -</pre></div> -</div> -</dd></dl> - -<dl class="method"> -<dt id="kadmos.graph.graph_data.DataGraph.make_all_variables_valid"> -<code class="descname">make_all_variables_valid</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.make_all_variables_valid" title="Permalink to this definition">¶</a></dt> -<dd><p>Method to analyze all variables in a graph and make any problematic variables valid.</p> -<p>Problematic variable are holes and splittables. Splittable variables are split and holes will simply be removed.</p> -</dd></dl> - -<dl class="method"> -<dt id="kadmos.graph.graph_data.DataGraph.mark_as_constraint"> -<code class="descname">mark_as_constraint</code><span class="sig-paren">(</span><em>node</em>, <em>operator</em>, <em>reference_value</em>, <em>remove_unused_outputs=False</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.mark_as_constraint" title="Permalink to this definition">¶</a></dt> -<dd><p>Method to mark a node as a constraint.</p> -<table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple"> -<li><strong>node</strong> – node to be marked (on the left side of the operator</li> -<li><strong>operator</strong> (<em>str</em>) – constraint operator</li> -<li><strong>reference_value</strong> (<em>numbers.Number</em>) – value on the right side of the operator</li> -</ul> -</td> -</tr> -</tbody> -</table> -</dd></dl> - -<dl class="method"> -<dt id="kadmos.graph.graph_data.DataGraph.mark_as_constraints"> -<code class="descname">mark_as_constraints</code><span class="sig-paren">(</span><em>nodes</em>, <em>operators</em>, <em>reference_values</em>, <em>remove_unused_outputs=False</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.mark_as_constraints" title="Permalink to this definition">¶</a></dt> -<dd><p>Method to mark multiple nodes as constraints.</p> -<table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> -<li><strong>nodes</strong> – list of nodes to be marked.</li> -<li><strong>operators</strong> – operators to be implemented (as list per node or as single operator for all)</li> -<li><strong>reference_values</strong> – reference values to be used (as list of values per node or as single value for all)</li> -</ul> -</td> -</tr> -<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">graph with enriched constraint nodes</p> -</td> -</tr> -</tbody> -</table> -</dd></dl> - -<dl class="method"> -<dt id="kadmos.graph.graph_data.DataGraph.mark_as_design_variable"> -<code class="descname">mark_as_design_variable</code><span class="sig-paren">(</span><em>node</em>, <em>lower_bound=None</em>, <em>upper_bound=None</em>, <em>samples=None</em>, <em>nominal_value=0.0</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.mark_as_design_variable" title="Permalink to this definition">¶</a></dt> -<dd><p>Method to mark a single node as a design variable and add the required metadata for its definition.</p> -<table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> -<li><strong>node</strong> – </li> -<li><strong>lower_bound</strong> – </li> -<li><strong>upper_bound</strong> – </li> -<li><strong>samples</strong> – </li> -</ul> -</td> -</tr> -<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last"></p> -</td> -</tr> -</tbody> -</table> -</dd></dl> - -<dl class="method"> -<dt id="kadmos.graph.graph_data.DataGraph.mark_as_design_variables"> -<code class="descname">mark_as_design_variables</code><span class="sig-paren">(</span><em>nodes</em>, <em>lower_bounds=None</em>, <em>upper_bounds=None</em>, <em>samples=None</em>, <em>nominal_values=None</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.mark_as_design_variables" title="Permalink to this definition">¶</a></dt> -<dd><p>Method to mark a list of nodes as design variable and add metadata.</p> -<table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple"> -<li><strong>nodes</strong> (<em>list</em><em> or </em><em>str</em>) – list of nodes present in the graph</li> -<li><strong>lower_bounds</strong> (<em>list</em><em> or </em><em>numbers.Number</em>) – list of lower bound values</li> -<li><strong>upper_bounds</strong> (<em>list</em><em> or </em><em>numbers.Number</em>) – list of upper bounds</li> -<li><strong>samples</strong> (<em>list</em>) – nested list of kadmos values</li> -<li><strong>nominal_values</strong> (<em>list</em><em> or </em><em>numbers.Number</em>) – list of nominal values</li> -</ul> -</td> -</tr> -</tbody> -</table> -</dd></dl> - -<dl class="method"> -<dt id="kadmos.graph.graph_data.DataGraph.mark_as_objective"> -<code class="descname">mark_as_objective</code><span class="sig-paren">(</span><em>node</em>, <em>remove_unused_outputs=False</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.mark_as_objective" title="Permalink to this definition">¶</a></dt> -<dd><p>Method to mark a single node as objective.</p> -<table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>node</strong> (<em>basestring</em>) – variable node</td> -</tr> -</tbody> -</table> -</dd></dl> - -<dl class="method"> -<dt id="kadmos.graph.graph_data.DataGraph.mark_as_qois"> -<code class="descname">mark_as_qois</code><span class="sig-paren">(</span><em>nodes</em>, <em>remove_unused_outputs=False</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.mark_as_qois" title="Permalink to this definition">¶</a></dt> -<dd><p>Function to mark a list of nodes as quantity of interest.</p> -<table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>nodes</strong> (<em>list</em>) – list of nodes present in the graph</td> -</tr> -</tbody> -</table> -</dd></dl> - -<dl class="method"> -<dt id="kadmos.graph.graph_data.DataGraph.merge_function_modes"> -<code class="descname">merge_function_modes</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.merge_function_modes" title="Permalink to this definition">¶</a></dt> -<dd><p>Function to contract certain modes of the same function.</p> -<table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> -<li><strong>args</strong> (<em>str</em>) – function (first arg) and then followed by modes to be contracted.</li> -<li><strong>kwargs</strong> (<em>dict</em><em> or </em><em>str</em>) – new_label to specify new node label manually (optional)</li> -</ul> -</td> -</tr> -<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">contracted graph</p> -</td> -</tr> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last"><a class="reference internal" href="#kadmos.graph.graph_kadmos.KadmosGraph" title="kadmos.graph.graph_kadmos.KadmosGraph">KadmosGraph</a></p> -</td> -</tr> -</tbody> -</table> -</dd></dl> - -<dl class="method"> -<dt id="kadmos.graph.graph_data.DataGraph.merge_function_nodes_based_on_modes"> -<code class="descname">merge_function_nodes_based_on_modes</code><span class="sig-paren">(</span><em>merge_funcs=None</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.merge_function_nodes_based_on_modes" title="Permalink to this definition">¶</a></dt> -<dd><p>This class method merges all execution modes of the same function into a single node.</p> -<p>Mainly used for illustration purposes since information on the execution modes gets lost. Functions must be -present in graph.</p> -<table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>merge_funcs</strong> (<em>list</em><em>, </em><em>tuple</em>) – List of tuple of functions to merge. If empty (default), all functions are merged.</td> -</tr> -<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">merged graph</td> -</tr> -</tbody> -</table> -</dd></dl> - -<dl class="method"> -<dt id="kadmos.graph.graph_data.DataGraph.merge_functions"> -<code class="descname">merge_functions</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.merge_functions" title="Permalink to this definition">¶</a></dt> -<dd><p>Function to merge a collection of functions.</p> -<table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple"> -<li><strong>args</strong> (<em>node_ids</em>) – functions to be merged</li> -<li><strong>kwargs</strong> (<em>dict</em>) – new_label to specify new node label manually (optional)</li> -</ul> -</td> -</tr> -</tbody> -</table> -</dd></dl> - -<dl class="method"> -<dt id="kadmos.graph.graph_data.DataGraph.merge_parallel_functions"> -<code class="descname">merge_parallel_functions</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.merge_parallel_functions" title="Permalink to this definition">¶</a></dt> -<dd><p>Function to merge a list of functions</p> -<table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple"> -<li><strong>args</strong> (<em>node_ids</em>) – functions to be merged</li> -<li><strong>kwargs</strong> (<em>dict</em>) – new_label to specify new node label manually (optional)</li> -</ul> -</td> -</tr> -</tbody> -</table> -</dd></dl> - -<dl class="method"> -<dt id="kadmos.graph.graph_data.DataGraph.merge_sequential_functions"> -<code class="descname">merge_sequential_functions</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.merge_sequential_functions" title="Permalink to this definition">¶</a></dt> -<dd><p>Function to merge a collection of functions.</p> -<p>It is assumed that the merged functions are actually executed in the sequence in which they are given to this -function.</p> -<table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple"> -<li><strong>args</strong> (<em>node_ids</em>) – functions to be merged in the given sequence</li> -<li><strong>kwargs</strong> (<em>str</em>) – new_label to specify new node label manually (optional)</li> -</ul> -</td> -</tr> -</tbody> -</table> -</dd></dl> - -<dl class="method"> -<dt id="kadmos.graph.graph_data.DataGraph.minimize_feedback"> -<code class="descname">minimize_feedback</code><span class="sig-paren">(</span><em>nodes</em>, <em>method</em>, <em>multi_start=None</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.minimize_feedback" title="Permalink to this definition">¶</a></dt> -<dd><p>Function to find the function order with minimum feedback</p> -<table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> -<li><strong>nodes</strong> (<em>list</em>) – nodes for which the feedback needs to be minimized</li> -<li><strong>method</strong> (<em>str</em>) – algorithm used to find optimal function order</li> -<li><strong>multi_start</strong> (<em>int</em>) – start the algorithm from multiple starting points</li> -</ul> -</td> -</tr> -<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">function order</p> -</td> -</tr> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">list</p> -</td> -</tr> -</tbody> -</table> -</dd></dl> - -<dl class="attribute"> -<dt id="kadmos.graph.graph_data.DataGraph.name"> -<code class="descname">name</code><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.name" title="Permalink to this definition">¶</a></dt> -<dd><p>String identifier of the graph.</p> -<p>This graph attribute appears in the attribute dict G.graph -keyed by the string <cite>“nameâ€</cite>. as well as an attribute (technically -a property) <cite>G.name</cite>. This is entirely user controlled.</p> -</dd></dl> - -<dl class="method"> -<dt id="kadmos.graph.graph_data.DataGraph.nbunch_iter"> -<code class="descname">nbunch_iter</code><span class="sig-paren">(</span><em>nbunch=None</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.nbunch_iter" title="Permalink to this definition">¶</a></dt> -<dd><p>Return an iterator over nodes contained in nbunch that are -also in the graph.</p> -<p>The nodes in nbunch are checked for membership in the graph -and if not are silently ignored.</p> -<dl class="docutils"> -<dt>nbunch <span class="classifier-delimiter">:</span> <span class="classifier">single node, container, or all nodes (default= all nodes)</span></dt> -<dd>The view will only report edges incident to these nodes.</dd> -</dl> -<dl class="docutils"> -<dt>niter <span class="classifier-delimiter">:</span> <span class="classifier">iterator</span></dt> -<dd>An iterator over nodes in nbunch that are also in the graph. -If nbunch is None, iterate over all nodes in the graph.</dd> -</dl> -<dl class="docutils"> -<dt>NetworkXError</dt> -<dd>If nbunch is not a node or or sequence of nodes. -If a node in nbunch is not hashable.</dd> -</dl> -<p>Graph.__iter__</p> -<p>When nbunch is an iterator, the returned iterator yields values -directly from nbunch, becoming exhausted when nbunch is exhausted.</p> -<p>To test whether nbunch is a single node, one can use -“if nbunch in self:â€, even after processing with this routine.</p> -<p>If nbunch is not a node or a (possibly empty) sequence/iterator -or None, a <code class="xref py py-exc docutils literal notranslate"><span class="pre">NetworkXError</span></code> is raised. Also, if any object in -nbunch is not hashable, a <code class="xref py py-exc docutils literal notranslate"><span class="pre">NetworkXError</span></code> is raised.</p> -</dd></dl> - -<dl class="method"> -<dt id="kadmos.graph.graph_data.DataGraph.neighbors"> -<code class="descname">neighbors</code><span class="sig-paren">(</span><em>n</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.neighbors" title="Permalink to this definition">¶</a></dt> -<dd><p>Return an iterator over successor nodes of n.</p> -<p>neighbors() and successors() are the same.</p> -</dd></dl> - -<dl class="attribute"> -<dt id="kadmos.graph.graph_data.DataGraph.node"> -<code class="descname">node</code><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.node" title="Permalink to this definition">¶</a></dt> -<dd><p>A NodeView of the Graph as G.nodes or G.nodes().</p> -<p>Can be used as <cite>G.nodes</cite> for data lookup and for set-like operations. -Can also be used as <cite>G.nodes(data=’color’, default=None)</cite> to return a -NodeDataView which reports specific node data but no set operations. -It presents a dict-like interface as well with <cite>G.nodes.items()</cite> -iterating over <cite>(node, nodedata)</cite> 2-tuples and <cite>G.nodes[3][‘foo’]</cite> -providing the value of the <cite>foo</cite> attribute for node <cite>3</cite>. In addition, -a view <cite>G.nodes.data(‘foo’)</cite> provides a dict-like interface to the -<cite>foo</cite> attribute of each node. <cite>G.nodes.data(‘foo’, default=1)</cite> -provides a default for nodes that do not have attribute <cite>foo</cite>.</p> -<dl class="docutils"> -<dt>data <span class="classifier-delimiter">:</span> <span class="classifier">string or bool, optional (default=False)</span></dt> -<dd>The node attribute returned in 2-tuple (n, ddict[data]). -If True, return entire node attribute dict as (n, ddict). -If False, return just the nodes n.</dd> -<dt>default <span class="classifier-delimiter">:</span> <span class="classifier">value, optional (default=None)</span></dt> -<dd>Value used for nodes that dont have the requested attribute. -Only relevant if data is not True or False.</dd> -</dl> -<dl class="docutils"> -<dt>NodeView</dt> -<dd><p class="first">Allows set-like operations over the nodes as well as node -attribute dict lookup and calling to get a NodeDataView. -A NodeDataView iterates over <cite>(n, data)</cite> and has no set operations. -A NodeView iterates over <cite>n</cite> and includes set operations.</p> -<p class="last">When called, if data is False, an iterator over nodes. -Otherwise an iterator of 2-tuples (node, attribute value) -where the attribute is specified in <cite>data</cite>. -If data is True then the attribute becomes the -entire data dictionary.</p> -</dd> -</dl> -<p>If your node data is not needed, it is simpler and equivalent -to use the expression <code class="docutils literal notranslate"><span class="pre">for</span> <span class="pre">n</span> <span class="pre">in</span> <span class="pre">G</span></code>, or <code class="docutils literal notranslate"><span class="pre">list(G)</span></code>.</p> -<p>There are two simple ways of getting a list of all nodes in the graph:</p> -<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">G</span> <span class="o">=</span> <span class="n">nx</span><span class="o">.</span><span class="n">path_graph</span><span class="p">(</span><span class="mi">3</span><span class="p">)</span> -<span class="gp">>>> </span><span class="nb">list</span><span class="p">(</span><span class="n">G</span><span class="o">.</span><span class="n">nodes</span><span class="p">)</span> -<span class="go">[0, 1, 2]</span> -<span class="gp">>>> </span><span class="nb">list</span><span class="p">(</span><span class="n">G</span><span class="p">)</span> -<span class="go">[0, 1, 2]</span> -</pre></div> -</div> -<p>To get the node data along with the nodes:</p> -<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">G</span><span class="o">.</span><span class="n">add_node</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="n">time</span><span class="o">=</span><span class="s1">'5pm'</span><span class="p">)</span> -<span class="gp">>>> </span><span class="n">G</span><span class="o">.</span><span class="n">nodes</span><span class="p">[</span><span class="mi">0</span><span class="p">][</span><span class="s1">'foo'</span><span class="p">]</span> <span class="o">=</span> <span class="s1">'bar'</span> -<span class="gp">>>> </span><span class="nb">list</span><span class="p">(</span><span class="n">G</span><span class="o">.</span><span class="n">nodes</span><span class="p">(</span><span class="n">data</span><span class="o">=</span><span class="kc">True</span><span class="p">))</span> -<span class="go">[(0, {'foo': 'bar'}), (1, {'time': '5pm'}), (2, {})]</span> -<span class="gp">>>> </span><span class="nb">list</span><span class="p">(</span><span class="n">G</span><span class="o">.</span><span class="n">nodes</span><span class="o">.</span><span class="n">data</span><span class="p">())</span> -<span class="go">[(0, {'foo': 'bar'}), (1, {'time': '5pm'}), (2, {})]</span> -</pre></div> -</div> -<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="nb">list</span><span class="p">(</span><span class="n">G</span><span class="o">.</span><span class="n">nodes</span><span class="p">(</span><span class="n">data</span><span class="o">=</span><span class="s1">'foo'</span><span class="p">))</span> -<span class="go">[(0, 'bar'), (1, None), (2, None)]</span> -<span class="gp">>>> </span><span class="nb">list</span><span class="p">(</span><span class="n">G</span><span class="o">.</span><span class="n">nodes</span><span class="o">.</span><span class="n">data</span><span class="p">(</span><span class="s1">'foo'</span><span class="p">))</span> -<span class="go">[(0, 'bar'), (1, None), (2, None)]</span> -</pre></div> -</div> -<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="nb">list</span><span class="p">(</span><span class="n">G</span><span class="o">.</span><span class="n">nodes</span><span class="p">(</span><span class="n">data</span><span class="o">=</span><span class="s1">'time'</span><span class="p">))</span> -<span class="go">[(0, None), (1, '5pm'), (2, None)]</span> -<span class="gp">>>> </span><span class="nb">list</span><span class="p">(</span><span class="n">G</span><span class="o">.</span><span class="n">nodes</span><span class="o">.</span><span class="n">data</span><span class="p">(</span><span class="s1">'time'</span><span class="p">))</span> -<span class="go">[(0, None), (1, '5pm'), (2, None)]</span> -</pre></div> -</div> -<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="nb">list</span><span class="p">(</span><span class="n">G</span><span class="o">.</span><span class="n">nodes</span><span class="p">(</span><span class="n">data</span><span class="o">=</span><span class="s1">'time'</span><span class="p">,</span> <span class="n">default</span><span class="o">=</span><span class="s1">'Not Available'</span><span class="p">))</span> -<span class="go">[(0, 'Not Available'), (1, '5pm'), (2, 'Not Available')]</span> -<span class="gp">>>> </span><span class="nb">list</span><span class="p">(</span><span class="n">G</span><span class="o">.</span><span class="n">nodes</span><span class="o">.</span><span class="n">data</span><span class="p">(</span><span class="s1">'time'</span><span class="p">,</span> <span class="n">default</span><span class="o">=</span><span class="s1">'Not Available'</span><span class="p">))</span> -<span class="go">[(0, 'Not Available'), (1, '5pm'), (2, 'Not Available')]</span> -</pre></div> -</div> -<p>If some of your nodes have an attribute and the rest are assumed -to have a default attribute value you can create a dictionary -from node/attribute pairs using the <cite>default</cite> keyword argument -to guarantee the value is never None:</p> -<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">G</span> <span class="o">=</span> <span class="n">nx</span><span class="o">.</span><span class="n">Graph</span><span class="p">()</span> -<span class="gp">>>> </span><span class="n">G</span><span class="o">.</span><span class="n">add_node</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span> -<span class="gp">>>> </span><span class="n">G</span><span class="o">.</span><span class="n">add_node</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="n">weight</span><span class="o">=</span><span class="mi">2</span><span class="p">)</span> -<span class="gp">>>> </span><span class="n">G</span><span class="o">.</span><span class="n">add_node</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="n">weight</span><span class="o">=</span><span class="mi">3</span><span class="p">)</span> -<span class="gp">>>> </span><span class="nb">dict</span><span class="p">(</span><span class="n">G</span><span class="o">.</span><span class="n">nodes</span><span class="p">(</span><span class="n">data</span><span class="o">=</span><span class="s1">'weight'</span><span class="p">,</span> <span class="n">default</span><span class="o">=</span><span class="mi">1</span><span class="p">))</span> -<span class="go">{0: 1, 1: 2, 2: 3}</span> -</pre></div> -</div> -</dd></dl> - -<dl class="attribute"> -<dt id="kadmos.graph.graph_data.DataGraph.node_dict_factory"> -<code class="descname">node_dict_factory</code><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.node_dict_factory" title="Permalink to this definition">¶</a></dt> -<dd><p>alias of <code class="xref py py-class docutils literal notranslate"><span class="pre">__builtin__.dict</span></code></p> -</dd></dl> - -<dl class="method"> -<dt id="kadmos.graph.graph_data.DataGraph.node_is_function"> -<code class="descname">node_is_function</code><span class="sig-paren">(</span><em>node</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.node_is_function" title="Permalink to this definition">¶</a></dt> -<dd><p>Function that checks whether a node is a function node or not.</p> -<table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>node</strong> (<em>str</em>) – node in graph</td> -</tr> -<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">check result</td> -</tr> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body">bool</td> -</tr> -</tbody> -</table> -</dd></dl> - -<dl class="method"> -<dt id="kadmos.graph.graph_data.DataGraph.node_is_hole"> -<code class="descname">node_is_hole</code><span class="sig-paren">(</span><em>node</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.node_is_hole" title="Permalink to this definition">¶</a></dt> -<dd><p>Function that checks whether a node is a hole (unconnected).</p> -<table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>node</strong> (<em>str</em>) – node in graph</td> -</tr> -<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">check result</td> -</tr> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body">bool</td> -</tr> -</tbody> -</table> -</dd></dl> - -<dl class="method"> -<dt id="kadmos.graph.graph_data.DataGraph.node_is_objective_function"> -<code class="descname">node_is_objective_function</code><span class="sig-paren">(</span><em>node</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.node_is_objective_function" title="Permalink to this definition">¶</a></dt> -<dd><p>This function checks whether the provided node is a objective function.</p> -<dl class="docutils"> -<dt>This function checks whether the provided node:</dt> -<dd><ol class="first last arabic simple"> -<li>exists in graph</li> -<li>has name-attribute “Objectiveâ€</li> -<li>has an out-degree of 1</li> -<li>has an outgoing node with an out-degree of zero # TODO: THIS IS WRONG!</li> -</ol> -</dd> -</dl> -<p>Only if all checks are satisfied, is the node a valid objective function node.</p> -<table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>node</strong> (<em>str</em>) – graph node to be tested</td> -</tr> -<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">check result</td> -</tr> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body">bool</td> -</tr> -</tbody> -</table> -</dd></dl> - -<dl class="method"> -<dt id="kadmos.graph.graph_data.DataGraph.node_is_output"> -<code class="descname">node_is_output</code><span class="sig-paren">(</span><em>node</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.node_is_output" title="Permalink to this definition">¶</a></dt> -<dd><p>Function that checks whether a node is a system output.</p> -<table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>node</strong> (<em>str</em>) – node in graph</td> -</tr> -<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">check result</td> -</tr> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body">bool</td> -</tr> -</tbody> -</table> -</dd></dl> - -<dl class="method"> -<dt id="kadmos.graph.graph_data.DataGraph.node_is_variable"> -<code class="descname">node_is_variable</code><span class="sig-paren">(</span><em>node</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.node_is_variable" title="Permalink to this definition">¶</a></dt> -<dd><p>Function that checks whether a node is a variable node or not.</p> -<table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>node</strong> (<em>str</em>) – node in graph</td> -</tr> -<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">check result</td> -</tr> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body">bool</td> -</tr> -</tbody> -</table> -</dd></dl> - -<dl class="attribute"> -<dt id="kadmos.graph.graph_data.DataGraph.nodes"> -<code class="descname">nodes</code><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.nodes" title="Permalink to this definition">¶</a></dt> -<dd><p>A NodeView of the Graph as G.nodes or G.nodes().</p> -<p>Can be used as <cite>G.nodes</cite> for data lookup and for set-like operations. -Can also be used as <cite>G.nodes(data=’color’, default=None)</cite> to return a -NodeDataView which reports specific node data but no set operations. -It presents a dict-like interface as well with <cite>G.nodes.items()</cite> -iterating over <cite>(node, nodedata)</cite> 2-tuples and <cite>G.nodes[3][‘foo’]</cite> -providing the value of the <cite>foo</cite> attribute for node <cite>3</cite>. In addition, -a view <cite>G.nodes.data(‘foo’)</cite> provides a dict-like interface to the -<cite>foo</cite> attribute of each node. <cite>G.nodes.data(‘foo’, default=1)</cite> -provides a default for nodes that do not have attribute <cite>foo</cite>.</p> -<dl class="docutils"> -<dt>data <span class="classifier-delimiter">:</span> <span class="classifier">string or bool, optional (default=False)</span></dt> -<dd>The node attribute returned in 2-tuple (n, ddict[data]). -If True, return entire node attribute dict as (n, ddict). -If False, return just the nodes n.</dd> -<dt>default <span class="classifier-delimiter">:</span> <span class="classifier">value, optional (default=None)</span></dt> -<dd>Value used for nodes that dont have the requested attribute. -Only relevant if data is not True or False.</dd> -</dl> -<dl class="docutils"> -<dt>NodeView</dt> -<dd><p class="first">Allows set-like operations over the nodes as well as node -attribute dict lookup and calling to get a NodeDataView. -A NodeDataView iterates over <cite>(n, data)</cite> and has no set operations. -A NodeView iterates over <cite>n</cite> and includes set operations.</p> -<p class="last">When called, if data is False, an iterator over nodes. -Otherwise an iterator of 2-tuples (node, attribute value) -where the attribute is specified in <cite>data</cite>. -If data is True then the attribute becomes the -entire data dictionary.</p> -</dd> -</dl> -<p>If your node data is not needed, it is simpler and equivalent -to use the expression <code class="docutils literal notranslate"><span class="pre">for</span> <span class="pre">n</span> <span class="pre">in</span> <span class="pre">G</span></code>, or <code class="docutils literal notranslate"><span class="pre">list(G)</span></code>.</p> -<p>There are two simple ways of getting a list of all nodes in the graph:</p> -<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">G</span> <span class="o">=</span> <span class="n">nx</span><span class="o">.</span><span class="n">path_graph</span><span class="p">(</span><span class="mi">3</span><span class="p">)</span> -<span class="gp">>>> </span><span class="nb">list</span><span class="p">(</span><span class="n">G</span><span class="o">.</span><span class="n">nodes</span><span class="p">)</span> -<span class="go">[0, 1, 2]</span> -<span class="gp">>>> </span><span class="nb">list</span><span class="p">(</span><span class="n">G</span><span class="p">)</span> -<span class="go">[0, 1, 2]</span> -</pre></div> -</div> -<p>To get the node data along with the nodes:</p> -<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">G</span><span class="o">.</span><span class="n">add_node</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="n">time</span><span class="o">=</span><span class="s1">'5pm'</span><span class="p">)</span> -<span class="gp">>>> </span><span class="n">G</span><span class="o">.</span><span class="n">nodes</span><span class="p">[</span><span class="mi">0</span><span class="p">][</span><span class="s1">'foo'</span><span class="p">]</span> <span class="o">=</span> <span class="s1">'bar'</span> -<span class="gp">>>> </span><span class="nb">list</span><span class="p">(</span><span class="n">G</span><span class="o">.</span><span class="n">nodes</span><span class="p">(</span><span class="n">data</span><span class="o">=</span><span class="kc">True</span><span class="p">))</span> -<span class="go">[(0, {'foo': 'bar'}), (1, {'time': '5pm'}), (2, {})]</span> -<span class="gp">>>> </span><span class="nb">list</span><span class="p">(</span><span class="n">G</span><span class="o">.</span><span class="n">nodes</span><span class="o">.</span><span class="n">data</span><span class="p">())</span> -<span class="go">[(0, {'foo': 'bar'}), (1, {'time': '5pm'}), (2, {})]</span> -</pre></div> -</div> -<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="nb">list</span><span class="p">(</span><span class="n">G</span><span class="o">.</span><span class="n">nodes</span><span class="p">(</span><span class="n">data</span><span class="o">=</span><span class="s1">'foo'</span><span class="p">))</span> -<span class="go">[(0, 'bar'), (1, None), (2, None)]</span> -<span class="gp">>>> </span><span class="nb">list</span><span class="p">(</span><span class="n">G</span><span class="o">.</span><span class="n">nodes</span><span class="o">.</span><span class="n">data</span><span class="p">(</span><span class="s1">'foo'</span><span class="p">))</span> -<span class="go">[(0, 'bar'), (1, None), (2, None)]</span> -</pre></div> -</div> -<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="nb">list</span><span class="p">(</span><span class="n">G</span><span class="o">.</span><span class="n">nodes</span><span class="p">(</span><span class="n">data</span><span class="o">=</span><span class="s1">'time'</span><span class="p">))</span> -<span class="go">[(0, None), (1, '5pm'), (2, None)]</span> -<span class="gp">>>> </span><span class="nb">list</span><span class="p">(</span><span class="n">G</span><span class="o">.</span><span class="n">nodes</span><span class="o">.</span><span class="n">data</span><span class="p">(</span><span class="s1">'time'</span><span class="p">))</span> -<span class="go">[(0, None), (1, '5pm'), (2, None)]</span> -</pre></div> -</div> -<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="nb">list</span><span class="p">(</span><span class="n">G</span><span class="o">.</span><span class="n">nodes</span><span class="p">(</span><span class="n">data</span><span class="o">=</span><span class="s1">'time'</span><span class="p">,</span> <span class="n">default</span><span class="o">=</span><span class="s1">'Not Available'</span><span class="p">))</span> -<span class="go">[(0, 'Not Available'), (1, '5pm'), (2, 'Not Available')]</span> -<span class="gp">>>> </span><span class="nb">list</span><span class="p">(</span><span class="n">G</span><span class="o">.</span><span class="n">nodes</span><span class="o">.</span><span class="n">data</span><span class="p">(</span><span class="s1">'time'</span><span class="p">,</span> <span class="n">default</span><span class="o">=</span><span class="s1">'Not Available'</span><span class="p">))</span> -<span class="go">[(0, 'Not Available'), (1, '5pm'), (2, 'Not Available')]</span> -</pre></div> -</div> -<p>If some of your nodes have an attribute and the rest are assumed -to have a default attribute value you can create a dictionary -from node/attribute pairs using the <cite>default</cite> keyword argument -to guarantee the value is never None:</p> -<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">G</span> <span class="o">=</span> <span class="n">nx</span><span class="o">.</span><span class="n">Graph</span><span class="p">()</span> -<span class="gp">>>> </span><span class="n">G</span><span class="o">.</span><span class="n">add_node</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span> -<span class="gp">>>> </span><span class="n">G</span><span class="o">.</span><span class="n">add_node</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="n">weight</span><span class="o">=</span><span class="mi">2</span><span class="p">)</span> -<span class="gp">>>> </span><span class="n">G</span><span class="o">.</span><span class="n">add_node</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="n">weight</span><span class="o">=</span><span class="mi">3</span><span class="p">)</span> -<span class="gp">>>> </span><span class="nb">dict</span><span class="p">(</span><span class="n">G</span><span class="o">.</span><span class="n">nodes</span><span class="p">(</span><span class="n">data</span><span class="o">=</span><span class="s1">'weight'</span><span class="p">,</span> <span class="n">default</span><span class="o">=</span><span class="mi">1</span><span class="p">))</span> -<span class="go">{0: 1, 1: 2, 2: 3}</span> -</pre></div> -</div> -</dd></dl> - -<dl class="method"> -<dt id="kadmos.graph.graph_data.DataGraph.number_of_edges"> -<code class="descname">number_of_edges</code><span class="sig-paren">(</span><em>u=None</em>, <em>v=None</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.number_of_edges" title="Permalink to this definition">¶</a></dt> -<dd><p>Return the number of edges between two nodes.</p> -<dl class="docutils"> -<dt>u, v <span class="classifier-delimiter">:</span> <span class="classifier">nodes, optional (default=all edges)</span></dt> -<dd>If u and v are specified, return the number of edges between -u and v. Otherwise return the total number of all edges.</dd> -</dl> -<dl class="docutils"> -<dt>nedges <span class="classifier-delimiter">:</span> <span class="classifier">int</span></dt> -<dd>The number of edges in the graph. If nodes <cite>u</cite> and <cite>v</cite> are -specified return the number of edges between those nodes. If -the graph is directed, this only returns the number of edges -from <cite>u</cite> to <cite>v</cite>.</dd> -</dl> -<p>size</p> -<p>For undirected graphs, this method counts the total number of -edges in the graph:</p> -<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">G</span> <span class="o">=</span> <span class="n">nx</span><span class="o">.</span><span class="n">path_graph</span><span class="p">(</span><span class="mi">4</span><span class="p">)</span> -<span class="gp">>>> </span><span class="n">G</span><span class="o">.</span><span class="n">number_of_edges</span><span class="p">()</span> -<span class="go">3</span> -</pre></div> -</div> -<p>If you specify two nodes, this counts the total number of edges -joining the two nodes:</p> -<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">G</span><span class="o">.</span><span class="n">number_of_edges</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span> -<span class="go">1</span> -</pre></div> -</div> -<p>For directed graphs, this method can count the total number of -directed edges from <cite>u</cite> to <cite>v</cite>:</p> -<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">G</span> <span class="o">=</span> <span class="n">nx</span><span class="o">.</span><span class="n">DiGraph</span><span class="p">()</span> -<span class="gp">>>> </span><span class="n">G</span><span class="o">.</span><span class="n">add_edge</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span> -<span class="gp">>>> </span><span class="n">G</span><span class="o">.</span><span class="n">add_edge</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span> -<span class="gp">>>> </span><span class="n">G</span><span class="o">.</span><span class="n">number_of_edges</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span> -<span class="go">1</span> -</pre></div> -</div> -</dd></dl> - -<dl class="method"> -<dt id="kadmos.graph.graph_data.DataGraph.number_of_nodes"> -<code class="descname">number_of_nodes</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.number_of_nodes" title="Permalink to this definition">¶</a></dt> -<dd><p>Return the number of nodes in the graph.</p> -<dl class="docutils"> -<dt>nnodes <span class="classifier-delimiter">:</span> <span class="classifier">int</span></dt> -<dd>The number of nodes in the graph.</dd> -</dl> -<p>order, __len__ which are identical</p> -<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">G</span> <span class="o">=</span> <span class="n">nx</span><span class="o">.</span><span class="n">path_graph</span><span class="p">(</span><span class="mi">3</span><span class="p">)</span> <span class="c1"># or DiGraph, MultiGraph, MultiDiGraph, etc</span> -<span class="gp">>>> </span><span class="nb">len</span><span class="p">(</span><span class="n">G</span><span class="p">)</span> -<span class="go">3</span> -</pre></div> -</div> -</dd></dl> - -<dl class="method"> -<dt id="kadmos.graph.graph_data.DataGraph.order"> -<code class="descname">order</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.order" title="Permalink to this definition">¶</a></dt> -<dd><p>Return the number of nodes in the graph.</p> -<dl class="docutils"> -<dt>nnodes <span class="classifier-delimiter">:</span> <span class="classifier">int</span></dt> -<dd>The number of nodes in the graph.</dd> -</dl> -<p>number_of_nodes, __len__ which are identical</p> -</dd></dl> - -<dl class="attribute"> -<dt id="kadmos.graph.graph_data.DataGraph.out_degree"> -<code class="descname">out_degree</code><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.out_degree" title="Permalink to this definition">¶</a></dt> -<dd><p>An OutDegreeView for (node, out_degree)</p> -<p>The node out_degree is the number of edges pointing out of the node. -The weighted node degree is the sum of the edge weights for -edges incident to that node.</p> -<p>This object provides an iterator over (node, out_degree) as well as -lookup for the degree for a single node.</p> -<dl class="docutils"> -<dt>nbunch <span class="classifier-delimiter">:</span> <span class="classifier">single node, container, or all nodes (default= all nodes)</span></dt> -<dd>The view will only report edges incident to these nodes.</dd> -<dt>weight <span class="classifier-delimiter">:</span> <span class="classifier">string or None, optional (default=None)</span></dt> -<dd>The name of an edge attribute that holds the numerical value used -as a weight. If None, then each edge has weight 1. -The degree is the sum of the edge weights adjacent to the node.</dd> -</dl> -<p>If a single node is requested -deg : int</p> -<blockquote> -<div>Out-degree of the node</div></blockquote> -<p>OR if multiple nodes are requested -nd_iter : iterator</p> -<blockquote> -<div>The iterator returns two-tuples of (node, out-degree).</div></blockquote> -<p>degree, in_degree</p> -<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">G</span> <span class="o">=</span> <span class="n">nx</span><span class="o">.</span><span class="n">DiGraph</span><span class="p">()</span> -<span class="gp">>>> </span><span class="n">nx</span><span class="o">.</span><span class="n">add_path</span><span class="p">(</span><span class="n">G</span><span class="p">,</span> <span class="p">[</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">])</span> -<span class="gp">>>> </span><span class="n">G</span><span class="o">.</span><span class="n">out_degree</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span> <span class="c1"># node 0 with degree 1</span> -<span class="go">1</span> -<span class="gp">>>> </span><span class="nb">list</span><span class="p">(</span><span class="n">G</span><span class="o">.</span><span class="n">out_degree</span><span class="p">([</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">]))</span> -<span class="go">[(0, 1), (1, 1), (2, 1)]</span> -</pre></div> -</div> -</dd></dl> - -<dl class="attribute"> -<dt id="kadmos.graph.graph_data.DataGraph.out_edges"> -<code class="descname">out_edges</code><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.out_edges" title="Permalink to this definition">¶</a></dt> -<dd><p>An OutEdgeView of the DiGraph as G.edges or G.edges().</p> -<p>edges(self, nbunch=None, data=False, default=None)</p> -<p>The OutEdgeView provides set-like operations on the edge-tuples -as well as edge attribute lookup. When called, it also provides -an EdgeDataView object which allows control of access to edge -attributes (but does not provide set-like operations). -Hence, <cite>G.edges[u, v][‘color’]</cite> provides the value of the color -attribute for edge <cite>(u, v)</cite> while -<cite>for (u, v, c) in G.edges.data(‘color’, default=’red’):</cite> -iterates through all the edges yielding the color attribute -with default <cite>‘red’</cite> if no color attribute exists.</p> -<dl class="docutils"> -<dt>nbunch <span class="classifier-delimiter">:</span> <span class="classifier">single node, container, or all nodes (default= all nodes)</span></dt> -<dd>The view will only report edges incident to these nodes.</dd> -<dt>data <span class="classifier-delimiter">:</span> <span class="classifier">string or bool, optional (default=False)</span></dt> -<dd>The edge attribute returned in 3-tuple (u, v, ddict[data]). -If True, return edge attribute dict in 3-tuple (u, v, ddict). -If False, return 2-tuple (u, v).</dd> -<dt>default <span class="classifier-delimiter">:</span> <span class="classifier">value, optional (default=None)</span></dt> -<dd>Value used for edges that dont have the requested attribute. -Only relevant if data is not True or False.</dd> -</dl> -<dl class="docutils"> -<dt>edges <span class="classifier-delimiter">:</span> <span class="classifier">OutEdgeView</span></dt> -<dd>A view of edge attributes, usually it iterates over (u, v) -or (u, v, d) tuples of edges, but can also be used for -attribute lookup as <cite>edges[u, v][‘foo’]</cite>.</dd> -</dl> -<p>in_edges, out_edges</p> -<p>Nodes in nbunch that are not in the graph will be (quietly) ignored. -For directed graphs this returns the out-edges.</p> -<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">G</span> <span class="o">=</span> <span class="n">nx</span><span class="o">.</span><span class="n">DiGraph</span><span class="p">()</span> <span class="c1"># or MultiDiGraph, etc</span> -<span class="gp">>>> </span><span class="n">nx</span><span class="o">.</span><span class="n">add_path</span><span class="p">(</span><span class="n">G</span><span class="p">,</span> <span class="p">[</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">])</span> -<span class="gp">>>> </span><span class="n">G</span><span class="o">.</span><span class="n">add_edge</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="n">weight</span><span class="o">=</span><span class="mi">5</span><span class="p">)</span> -<span class="gp">>>> </span><span class="p">[</span><span class="n">e</span> <span class="k">for</span> <span class="n">e</span> <span class="ow">in</span> <span class="n">G</span><span class="o">.</span><span class="n">edges</span><span class="p">]</span> -<span class="go">[(0, 1), (1, 2), (2, 3)]</span> -<span class="gp">>>> </span><span class="n">G</span><span class="o">.</span><span class="n">edges</span><span class="o">.</span><span class="n">data</span><span class="p">()</span> <span class="c1"># default data is {} (empty dict)</span> -<span class="go">OutEdgeDataView([(0, 1, {}), (1, 2, {}), (2, 3, {'weight': 5})])</span> -<span class="gp">>>> </span><span class="n">G</span><span class="o">.</span><span class="n">edges</span><span class="o">.</span><span class="n">data</span><span class="p">(</span><span class="s1">'weight'</span><span class="p">,</span> <span class="n">default</span><span class="o">=</span><span class="mi">1</span><span class="p">)</span> -<span class="go">OutEdgeDataView([(0, 1, 1), (1, 2, 1), (2, 3, 5)])</span> -<span class="gp">>>> </span><span class="n">G</span><span class="o">.</span><span class="n">edges</span><span class="p">([</span><span class="mi">0</span><span class="p">,</span> <span class="mi">2</span><span class="p">])</span> <span class="c1"># only edges incident to these nodes</span> -<span class="go">OutEdgeDataView([(0, 1), (2, 3)])</span> -<span class="gp">>>> </span><span class="n">G</span><span class="o">.</span><span class="n">edges</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span> <span class="c1"># only edges incident to a single node (use G.adj[0]?)</span> -<span class="go">OutEdgeDataView([(0, 1)])</span> -</pre></div> -</div> -</dd></dl> - -<dl class="method"> -<dt id="kadmos.graph.graph_data.DataGraph.plot_adjacency_matrix"> -<code class="descname">plot_adjacency_matrix</code><span class="sig-paren">(</span><em>fig_num=1</em>, <em>fig_size=(7</em>, <em>7)</em>, <em>show_now=True</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.plot_adjacency_matrix" title="Permalink to this definition">¶</a></dt> -<dd><p>Draw the adjacency matrix in a plot window.</p> -<table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple"> -<li><strong>fig_num</strong> – figure number</li> -<li><strong>fig_size</strong> – figure size</li> -<li><strong>show_now</strong> – Boolean whether to plot directly (pausing the execution until the plot is closed), or not.</li> -</ul> -</td> -</tr> -</tbody> -</table> -</dd></dl> - -<dl class="method"> -<dt id="kadmos.graph.graph_data.DataGraph.plot_graph"> -<code class="descname">plot_graph</code><span class="sig-paren">(</span><em>fig_num=1</em>, <em>color_setting='default'</em>, <em>positioning='circular'</em>, <em>save_as=None</em>, <em>show_now=True</em>, <em>title=None</em>, <em>edge_label=False</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.plot_graph" title="Permalink to this definition">¶</a></dt> -<dd><p>Function to plot a graph.</p> -<p>Note that you need to add matplotlib.pyplot.show() at the end of your code to see the plot window.</p> -<table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> -<li><strong>fig_num</strong> – figure number</li> -<li><strong>fig_size</strong> – size of figure window</li> -<li><strong>color_setting</strong> – choose from ‘default’, ‘sinks’, ‘categories’, ‘partitions’</li> -<li><strong>positioning</strong> – choose from ‘circular’, ‘spring’</li> -<li><strong>save_as</strong> – save plot as figure file</li> -<li><strong>show_now</strong> – Boolean whether to plot directly (pausing the execution until the plot is closed), or not.</li> -<li><strong>title</strong> – title string of the graph</li> -<li><strong>edge_label</strong> – edge attribute that will be shown for each edge in graph</li> -</ul> -</td> -</tr> -<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">window with plot</p> -</td> -</tr> -</tbody> -</table> -</dd></dl> - -<dl class="attribute"> -<dt id="kadmos.graph.graph_data.DataGraph.pred"> -<code class="descname">pred</code><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.pred" title="Permalink to this definition">¶</a></dt> -<dd><p>Graph adjacency object holding the predecessors of each node.</p> -<p>This object is a read-only dict-like structure with node keys -and neighbor-dict values. The neighbor-dict is keyed by neighbor -to the edge-data-dict. So <cite>G.pred[2][3][‘color’] = ‘blue’</cite> sets -the color of the edge <cite>(3, 2)</cite> to <cite>“blueâ€</cite>.</p> -<p>Iterating over G.pred behaves like a dict. Useful idioms include -<cite>for nbr, datadict in G.pred[n].items():</cite>. A data-view not provided -by dicts also exists: <cite>for nbr, foovalue in G.pred[node].data(‘foo’):</cite> -A default can be set via a <cite>default</cite> argument to the <cite>data</cite> method.</p> -</dd></dl> - -<dl class="method"> -<dt id="kadmos.graph.graph_data.DataGraph.predecessors"> -<code class="descname">predecessors</code><span class="sig-paren">(</span><em>n</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.predecessors" title="Permalink to this definition">¶</a></dt> -<dd><p>Return an iterator over predecessor nodes of n.</p> -</dd></dl> - -<dl class="method"> -<dt id="kadmos.graph.graph_data.DataGraph.print_graph"> -<code class="descname">print_graph</code><span class="sig-paren">(</span><em>use_pretty_print=False</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.print_graph" title="Permalink to this definition">¶</a></dt> -<dd><p>Function to print the full graph.</p> -<table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>use_pretty_print</strong> (<em>bool</em>) – Boolean on whether to use pretty print for node and edge attributes</td> -</tr> -</tbody> -</table> -</dd></dl> - -<dl class="method"> -<dt id="kadmos.graph.graph_data.DataGraph.relabel_function_nodes"> -<code class="descname">relabel_function_nodes</code><span class="sig-paren">(</span><em>mapping=None</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.relabel_function_nodes" title="Permalink to this definition">¶</a></dt> -<dd><p>Method to relabel all function nodes so that they meet the minimum CMDOWS convention</p> -<table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>mapping</strong> (<em>None</em><em>, </em><em>True</em>) – application of mapping required, optional (default=None)</td> -</tr> -</tbody> -</table> -<p>CMDOWS convention:</p> -<ul class="simple"> -<li>Minimum information: ID</li> -<li>Maximum information: ID[modeID][instanceID][version]</li> -</ul> -<p>Note: modeID, instanceID and version are only provided if there is a function with the same ID that requires -this specification to differentiate between the functions.</p> -<p>Example:</p> -<p>Design competences (full information):</p> -<ul class="simple"> -<li>Aerodynamics[A][1][v1]</li> -<li>Aerodynamics[A][2][v1]</li> -<li>Aerodynamics[B][1][v1]</li> -<li>Structures[A][1][v1]</li> -<li>Structures[A}[1][v2]</li> -<li>Propulsion[A][1][v2]</li> -</ul> -<p>Design competences relabeled:</p> -<ul class="simple"> -<li>Aerodynamics[A][1]</li> -<li>Aerodynamics[A][2]</li> -<li>Aerodynamics[B][1]</li> -<li>Structure[v1]</li> -<li>Structure[v2]</li> -<li>Propulsion</li> -</ul> -</dd></dl> - -<dl class="method"> -<dt id="kadmos.graph.graph_data.DataGraph.remove_edge"> -<code class="descname">remove_edge</code><span class="sig-paren">(</span><em>u</em>, <em>v</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.remove_edge" title="Permalink to this definition">¶</a></dt> -<dd><p>Remove the edge between u and v.</p> -<dl class="docutils"> -<dt>u, v <span class="classifier-delimiter">:</span> <span class="classifier">nodes</span></dt> -<dd>Remove the edge between nodes u and v.</dd> -</dl> -<dl class="docutils"> -<dt>NetworkXError</dt> -<dd>If there is not an edge between u and v.</dd> -</dl> -<p>remove_edges_from : remove a collection of edges</p> -<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">G</span> <span class="o">=</span> <span class="n">nx</span><span class="o">.</span><span class="n">Graph</span><span class="p">()</span> <span class="c1"># or DiGraph, etc</span> -<span class="gp">>>> </span><span class="n">nx</span><span class="o">.</span><span class="n">add_path</span><span class="p">(</span><span class="n">G</span><span class="p">,</span> <span class="p">[</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">])</span> -<span class="gp">>>> </span><span class="n">G</span><span class="o">.</span><span class="n">remove_edge</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span> -<span class="gp">>>> </span><span class="n">e</span> <span class="o">=</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">)</span> -<span class="gp">>>> </span><span class="n">G</span><span class="o">.</span><span class="n">remove_edge</span><span class="p">(</span><span class="o">*</span><span class="n">e</span><span class="p">)</span> <span class="c1"># unpacks e from an edge tuple</span> -<span class="gp">>>> </span><span class="n">e</span> <span class="o">=</span> <span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="p">{</span><span class="s1">'weight'</span><span class="p">:</span><span class="mi">7</span><span class="p">})</span> <span class="c1"># an edge with attribute data</span> -<span class="gp">>>> </span><span class="n">G</span><span class="o">.</span><span class="n">remove_edge</span><span class="p">(</span><span class="o">*</span><span class="n">e</span><span class="p">[:</span><span class="mi">2</span><span class="p">])</span> <span class="c1"># select first part of edge tuple</span> -</pre></div> -</div> -</dd></dl> - -<dl class="method"> -<dt id="kadmos.graph.graph_data.DataGraph.remove_edges_from"> -<code class="descname">remove_edges_from</code><span class="sig-paren">(</span><em>ebunch</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.remove_edges_from" title="Permalink to this definition">¶</a></dt> -<dd><p>Remove all edges specified in ebunch.</p> -<dl class="docutils"> -<dt>ebunch: list or container of edge tuples</dt> -<dd><p class="first">Each edge given in the list or container will be removed -from the graph. The edges can be:</p> -<blockquote class="last"> -<div><ul class="simple"> -<li>2-tuples (u, v) edge between u and v.</li> -<li>3-tuples (u, v, k) where k is ignored.</li> -</ul> -</div></blockquote> -</dd> -</dl> -<p>remove_edge : remove a single edge</p> -<p>Will fail silently if an edge in ebunch is not in the graph.</p> -<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">G</span> <span class="o">=</span> <span class="n">nx</span><span class="o">.</span><span class="n">path_graph</span><span class="p">(</span><span class="mi">4</span><span class="p">)</span> <span class="c1"># or DiGraph, MultiGraph, MultiDiGraph, etc</span> -<span class="gp">>>> </span><span class="n">ebunch</span> <span class="o">=</span> <span class="p">[(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">),</span> <span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">)]</span> -<span class="gp">>>> </span><span class="n">G</span><span class="o">.</span><span class="n">remove_edges_from</span><span class="p">(</span><span class="n">ebunch</span><span class="p">)</span> -</pre></div> -</div> -</dd></dl> - -<dl class="method"> -<dt id="kadmos.graph.graph_data.DataGraph.remove_function_nodes"> -<code class="descname">remove_function_nodes</code><span class="sig-paren">(</span><em>*args</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.remove_function_nodes" title="Permalink to this definition">¶</a></dt> -<dd><p>Function that removes a function node</p> -<p>Also the input and output variables that only have links to this specific function node are deleted. A simple -remove_node of a function node might lead to unconnected variables in the graph.</p> -<table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>args</strong> (<em>str</em><em> or </em><em>list</em>) – function node id(s)</td> -</tr> -</tbody> -</table> -</dd></dl> - -<dl class="method"> -<dt id="kadmos.graph.graph_data.DataGraph.remove_node"> -<code class="descname">remove_node</code><span class="sig-paren">(</span><em>n</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.remove_node" title="Permalink to this definition">¶</a></dt> -<dd><p>Remove node n.</p> -<p>Removes the node n and all adjacent edges. -Attempting to remove a non-existent node will raise an exception.</p> -<dl class="docutils"> -<dt>n <span class="classifier-delimiter">:</span> <span class="classifier">node</span></dt> -<dd>A node in the graph</dd> -</dl> -<dl class="docutils"> -<dt>NetworkXError</dt> -<dd>If n is not in the graph.</dd> -</dl> -<p>remove_nodes_from</p> -<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">G</span> <span class="o">=</span> <span class="n">nx</span><span class="o">.</span><span class="n">path_graph</span><span class="p">(</span><span class="mi">3</span><span class="p">)</span> <span class="c1"># or DiGraph, MultiGraph, MultiDiGraph, etc</span> -<span class="gp">>>> </span><span class="nb">list</span><span class="p">(</span><span class="n">G</span><span class="o">.</span><span class="n">edges</span><span class="p">)</span> -<span class="go">[(0, 1), (1, 2)]</span> -<span class="gp">>>> </span><span class="n">G</span><span class="o">.</span><span class="n">remove_node</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span> -<span class="gp">>>> </span><span class="nb">list</span><span class="p">(</span><span class="n">G</span><span class="o">.</span><span class="n">edges</span><span class="p">)</span> -<span class="go">[]</span> -</pre></div> -</div> -</dd></dl> - -<dl class="method"> -<dt id="kadmos.graph.graph_data.DataGraph.remove_nodes_from"> -<code class="descname">remove_nodes_from</code><span class="sig-paren">(</span><em>nodes</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.remove_nodes_from" title="Permalink to this definition">¶</a></dt> -<dd><p>Remove multiple nodes.</p> -<dl class="docutils"> -<dt>nodes <span class="classifier-delimiter">:</span> <span class="classifier">iterable container</span></dt> -<dd>A container of nodes (list, dict, set, etc.). If a node -in the container is not in the graph it is silently ignored.</dd> -</dl> -<p>remove_node</p> -<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">G</span> <span class="o">=</span> <span class="n">nx</span><span class="o">.</span><span class="n">path_graph</span><span class="p">(</span><span class="mi">3</span><span class="p">)</span> <span class="c1"># or DiGraph, MultiGraph, MultiDiGraph, etc</span> -<span class="gp">>>> </span><span class="n">e</span> <span class="o">=</span> <span class="nb">list</span><span class="p">(</span><span class="n">G</span><span class="o">.</span><span class="n">nodes</span><span class="p">)</span> -<span class="gp">>>> </span><span class="n">e</span> -<span class="go">[0, 1, 2]</span> -<span class="gp">>>> </span><span class="n">G</span><span class="o">.</span><span class="n">remove_nodes_from</span><span class="p">(</span><span class="n">e</span><span class="p">)</span> -<span class="gp">>>> </span><span class="nb">list</span><span class="p">(</span><span class="n">G</span><span class="o">.</span><span class="n">nodes</span><span class="p">)</span> -<span class="go">[]</span> -</pre></div> -</div> -</dd></dl> - -<dl class="method"> -<dt id="kadmos.graph.graph_data.DataGraph.remove_unused_outputs"> -<code class="descname">remove_unused_outputs</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.remove_unused_outputs" title="Permalink to this definition">¶</a></dt> -<dd><p>Function to remove output nodes from an FPG which do not have a problem role.</p> -<table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">the nodes that were removed</td> -</tr> -<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">list</td> -</tr> -</tbody> -</table> -</dd></dl> - -<dl class="method"> -<dt id="kadmos.graph.graph_data.DataGraph.reverse"> -<code class="descname">reverse</code><span class="sig-paren">(</span><em>copy=True</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.reverse" title="Permalink to this definition">¶</a></dt> -<dd><p>Return the reverse of the graph.</p> -<p>The reverse is a graph with the same nodes and edges -but with the directions of the edges reversed.</p> -<dl class="docutils"> -<dt>copy <span class="classifier-delimiter">:</span> <span class="classifier">bool optional (default=True)</span></dt> -<dd>If True, return a new DiGraph holding the reversed edges. -If False, the reverse graph is created using a view of -the original graph.</dd> -</dl> -</dd></dl> - -<dl class="method"> -<dt id="kadmos.graph.graph_data.DataGraph.save"> -<code class="descname">save</code><span class="sig-paren">(</span><em>file_name</em>, <em>file_type='kdms'</em>, <em>graph_check_critical=True</em>, <em>destination_folder=None</em>, <em>mpg=None</em>, <em>description=''</em>, <em>creator=''</em>, <em>version='1.0'</em>, <em>timestamp=datetime.datetime(2018</em>, <em>3</em>, <em>31</em>, <em>17</em>, <em>25</em>, <em>15</em>, <em>655000)</em>, <em>keep_empty_elements=False</em>, <em>pretty_print=False</em>, <em>convention=True</em>, <em>integrity=False</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.save" title="Permalink to this definition">¶</a></dt> -<dd><p>Method to save the graph.</p> -<p>Different output file types are implemented for saving graphs. They are listed below:</p> -<ul class="simple"> -<li>kdms: the most simple file type which makes use of pickling</li> -<li>cmdows: the most versatile file type especially suited for file exchange with other tools</li> -<li>graphml: another file type especially suited for file exchange with other tools based on graphs</li> -</ul> -<table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple"> -<li><strong>file_name</strong> (<em>str</em>) – name of the file to be saved</li> -<li><strong>file_type</strong> (<em>str</em>) – file_type</li> -<li><strong>graph_check_critical</strong> (<em>bool</em>) – option for raising errors in case of an invalid graph</li> -<li><strong>destination_folder</strong> (<em>str</em>) – destination folder for the file to be saved</li> -<li><strong>mpg</strong> (<a class="reference internal" href="#kadmos.graph.graph_process.MdaoProcessGraph" title="kadmos.graph.graph_process.MdaoProcessGraph"><em>MdaoProcessGraph</em></a>) – optional MPG graph to be saved with MDG</li> -<li><strong>description</strong> (<em>str</em>) – description of the file (only applicable for the cmdows file type)</li> -<li><strong>creator</strong> (<em>str</em>) – name of the creator of the file (only applicable for the cmdows file type)</li> -<li><strong>version</strong> (<em>str | float | int</em>) – version of the file (only applicable for the cmdows file type)</li> -<li><strong>timestamp</strong> (<em>datetime</em>) – timestamp to be saved in the file (only applicable for the cmdows file type)</li> -<li><strong>keep_empty_elements</strong> (<em>bool</em>) – option for keeping empty XML elements (only applicable for the cmdows file type)</li> -<li><strong>pretty_print</strong> (<em>bool</em>) – option for pretty XML printing (only applicable for the cmdows file type)</li> -<li><strong>convention</strong> (<em>bool</em>) – option for appyling a UID convention (only applicable for the cmdows file type)</li> -<li><strong>integrity</strong> (<em>bool</em>) – option for doing an integrity file check (only applicable for the cmdows file type)</li> -</ul> -</td> -</tr> -</tbody> -</table> -</dd></dl> - -<dl class="method"> -<dt id="kadmos.graph.graph_data.DataGraph.select_objectives_from_graph"> -<code class="descname">select_objectives_from_graph</code><span class="sig-paren">(</span><em>*args</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.select_objectives_from_graph" title="Permalink to this definition">¶</a></dt> -<dd><p>This functions lets the user select one or more objective functions from the graph.</p> -<p>Only functions can be selected as objectives. If no arguments are provided, user is prompted to select an -objective from all functions in graph.</p> -<table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Param:</th><td class="field-body">args: objective functions to choose from</td> -</tr> -<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">list of objective functions</td> -</tr> -</tbody> -</table> -</dd></dl> - -<dl class="method"> -<dt id="kadmos.graph.graph_data.DataGraph.size"> -<code class="descname">size</code><span class="sig-paren">(</span><em>weight=None</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.size" title="Permalink to this definition">¶</a></dt> -<dd><p>Return the number of edges or total of all edge weights.</p> -<dl class="docutils"> -<dt>weight <span class="classifier-delimiter">:</span> <span class="classifier">string or None, optional (default=None)</span></dt> -<dd>The edge attribute that holds the numerical value used -as a weight. If None, then each edge has weight 1.</dd> -</dl> -<dl class="docutils"> -<dt>size <span class="classifier-delimiter">:</span> <span class="classifier">numeric</span></dt> -<dd><p class="first">The number of edges or -(if weight keyword is provided) the total weight sum.</p> -<p class="last">If weight is None, returns an int. Otherwise a float -(or more general numeric if the weights are more general).</p> -</dd> -</dl> -<p>number_of_edges</p> -<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">G</span> <span class="o">=</span> <span class="n">nx</span><span class="o">.</span><span class="n">path_graph</span><span class="p">(</span><span class="mi">4</span><span class="p">)</span> <span class="c1"># or DiGraph, MultiGraph, MultiDiGraph, etc</span> -<span class="gp">>>> </span><span class="n">G</span><span class="o">.</span><span class="n">size</span><span class="p">()</span> -<span class="go">3</span> -</pre></div> -</div> -<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">G</span> <span class="o">=</span> <span class="n">nx</span><span class="o">.</span><span class="n">Graph</span><span class="p">()</span> <span class="c1"># or DiGraph, MultiGraph, MultiDiGraph, etc</span> -<span class="gp">>>> </span><span class="n">G</span><span class="o">.</span><span class="n">add_edge</span><span class="p">(</span><span class="s1">'a'</span><span class="p">,</span> <span class="s1">'b'</span><span class="p">,</span> <span class="n">weight</span><span class="o">=</span><span class="mi">2</span><span class="p">)</span> -<span class="gp">>>> </span><span class="n">G</span><span class="o">.</span><span class="n">add_edge</span><span class="p">(</span><span class="s1">'b'</span><span class="p">,</span> <span class="s1">'c'</span><span class="p">,</span> <span class="n">weight</span><span class="o">=</span><span class="mi">4</span><span class="p">)</span> -<span class="gp">>>> </span><span class="n">G</span><span class="o">.</span><span class="n">size</span><span class="p">()</span> -<span class="go">2</span> -<span class="gp">>>> </span><span class="n">G</span><span class="o">.</span><span class="n">size</span><span class="p">(</span><span class="n">weight</span><span class="o">=</span><span class="s1">'weight'</span><span class="p">)</span> -<span class="go">6.0</span> -</pre></div> -</div> -</dd></dl> - -<dl class="method"> -<dt id="kadmos.graph.graph_data.DataGraph.sort_non_coupled_nodes"> -<code class="descname">sort_non_coupled_nodes</code><span class="sig-paren">(</span><em>nodes</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.sort_non_coupled_nodes" title="Permalink to this definition">¶</a></dt> -<dd><p>Function to sort the pre and post coupling nodes</p> -<table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>nodes</strong> (<em>list</em>) – nodes that need to be sorted</td> -</tr> -<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">nodes in sorted order</td> -</tr> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body">list</td> -</tr> -</tbody> -</table> -</dd></dl> - -<dl class="method"> -<dt id="kadmos.graph.graph_data.DataGraph.split_variables"> -<code class="descname">split_variables</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.split_variables" title="Permalink to this definition">¶</a></dt> -<dd><p>Method to split a problematic variable node into multiple separate valid nodes.</p> -<p>The following variables are considered problematic and will be handled by this function:</p> -<blockquote> -<div><ul> -<li><p class="first">pure circular coupling</p> -</li> -<li><p class="first">shared circular coupling</p> -</li> -<li><p class="first">collided coupling</p> -</li> -<li><p class="first">collision</p> -</li> -<li><p class="first">collided circular coupling</p> -</li> -<li><p class="first">collided shared coupling</p> -</li> -<li><p class="first">collided shared circular coupling</p> -<blockquote> -<div><p>The following table shows an example situation for each of the different problematic variables:</p> -</div></blockquote> -</li> -</ul> -</div></blockquote> -<table border="1" class="docutils"> -<colgroup> -<col width="22%" /> -<col width="24%" /> -<col width="16%" /> -<col width="39%" /> -</colgroup> -<thead valign="bottom"> -<tr class="row-odd"><th class="head">PROBLEMATIC VARIABLE</th> -<th class="head">SITUATION</th> -<th class="head">FUNCTION ORDER</th> -<th class="head">RESOLVED AS</th> -</tr> -</thead> -<tbody valign="top"> -<tr class="row-even"><td>pure circular -coupling</td> -<td>x1 <=> F1</td> -<td>n.a.</td> -<td>x1/variableInstance1 => F1 => -x1/variableInstance2</td> -</tr> -<tr class="row-odd"><td>shared circular -coupling</td> -<td>F1 <=> x1 => F2, F3</td> -<td>n.a.</td> -<td><dl class="first last docutils"> -<dt>x1/variableInstance1 => F1 =></dt> -<dd>x1/variableInstance2 => F2, F3, etc.</dd> -</dl> -</td> -</tr> -<tr class="row-even"><td rowspan="2">collided (shared) -coupling</td> -<td rowspan="2">F1, F3 => x1 => F2, F4</td> -<td rowspan="2">F1, F2, F3, F4</td> -<td>F1 => x1/variableInstance1 => F2</td> -</tr> -<tr class="row-odd"><td>F3 => x1/variableInstance2 => F4</td> -</tr> -<tr class="row-even"><td rowspan="2">collision</td> -<td rowspan="2">F1, F2 => x1</td> -<td rowspan="2">F1, F2</td> -<td>F1 => x1/variableInstance1</td> -</tr> -<tr class="row-odd"><td>F2 => x1/variableInstance2</td> -</tr> -<tr class="row-even"><td rowspan="3">collided circular -coupling</td> -<td rowspan="3">F1 <=> x1 <= F2, F3</td> -<td rowspan="3">n.a.</td> -<td>x1/variableInstance1 => F1 => -x1/variableInstance2</td> -</tr> -<tr class="row-odd"><td>F2 => x1/variableInstance3</td> -</tr> -<tr class="row-even"><td>F3 => x1/variableInstance4</td> -</tr> -<tr class="row-odd"><td rowspan="4">collided shared -circular coupling</td> -<td rowspan="4">F3, F5 <=> x1 <= F2 -x1 => F1, F4, F6</td> -<td rowspan="4">F1, F2, F3, F4, -F5, F6</td> -<td>x1/variableInstance1 => F2 => (..)</td> -</tr> -<tr class="row-even"><td>x1/variableInstance2 => F1, F3 => (..)</td> -</tr> -<tr class="row-odd"><td>x1/variableInstance3 => F4, F5 => (..)</td> -</tr> -<tr class="row-even"><td>x1/variableInstance4 => F6</td> -</tr> -</tbody> -</table> -<table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>args</strong> (<em>basestring</em><em>, </em><em>list</em>) – problematic node in the graph</td> -</tr> -</tbody> -</table> -</dd></dl> - -<dl class="method"> -<dt id="kadmos.graph.graph_data.DataGraph.subgraph"> -<code class="descname">subgraph</code><span class="sig-paren">(</span><em>nodes</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.subgraph" title="Permalink to this definition">¶</a></dt> -<dd><p>Return a SubGraph view of the subgraph induced on <cite>nodes</cite>.</p> -<p>The induced subgraph of the graph contains the nodes in <cite>nodes</cite> -and the edges between those nodes.</p> -<dl class="docutils"> -<dt>nodes <span class="classifier-delimiter">:</span> <span class="classifier">list, iterable</span></dt> -<dd>A container of nodes which will be iterated through once.</dd> -</dl> -<dl class="docutils"> -<dt>G <span class="classifier-delimiter">:</span> <span class="classifier">SubGraph View</span></dt> -<dd>A subgraph view of the graph. The graph structure cannot be -changed but node/edge attributes can and are shared with the -original graph.</dd> -</dl> -<p>The graph, edge and node attributes are shared with the original graph. -Changes to the graph structure is ruled out by the view, but changes -to attributes are reflected in the original graph.</p> -<p>To create a subgraph with its own copy of the edge/node attributes use: -G.subgraph(nodes).copy()</p> -<p>For an inplace reduction of a graph to a subgraph you can remove nodes: -G.remove_nodes_from([n for n in G if n not in set(nodes)])</p> -<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">G</span> <span class="o">=</span> <span class="n">nx</span><span class="o">.</span><span class="n">path_graph</span><span class="p">(</span><span class="mi">4</span><span class="p">)</span> <span class="c1"># or DiGraph, MultiGraph, MultiDiGraph, etc</span> -<span class="gp">>>> </span><span class="n">H</span> <span class="o">=</span> <span class="n">G</span><span class="o">.</span><span class="n">subgraph</span><span class="p">([</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">])</span> -<span class="gp">>>> </span><span class="nb">list</span><span class="p">(</span><span class="n">H</span><span class="o">.</span><span class="n">edges</span><span class="p">)</span> -<span class="go">[(0, 1), (1, 2)]</span> -</pre></div> -</div> -</dd></dl> - -<dl class="attribute"> -<dt id="kadmos.graph.graph_data.DataGraph.succ"> -<code class="descname">succ</code><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.succ" title="Permalink to this definition">¶</a></dt> -<dd><p>Graph adjacency object holding the successors of each node.</p> -<p>This object is a read-only dict-like structure with node keys -and neighbor-dict values. The neighbor-dict is keyed by neighbor -to the edge-data-dict. So <cite>G.succ[3][2][‘color’] = ‘blue’</cite> sets -the color of the edge <cite>(3, 2)</cite> to <cite>“blueâ€</cite>.</p> -<p>Iterating over G.succ behaves like a dict. Useful idioms include -<cite>for nbr, datadict in G.succ[n].items():</cite>. A data-view not provided -by dicts also exists: <cite>for nbr, foovalue in G.succ[node].data(‘foo’):</cite> -and a default can be set via a <cite>default</cite> argument to the <cite>data</cite> method.</p> -<p>The neighbor information is also provided by subscripting the graph. -So <cite>for nbr, foovalue in G[node].data(‘foo’, default=1):</cite> works.</p> -<p>For directed graphs, <cite>G.adj</cite> is identical to <cite>G.succ</cite>.</p> -</dd></dl> - -<dl class="method"> -<dt id="kadmos.graph.graph_data.DataGraph.successors"> -<code class="descname">successors</code><span class="sig-paren">(</span><em>n</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.successors" title="Permalink to this definition">¶</a></dt> -<dd><p>Return an iterator over successor nodes of n.</p> -<p>neighbors() and successors() are the same.</p> -</dd></dl> - -<dl class="method"> -<dt id="kadmos.graph.graph_data.DataGraph.to_directed"> -<code class="descname">to_directed</code><span class="sig-paren">(</span><em>as_view=False</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.to_directed" title="Permalink to this definition">¶</a></dt> -<dd><p>Return a directed representation of the graph.</p> -<dl class="docutils"> -<dt>G <span class="classifier-delimiter">:</span> <span class="classifier">DiGraph</span></dt> -<dd>A directed graph with the same name, same nodes, and with -each edge (u, v, data) replaced by two directed edges -(u, v, data) and (v, u, data).</dd> -</dl> -<p>This returns a “deepcopy†of the edge, node, and -graph attributes which attempts to completely copy -all of the data and references.</p> -<p>This is in contrast to the similar D=DiGraph(G) which returns a -shallow copy of the data.</p> -<p>See the Python copy module for more information on shallow -and deep copies, <a class="reference external" href="https://docs.python.org/2/library/copy.html">https://docs.python.org/2/library/copy.html</a>.</p> -<p>Warning: If you have subclassed Graph to use dict-like objects -in the data structure, those changes do not transfer to the -DiGraph created by this method.</p> -<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">G</span> <span class="o">=</span> <span class="n">nx</span><span class="o">.</span><span class="n">Graph</span><span class="p">()</span> <span class="c1"># or MultiGraph, etc</span> -<span class="gp">>>> </span><span class="n">G</span><span class="o">.</span><span class="n">add_edge</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span> -<span class="gp">>>> </span><span class="n">H</span> <span class="o">=</span> <span class="n">G</span><span class="o">.</span><span class="n">to_directed</span><span class="p">()</span> -<span class="gp">>>> </span><span class="nb">list</span><span class="p">(</span><span class="n">H</span><span class="o">.</span><span class="n">edges</span><span class="p">)</span> -<span class="go">[(0, 1), (1, 0)]</span> -</pre></div> -</div> -<p>If already directed, return a (deep) copy</p> -<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">G</span> <span class="o">=</span> <span class="n">nx</span><span class="o">.</span><span class="n">DiGraph</span><span class="p">()</span> <span class="c1"># or MultiDiGraph, etc</span> -<span class="gp">>>> </span><span class="n">G</span><span class="o">.</span><span class="n">add_edge</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span> -<span class="gp">>>> </span><span class="n">H</span> <span class="o">=</span> <span class="n">G</span><span class="o">.</span><span class="n">to_directed</span><span class="p">()</span> -<span class="gp">>>> </span><span class="nb">list</span><span class="p">(</span><span class="n">H</span><span class="o">.</span><span class="n">edges</span><span class="p">)</span> -<span class="go">[(0, 1)]</span> -</pre></div> -</div> -</dd></dl> - -<dl class="method"> -<dt id="kadmos.graph.graph_data.DataGraph.to_undirected"> -<code class="descname">to_undirected</code><span class="sig-paren">(</span><em>reciprocal=False</em>, <em>as_view=False</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.to_undirected" title="Permalink to this definition">¶</a></dt> -<dd><p>Return an undirected representation of the digraph.</p> -<dl class="docutils"> -<dt>reciprocal <span class="classifier-delimiter">:</span> <span class="classifier">bool (optional)</span></dt> -<dd>If True only keep edges that appear in both directions -in the original digraph.</dd> -<dt>as_view <span class="classifier-delimiter">:</span> <span class="classifier">bool (optional, default=False)</span></dt> -<dd>If True return an undirected view of the original directed graph.</dd> -</dl> -<dl class="docutils"> -<dt>G <span class="classifier-delimiter">:</span> <span class="classifier">Graph</span></dt> -<dd>An undirected graph with the same name and nodes and -with edge (u, v, data) if either (u, v, data) or (v, u, data) -is in the digraph. If both edges exist in digraph and -their edge data is different, only one edge is created -with an arbitrary choice of which edge data to use. -You must check and correct for this manually if desired.</dd> -</dl> -<p>Graph, copy, add_edge, add_edges_from</p> -<p>If edges in both directions (u, v) and (v, u) exist in the -graph, attributes for the new undirected edge will be a combination of -the attributes of the directed edges. The edge data is updated -in the (arbitrary) order that the edges are encountered. For -more customized control of the edge attributes use add_edge().</p> -<p>This returns a “deepcopy†of the edge, node, and -graph attributes which attempts to completely copy -all of the data and references.</p> -<p>This is in contrast to the similar G=DiGraph(D) which returns a -shallow copy of the data.</p> -<p>See the Python copy module for more information on shallow -and deep copies, <a class="reference external" href="https://docs.python.org/2/library/copy.html">https://docs.python.org/2/library/copy.html</a>.</p> -<p>Warning: If you have subclassed DiGraph to use dict-like objects -in the data structure, those changes do not transfer to the -Graph created by this method.</p> -<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">G</span> <span class="o">=</span> <span class="n">nx</span><span class="o">.</span><span class="n">path_graph</span><span class="p">(</span><span class="mi">2</span><span class="p">)</span> <span class="c1"># or MultiGraph, etc</span> -<span class="gp">>>> </span><span class="n">H</span> <span class="o">=</span> <span class="n">G</span><span class="o">.</span><span class="n">to_directed</span><span class="p">()</span> -<span class="gp">>>> </span><span class="nb">list</span><span class="p">(</span><span class="n">H</span><span class="o">.</span><span class="n">edges</span><span class="p">)</span> -<span class="go">[(0, 1), (1, 0)]</span> -<span class="gp">>>> </span><span class="n">G2</span> <span class="o">=</span> <span class="n">H</span><span class="o">.</span><span class="n">to_undirected</span><span class="p">()</span> -<span class="gp">>>> </span><span class="nb">list</span><span class="p">(</span><span class="n">G2</span><span class="o">.</span><span class="n">edges</span><span class="p">)</span> -<span class="go">[(0, 1)]</span> -</pre></div> -</div> -</dd></dl> - -<dl class="method"> -<dt id="kadmos.graph.graph_data.DataGraph.unmark_variable"> -<code class="descname">unmark_variable</code><span class="sig-paren">(</span><em>node</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.unmark_variable" title="Permalink to this definition">¶</a></dt> -<dd><p>Function to unmark any marked variable.</p> -<table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>node</strong> (<em>basestring</em>) – variable node to be unmarked</td> -</tr> -</tbody> -</table> -</dd></dl> - -<dl class="method"> -<dt id="kadmos.graph.graph_data.DataGraph.vistoms_add"> -<code class="descname">vistoms_add</code><span class="sig-paren">(</span><em>vistoms_dir</em>, <em>mpg=None</em>, <em>function_order=None</em>, <em>reference_file=None</em>, <em>compress=False</em>, <em>remove_after_compress=True</em>, <em>graph_id=None</em>, <em>replacement_id=None</em>, <em>xml_file=None</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.vistoms_add" title="Permalink to this definition">¶</a></dt> -<dd><p>Function to add a graph to a existing VISTOMS instance.</p> -<p>In one VISTOMS instance different graphs can be shown. For example it is possible to include different -architectures for the same problem in one VISTOMS instance.</p> -<table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple"> -<li><strong>vistoms_dir</strong> (<em>str</em>) – directory of the VISTOMS directory to be used for addition</li> -<li><strong>mpg</strong> (<a class="reference internal" href="#kadmos.graph.graph_process.MdaoProcessGraph" title="kadmos.graph.graph_process.MdaoProcessGraph"><em>MdaoProcessGraph</em></a>) – optional MPG graph to be saved with MDG as XDSM (if None a DSM is created)</li> -<li><strong>function_order</strong> (<em>list</em>) – optional function order for the diagonal of the graph (only applicable for DSMs)</li> -<li><strong>reference_file</strong> (<em>str</em>) – file from which reference values are extracted (either full path or file in same folder)</li> -<li><strong>compress</strong> (<em>bool</em>) – setting whether to compress the final VISTOMS instance folder to a zip file</li> -<li><strong>remove_after_compress</strong> (<em>bool</em>) – setting whether to remove the original folder after compression</li> -<li><strong>replacement_id</strong> (<em>basestr</em>) – indentifier of the graph to be replaced</li> -<li><strong>xml_file</strong> (<em>file</em>) – Name of the CMDOWS xml-file</li> -</ul> -</td> -</tr> -</tbody> -</table> -</dd></dl> - -<dl class="method"> -<dt id="kadmos.graph.graph_data.DataGraph.vistoms_create"> -<code class="descname">vistoms_create</code><span class="sig-paren">(</span><em>vistoms_dir</em>, <em>vistoms_version=None</em>, <em>mpg=None</em>, <em>function_order=None</em>, <em>reference_file=None</em>, <em>compress=False</em>, <em>remove_after_compress=True</em>, <em>graph_id=None</em>, <em>use_png_figs=False</em>, <em>file_refs=None</em>, <em>xml_file=None</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.DataGraph.vistoms_create" title="Permalink to this definition">¶</a></dt> -<dd><p>Function to create a new VISTOMS instance from a graph.</p> -<table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple"> -<li><strong>vistoms_dir</strong> (<em>str</em>) – directory of the VISTOMS directory to be created</li> -<li><strong>vistoms_version</strong> – version of the VISTOMS instance to be used (as stored in the package itself)</li> -<li><strong>vispack_version</strong> – str</li> -<li><strong>mpg</strong> (<a class="reference internal" href="#kadmos.graph.graph_process.MdaoProcessGraph" title="kadmos.graph.graph_process.MdaoProcessGraph"><em>MdaoProcessGraph</em></a>) – optional MPG graph to be saved with MDG as XDSM (if None a DSM is created)</li> -<li><strong>function_order</strong> (<em>list</em>) – optional function order for the diagonal of the graph (only applicable for DSMs)</li> -<li><strong>reference_file</strong> (<em>str</em>) – file from which reference values are extracted (either full path or file in same folder)</li> -<li><strong>compress</strong> (<em>bool</em>) – setting whether to compress the final VISTOMS instance folder to a zip file</li> -<li><strong>remove_after_compress</strong> (<em>bool</em>) – setting whether to remove the original folder after compression</li> -<li><strong>graph_id</strong> (<em>basestring</em>) – identifier of the new graph</li> -<li><strong>use_png_figs</strong> (<em>bool</em>) – setting whether to use the PNG figures instead of the SVG figures for local execution</li> -<li><strong>file_refs</strong> (<em>dict</em>) – setting to provide file references manually (to use VISTOMS on a server)</li> -<li><strong>xml_file</strong> (<em>file</em>) – Name of the CMDOWS xml file</li> -</ul> -</td> -</tr> -</tbody> -</table> -</dd></dl> - -</dd></dl> - -</div> -<div class="section" id="repositoryconnectivitygraph"> -<h3>RepositoryConnectivityGraph<a class="headerlink" href="#repositoryconnectivitygraph" title="Permalink to this headline">¶</a></h3> -<dl class="class"> -<dt id="kadmos.graph.graph_data.RepositoryConnectivityGraph"> -<em class="property">class </em><code class="descclassname">kadmos.graph.graph_data.</code><code class="descname">RepositoryConnectivityGraph</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.RepositoryConnectivityGraph" title="Permalink to this definition">¶</a></dt> -<dd><dl class="method"> -<dt id="kadmos.graph.graph_data.RepositoryConnectivityGraph.create_mathematical_problem"> -<code class="descname">create_mathematical_problem</code><span class="sig-paren">(</span><em>n_disciplines</em>, <em>coupling_strength=None</em>, <em>n_global_var=None</em>, <em>n_local_var=None</em>, <em>n_coupling_var=None</em>, <em>n_local_constraints=None</em>, <em>n_global_constraints=None</em>, <em>B=None</em>, <em>C=None</em>, <em>D=None</em>, <em>E=None</em>, <em>F=None</em>, <em>G=None</em>, <em>H=None</em>, <em>I=None</em>, <em>J=None</em>, <em>r=None</em>, <em>s=None</em>, <em>write_problem_to_textfile=False</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.RepositoryConnectivityGraph.create_mathematical_problem" title="Permalink to this definition">¶</a></dt> -<dd><p>Function to get a mathematical problem according to the variable complexity problem as described in: -Zhang D., Song B., Wang P. and He Y. ‘Performance Evaluation of MDO Architectures within a Variable -Complexity Problem’, Mathematical Problems in Engineering, 2017.</p> -<table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple"> -<li><strong>n_disciplines</strong> – Number of disciplines</li> -<li><strong>coupling_strength</strong> – percentage of couplings, 0 no couplings, 1 all possible couplings</li> -<li><strong>n_global_var</strong> – Number of global design variables</li> -<li><strong>n_local_var</strong> – Number of local design variables for each discipline</li> -<li><strong>n_coupling_var</strong> – Number of output variables for each discipline</li> -<li><strong>n_local_constraints</strong> – Number of local constraints</li> -<li><strong>n_global_constraints</strong> – Number of global constraints</li> -<li><strong>B</strong> – relation between the coupling variables</li> -<li><strong>C</strong> – relation between the global design variables and coupling variables</li> -<li><strong>D</strong> – relation between the local design variables and coupling variables</li> -<li><strong>E</strong> – relation between the global design variables and local constraints</li> -<li><strong>F</strong> – relation between the local design variables and local constraints</li> -<li><strong>G</strong> – relation between the coupling variables and local constraints</li> -<li><strong>H</strong> – relation between the global design variables and global constraints</li> -<li><strong>I</strong> – relation between the local design variables and global constraints</li> -<li><strong>J</strong> – relation between the coupling variables and global constraints</li> -<li><strong>r</strong> – positive scalars to be used for the local constraints</li> -<li><strong>s</strong> – positive scalars to be used for the global constraints</li> -<li><strong>write_problem_to_textfile</strong> – option to write generated problem to a textfile</li> -</ul> -</td> -</tr> -</tbody> -</table> -</dd></dl> - -<dl class="method"> -<dt id="kadmos.graph.graph_data.RepositoryConnectivityGraph.get_fpg_based_on_function_nodes"> -<code class="descname">get_fpg_based_on_function_nodes</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.RepositoryConnectivityGraph.get_fpg_based_on_function_nodes" title="Permalink to this definition">¶</a></dt> -<dd><p>Function to get the Fundamental Problem Graph based on a list of (or a single) function.</p> -<table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> -<li><strong>args</strong> (<em>str</em>) – node names of functions of interest</li> -<li><strong>kwargs</strong> (<em>name: str</em>) – name: name of the graph to be generated</li> -</ul> -</td> -</tr> -<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">Fundamental Problem Graph object</p> -</td> -</tr> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last"><a class="reference internal" href="#kadmos.graph.graph_data.FundamentalProblemGraph" title="kadmos.graph.graph_data.FundamentalProblemGraph">FundamentalProblemGraph</a></p> -</td> -</tr> -</tbody> -</table> -</dd></dl> - -<dl class="method"> -<dt id="kadmos.graph.graph_data.RepositoryConnectivityGraph.get_fpg_based_on_list_functions"> -<code class="descname">get_fpg_based_on_list_functions</code><span class="sig-paren">(</span><em>list_of_functions</em>, <em>name='FPG'</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.RepositoryConnectivityGraph.get_fpg_based_on_list_functions" title="Permalink to this definition">¶</a></dt> -<dd><p>Function to get a Fundamental Problem Graph based on a list of functions.</p> -<table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> -<li><strong>list_of_functions</strong> (<em>list</em>) – list with strings that specify the desired functions</li> -<li><strong>name</strong> (<em>str</em>) – name of the graph to be generated</li> -</ul> -</td> -</tr> -<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">Fundamental Problem Graph object</p> -</td> -</tr> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last"><a class="reference internal" href="#kadmos.graph.graph_data.FundamentalProblemGraph" title="kadmos.graph.graph_data.FundamentalProblemGraph">FundamentalProblemGraph</a></p> -</td> -</tr> -</tbody> -</table> -</dd></dl> - -<dl class="method"> -<dt id="kadmos.graph.graph_data.RepositoryConnectivityGraph.get_fpg_based_on_sinks"> -<code class="descname">get_fpg_based_on_sinks</code><span class="sig-paren">(</span><em>list_of_sinks</em>, <em>name='FPG'</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.RepositoryConnectivityGraph.get_fpg_based_on_sinks" title="Permalink to this definition">¶</a></dt> -<dd><p>Function to get the a Fundamental Problem Graph based on a list of sinks/required output variables.</p> -<table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> -<li><strong>list_of_sinks</strong> (<em>list</em>) – list with strings that specify the desired output</li> -<li><strong>name</strong> (<em>str</em>) – name of the graph to be generated</li> -</ul> -</td> -</tr> -<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">Fundamental Problem Graph object</p> -</td> +<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">function ordering dictionary</td> </tr> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last"><a class="reference internal" href="#kadmos.graph.graph_data.FundamentalProblemGraph" title="kadmos.graph.graph_data.FundamentalProblemGraph">FundamentalProblemGraph</a></p> -</td> +<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">dict</td> </tr> </tbody> </table> +<div class="admonition note"> +<p class="first admonition-title">Note</p> +<p class="last">Function ordering has to be adjusted when design variables are used. In that case, the pre-coupling +functions have to be divided in two parts: the first part does not use the design variables yet, while the +second does.</p> +</div> </dd></dl> <dl class="method"> -<dt id="kadmos.graph.graph_data.RepositoryConnectivityGraph.get_fpg_by_function_nodes"> -<code class="descname">get_fpg_by_function_nodes</code><span class="sig-paren">(</span><em>*args</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.RepositoryConnectivityGraph.get_fpg_by_function_nodes" title="Permalink to this definition">¶</a></dt> -<dd><p>This function creates a new (FPG)-graph based on the selected function nodes.</p> +<dt id="kadmos.graph.graph_data.FundamentalProblemGraph.get_objective_node"> +<code class="descname">get_objective_node</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.FundamentalProblemGraph.get_objective_node" title="Permalink to this definition">¶</a></dt> +<dd><p>Method to get the single (or non-existent) objective node from a graph.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">new fpg graph</td> +<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">objective node or None if no objective node is present</td> </tr> -<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference internal" href="#kadmos.graph.graph_data.FundamentalProblemGraph" title="kadmos.graph.graph_data.FundamentalProblemGraph">FundamentalProblemGraph</a></td> +<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">str, None</td> </tr> </tbody> </table> </dd></dl> <dl class="method"> -<dt id="kadmos.graph.graph_data.RepositoryConnectivityGraph.get_function_paths_by_objective"> -<code class="descname">get_function_paths_by_objective</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.RepositoryConnectivityGraph.get_function_paths_by_objective" title="Permalink to this definition">¶</a></dt> -<dd><p>This function takes an arbitrary amount of objective nodes as graph sinks and returns all path combinations -of tools.</p> -<p>If no arguments are given, user is prompted to select objectives from the graph.</p> -<p>The tool combinations are found using the function itertools.product() and can lead to significant computation -times for large graphs. If this is the case, the user is prompted whether to continue or not.</p> -<p>A variety of filters can be applied to the search of possible tools combinations, some of which reduce the -computation time.</p> -<p>kwargs: -obj_vars_covered - ensures that all objective variables are used in tool configurations -ignore_funcs - ignores functions for the config -source - source node; if provided, must be in config</p> +<dt id="kadmos.graph.graph_data.FundamentalProblemGraph.get_partition_info"> +<code class="descname">get_partition_info</code><span class="sig-paren">(</span><em>partitions</em>, <em>include_run_time=False</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.FundamentalProblemGraph.get_partition_info" title="Permalink to this definition">¶</a></dt> +<dd><p>Function to get the number of feedback variables in the partitions and the number system variables (feedback +and feedforward variables between partitions)</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> -<li><strong>args</strong> – arbitrary amount of objective nodes</li> -<li><strong>kwargs</strong> – filter options to limit possible path combinations</li> +<li><strong>partitions</strong> (<em>dict</em>) – dictionary which indicates which nodes are in which partition</li> +<li><strong>include_run_time</strong> (<em>bool</em>) – </li> </ul> </td> </tr> -<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">all possible FPG path combinations for the provided objective nodes</p> +<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">partition_variables:</p> </td> </tr> -</tbody> -</table> -</dd></dl> - -<dl class="method"> -<dt id="kadmos.graph.graph_data.RepositoryConnectivityGraph.get_path_combinations"> -<code class="descname">get_path_combinations</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.RepositoryConnectivityGraph.get_path_combinations" title="Permalink to this definition">¶</a></dt> -<dd><p>This function takes lists of subsets and generates all possible combinations between them.</p> -<p>This is done by using the itertools.product() function. If the amount of expected evaluations exceeds a pre-set -minimum, the user will be asked if to continue or not; because the process can take a long time and use up many -resources.</p> -<p>Optional arguments: -min_func: minimum amount of functions in each configuration -max_func: maximum amount of functions in each configuration</p> -<table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>args</strong> (<em>list</em>) – lists of subsets that will be used to find configurations</td> +<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first">partition_variables: list of sets</p> +</td> +</tr> +<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">system_variables:</p> +</td> </tr> -<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">set of all unique path combinations</td> +<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">system_variables: set</p> +</td> </tr> </tbody> </table> </dd></dl> <dl class="method"> -<dt id="kadmos.graph.graph_data.RepositoryConnectivityGraph.select_function_combination_from"> -<code class="descname">select_function_combination_from</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.RepositoryConnectivityGraph.select_function_combination_from" title="Permalink to this definition">¶</a></dt> -<dd><p>This function takes all provided workflow configurations and lists them according to their characteristics.</p> -<p>The user can then choose the workflow configuration from the list. -A warning is given to the user if the amount of total configurations exceeds n = 1e4. -Print limit is set to [0-20] by default. -sort_by must be one of [“couplingsâ€, “system_inputsâ€, “edgesâ€, “nodesâ€].</p> -</dd></dl> - -</dd></dl> - -</div> -<div class="section" id="fundamentalproblemgraph"> -<h3>FundamentalProblemGraph<a class="headerlink" href="#fundamentalproblemgraph" title="Permalink to this headline">¶</a></h3> -<dl class="class"> -<dt id="kadmos.graph.graph_data.FundamentalProblemGraph"> -<em class="property">class </em><code class="descclassname">kadmos.graph.graph_data.</code><code class="descname">FundamentalProblemGraph</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.FundamentalProblemGraph" title="Permalink to this definition">¶</a></dt> -<dd><dl class="method"> -<dt id="kadmos.graph.graph_data.FundamentalProblemGraph.add_function_problem_roles"> -<code class="descname">add_function_problem_roles</code><span class="sig-paren">(</span><em>function_order_method='manual'</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.FundamentalProblemGraph.add_function_problem_roles" title="Permalink to this definition">¶</a></dt> -<dd><p>Method to add the function problem roles (pre-coupled, coupled, post-coupled functions).</p> +<dt id="kadmos.graph.graph_data.FundamentalProblemGraph.get_sub_level_functions"> +<code class="descname">get_sub_level_functions</code><span class="sig-paren">(</span><em>local_objective_function</em>, <em>local_cnstrnt_funcs</em>, <em>coupled_functions_group</em>, <em>mg_function_ordering=None</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.FundamentalProblemGraph.get_sub_level_functions" title="Permalink to this definition">¶</a></dt> +<dd><p>Method to obtain subsystem level functions.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>function_order_method</strong> (<em>basestring</em>) – algorithm to be used for the order in which the functions are executed.</td> +<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> +<li><strong>local_objective_function</strong> (<em>str</em>) – local objective function</li> +<li><strong>local_cnstrnt_funcs</strong> (<em>list</em>) – local constraint function(s)</li> +<li><strong>coupled_functions_group</strong> (<em>list</em>) – coupled functions</li> +<li><strong>mg_function_ordering</strong> (<em>dict</em>) – (optional) MdaoGraph function ordering</li> +</ul> +</td> +</tr> +<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">subsystem level functions</p> +</td> +</tr> +<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">dict</p> +</td> </tr> </tbody> </table> </dd></dl> <dl class="method"> -<dt id="kadmos.graph.graph_data.FundamentalProblemGraph.create_mdg"> -<code class="descname">create_mdg</code><span class="sig-paren">(</span><em>mg_function_ordering</em>, <em>name='MDG'</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.FundamentalProblemGraph.create_mdg" title="Permalink to this definition">¶</a></dt> -<dd><p>Function to automatically create an MDG based on an FPG.</p> +<dt id="kadmos.graph.graph_data.FundamentalProblemGraph.get_sys_post_couplings"> +<code class="descname">get_sys_post_couplings</code><span class="sig-paren">(</span><em>sys_level_post_coupled</em>, <em>coupled_functions_groups=None</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.FundamentalProblemGraph.get_sys_post_couplings" title="Permalink to this definition">¶</a></dt> +<dd><p>Method to obtain the system-level post-couplings functions.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> -<li><strong>mg_function_ordering</strong> (<em>dict</em>) – dictionary with MDAO graph function ordering</li> -<li><strong>name</strong> (<em>basestring</em>) – name for the MDG graph</li> +<li><strong>sys_level_post_coupled</strong> (<em>list</em>) – nodes with attributed problem role ‘post-coupling’</li> +<li><strong>coupled_functions_groups</strong> (<em>list</em>) – (optional) list of coupled function groups</li> </ul> </td> </tr> -<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">baseline MDG (only added additional action blocks, no changed connections)</p> +<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">system-level post-coupling functions</p> </td> </tr> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">MdaoDataGraph</p> +<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first">list</p> +</td> +</tr> +<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">indices ot system-level post-coupling functions</p> +</td> +</tr> +<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">dict</p> </td> </tr> </tbody> @@ -6973,23 +3025,24 @@ sort_by must be one of [“couplingsâ€, “system_inputsâ€, “edgesâ€, “no </dd></dl> <dl class="method"> -<dt id="kadmos.graph.graph_data.FundamentalProblemGraph.create_mpg"> -<code class="descname">create_mpg</code><span class="sig-paren">(</span><em>mg_function_ordering</em>, <em>name='MPG'</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.FundamentalProblemGraph.create_mpg" title="Permalink to this definition">¶</a></dt> -<dd><p>Function to automatically create a MPG based on a FPG.</p> +<dt id="kadmos.graph.graph_data.FundamentalProblemGraph.get_system_level_functions"> +<code class="descname">get_system_level_functions</code><span class="sig-paren">(</span><em>global_objective_function</em>, <em>global_cnstrnt_functions</em>, <em>mg_function_ordering=None</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.FundamentalProblemGraph.get_system_level_functions" title="Permalink to this definition">¶</a></dt> +<dd><p>Method to obtain system level functions</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> -<li><strong>mg_function_ordering</strong> (<em>dict</em>) – dictionary with MDAO graph function ordering</li> -<li><strong>name</strong> (<em>basestring</em>) – name for the MPG graph</li> +<li><strong>global_objective_function</strong> (<em>str</em>) – global objective function</li> +<li><strong>global_cnstrnt_functions</strong> (<em>list</em>) – global constraint function(s)</li> +<li><strong>mg_function_ordering</strong> (<em>dict</em>) – MdaoGraph function ordering</li> </ul> </td> </tr> -<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">unconnected FPG (only action blocks and their diagonal position)</p> +<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">system level functions</p> </td> </tr> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last"><a class="reference internal" href="#kadmos.graph.graph_process.MdaoProcessGraph" title="kadmos.graph.graph_process.MdaoProcessGraph">MdaoProcessGraph</a></p> +<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">dict</p> </td> </tr> </tbody> @@ -6997,76 +3050,78 @@ sort_by must be one of [“couplingsâ€, “system_inputsâ€, “edgesâ€, “no </dd></dl> <dl class="method"> -<dt id="kadmos.graph.graph_data.FundamentalProblemGraph.get_mdg"> -<code class="descname">get_mdg</code><span class="sig-paren">(</span><em>name='MDG'</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.FundamentalProblemGraph.get_mdg" title="Permalink to this definition">¶</a></dt> -<dd><p>Create the MDAO data graph for a given FPG.</p> +<dt id="kadmos.graph.graph_data.FundamentalProblemGraph.impose_mdao_architecture"> +<code class="descname">impose_mdao_architecture</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.FundamentalProblemGraph.impose_mdao_architecture" title="Permalink to this definition">¶</a></dt> +<dd><p>Method to directly get both the MDG and MPG of an FPG.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>name</strong> (<em>basestring</em>) – name of the new graph</td> -</tr> -<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">MDAO data graph</td> +<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">MdaoDataGraph and MdaoProcessGraph</td> </tr> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body">MdaoDataGraph</td> +<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">tuple</td> </tr> </tbody> </table> </dd></dl> <dl class="method"> -<dt id="kadmos.graph.graph_data.FundamentalProblemGraph.get_mg_function_ordering"> -<code class="descname">get_mg_function_ordering</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.FundamentalProblemGraph.get_mg_function_ordering" title="Permalink to this definition">¶</a></dt> -<dd><p>Method to determine the function ordering for MDAO graphs (FPG and MDG) based on an FPG.</p> -<p>Function ordering has to be adjusted when design variables are used. In that case, the pre-coupling functions -have to be divided in two parts: the first part does not use the design variables yet, while the second does.</p> +<dt id="kadmos.graph.graph_data.FundamentalProblemGraph.partition_graph"> +<code class="descname">partition_graph</code><span class="sig-paren">(</span><em>n_parts</em>, <em>include_run_time=False</em>, <em>tpwgts=None</em>, <em>recursive=True</em>, <em>contig=False</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.FundamentalProblemGraph.partition_graph" title="Permalink to this definition">¶</a></dt> +<dd><p>Partition a graph using the Metis algorithm (<a class="reference external" href="http://glaros.dtc.umn.edu/gkhome/metis/metis/overview">http://glaros.dtc.umn.edu/gkhome/metis/metis/overview</a>).</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">function ordering dictionary</td> -</tr> -<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">dict</td> +<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple"> +<li><strong>n_parts</strong> (<em>int</em>) – number of partitions requested (algorithm might provide less)</li> +<li><strong>include_run_time</strong> (<em>bool</em>) – </li> +<li><strong>tpwgts</strong> (<em>list</em>) – list of target partition weights</li> +<li><strong>recursive</strong> (<em>bool</em>) – option to use the recursive bisection or k-way partitioning algorithm</li> +<li><strong>contig</strong> (<em>bool</em>) – Metis option</li> +</ul> +</td> </tr> </tbody> </table> +<div class="admonition note"> +<p class="first admonition-title">Note</p> +<p class="last">partitioning can only be performed on undirected graphs. Therefore every graph input is translated +into an undirected graph.</p> +</div> </dd></dl> <dl class="method"> -<dt id="kadmos.graph.graph_data.FundamentalProblemGraph.get_mpg"> -<code class="descname">get_mpg</code><span class="sig-paren">(</span><em>name='MPG'</em>, <em>mdg=None</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.FundamentalProblemGraph.get_mpg" title="Permalink to this definition">¶</a></dt> -<dd><p>Create the MDAO process graph for a given FPG.</p> +<dt id="kadmos.graph.graph_data.FundamentalProblemGraph.select_distributed_architecture"> +<code class="descname">select_distributed_architecture</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.FundamentalProblemGraph.select_distributed_architecture" title="Permalink to this definition">¶</a></dt> +<dd><p>Function for easy selection of a distributed architecture for a partitioned graph.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> -<li><strong>name</strong> (<em>basestring</em>) – name of the new graph</li> -<li><strong>mdg</strong> (<em>MdaoDataGraph</em>) – data graph to be used for process optimization</li> -</ul> -</td> -</tr> -<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">MDAO process graph</p> -</td> -</tr> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last"><a class="reference internal" href="#kadmos.graph.graph_process.MdaoProcessGraph" title="kadmos.graph.graph_process.MdaoProcessGraph">MdaoProcessGraph</a></p> -</td> +<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">Extended problem formulation</td> </tr> </tbody> </table> </dd></dl> <dl class="method"> -<dt id="kadmos.graph.graph_data.FundamentalProblemGraph.impose_mdao_architecture"> -<code class="descname">impose_mdao_architecture</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.FundamentalProblemGraph.impose_mdao_architecture" title="Permalink to this definition">¶</a></dt> -<dd><p>Method to directly get both the MDG and MPG of an FPG.</p> +<dt id="kadmos.graph.graph_data.FundamentalProblemGraph.select_number_of_partitions"> +<code class="descname">select_number_of_partitions</code><span class="sig-paren">(</span><em>partition_range</em>, <em>include_run_time=False</em>, <em>plot_pareto_front=False</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_data.FundamentalProblemGraph.select_number_of_partitions" title="Permalink to this definition">¶</a></dt> +<dd><p>Function to evaluate the properties of different number of partitions and to select the best one.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">MdaoDataGraph and MdaoProcessGraph</td> +<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> +<li><strong>partition_range</strong> (<em>list</em>) – range of number of partitions that need to be evaluated</li> +<li><strong>include_run_time</strong> – </li> +<li><strong>plot_pareto_front</strong> (<em>bool</em>) – Option to plot the characteristics of different number of partitions</li> +</ul> +</td> </tr> -<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">tuple</td> +<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last"></p> +</td> </tr> </tbody> </table> @@ -7074,14 +3129,6 @@ have to be divided in two parts: the first part does not use the design variabl </dd></dl> -</div> -<div class="section" id="processgraph"> -<h3>ProcessGraph<a class="headerlink" href="#processgraph" title="Permalink to this headline">¶</a></h3> -<dl class="class"> -<dt id="kadmos.graph.graph_process.ProcessGraph"> -<em class="property">class </em><code class="descclassname">kadmos.graph.graph_process.</code><code class="descname">ProcessGraph</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_process.ProcessGraph" title="Permalink to this definition">¶</a></dt> -<dd></dd></dl> - </div> <div class="section" id="mdaoprocessgraph"> <h3>MdaoProcessGraph<a class="headerlink" href="#mdaoprocessgraph" title="Permalink to this headline">¶</a></h3> @@ -7114,25 +3161,53 @@ since it is not analyzed for the possibility to run functions in parallel.</p> <dt id="kadmos.graph.graph_process.MdaoProcessGraph.add_process_partitions"> <code class="descname">add_process_partitions</code><span class="sig-paren">(</span><em>previous_sequence</em>, <em>partitions</em>, <em>next_sequence</em>, <em>process_step</em>, <em>mdg</em>, <em>end_in_iterative_node=None</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_process.MdaoProcessGraph.add_process_partitions" title="Permalink to this definition">¶</a></dt> <dd><p>Function to add the process in the partitions</p> +<table class="docutils field-list" frame="void" rules="none"> +<col class="field-name" /> +<col class="field-body" /> +<tbody valign="top"> +<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> +<li><strong>previous_sequence</strong> (<em>list</em>) – previous list of functions in the required sequence</li> +<li><strong>partitions</strong> (<em>dict</em>) – process partitions to be added</li> +<li><strong>next_sequence</strong> (<em>list</em>) – next list of functions in the required sequence</li> +<li><strong>process_step</strong> (<em>int</em>) – process step number for the first element in the sequence</li> +<li><strong>mdg</strong> (<em>MdaoDataGraph</em>) – data graph to be used for execution dependencies</li> +<li><strong>end_in_iterative_node</strong> (<em>basestring</em>) – (optional) iterative node to which the last function should go</li> +</ul> +</td> +</tr> +<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">graph enriched with process partitioning</p> +</td> +</tr> +<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last"><a class="reference internal" href="#kadmos.graph.graph_process.MdaoProcessGraph" title="kadmos.graph.graph_process.MdaoProcessGraph">MdaoProcessGraph</a></p> +</td> +</tr> +</tbody> +</table> </dd></dl> <dl class="method"> <dt id="kadmos.graph.graph_process.MdaoProcessGraph.connect_nested_iterators"> <code class="descname">connect_nested_iterators</code><span class="sig-paren">(</span><em>master</em>, <em>slave</em>, <em>direction='slave->master'</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_process.MdaoProcessGraph.connect_nested_iterators" title="Permalink to this definition">¶</a></dt> <dd><p>Method to connect a slave iterator to a master iterator in a nested configuration.</p> -<p>An example is if a converger inside an optimizer in MDF needs to be linked back.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple"> +<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> <li><strong>master</strong> (<em>basestring</em>) – upper iterator node in the nested configuration</li> <li><strong>slave</strong> (<em>basestring</em>) – lower iterator node in the nested configuration</li> </ul> </td> </tr> +<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">graph enriched with nested iterators</p> +</td> +</tr> +<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last"><a class="reference internal" href="#kadmos.graph.graph_process.MdaoProcessGraph" title="kadmos.graph.graph_process.MdaoProcessGraph">MdaoProcessGraph</a></p> +</td> +</tr> </tbody> </table> +<p>An example is if a converger inside an optimizer in MDF needs to be linked back.</p> </dd></dl> <dl class="method"> @@ -7225,6 +3300,14 @@ since it is not analyzed for the possibility to run functions in parallel.</p> <dt id="kadmos.graph.graph_process.MdaoProcessGraph.inspect_process"> <code class="descname">inspect_process</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.graph_process.MdaoProcessGraph.inspect_process" title="Permalink to this definition">¶</a></dt> <dd><p>Method to print the MPG.</p> +<table class="docutils field-list" frame="void" rules="none"> +<col class="field-name" /> +<col class="field-body" /> +<tbody valign="top"> +<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">printed inspection</td> +</tr> +</tbody> +</table> </dd></dl> </dd></dl> @@ -7243,13 +3326,19 @@ since it is not analyzed for the possibility to run functions in parallel.</p> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple"> +<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> <li><strong>node</strong> (<em>str</em>) – node identifier</li> <li><strong>diagonal_pos</strong> (<em>int</em>) – integer with diagonal position (>= 0)</li> <li><strong>attr_dict</strong> (<em>dict</em>) – dictionary with node attributes</li> </ul> </td> </tr> +<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">graph with inserted node on diagonal</p> +</td> +</tr> +<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last"><a class="reference internal" href="#kadmos.graph.mixin_mdao.MdaoMixin" title="kadmos.graph.mixin_mdao.MdaoMixin">MdaoMixin</a></p> +</td> +</tr> </tbody> </table> </dd></dl> @@ -7264,6 +3353,10 @@ since it is not analyzed for the possibility to run functions in parallel.</p> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>node</strong> (<em>str</em>) – node identifier</td> </tr> +<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">graph with removed node from diagonal</td> +</tr> +<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference internal" href="#kadmos.graph.mixin_mdao.MdaoMixin" title="kadmos.graph.mixin_mdao.MdaoMixin">MdaoMixin</a></td> +</tr> </tbody> </table> </dd></dl> @@ -7284,13 +3377,19 @@ since it is not analyzed for the possibility to run functions in parallel.</p> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple"> +<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> <li><strong>edge_or_node</strong> (<em>list</em><em>, </em><em>str</em>) – graph edge or node under consideration.</li> <li><strong>equation</strong> (<em>str</em>) – equation to be added</li> <li><strong>language</strong> (<em>str</em>) – equation language used for the equation</li> </ul> </td> </tr> +<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">equation</p> +</td> +</tr> +<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">str</p> +</td> +</tr> </tbody> </table> </dd></dl> @@ -7328,13 +3427,19 @@ since it is not analyzed for the possibility to run functions in parallel.</p> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple"> +<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> <li><strong>nodes</strong> (<em>list</em>) – list of nodes</li> <li><strong>language</strong> (<em>str</em>) – equation language used for the equation label</li> <li><strong>labeling_method</strong> (<em>str</em>) – select method for automatic label string determination (node_id or node_label)</li> </ul> </td> </tr> +<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">labels</p> +</td> +</tr> +<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">str</p> +</td> +</tr> </tbody> </table> </dd></dl> @@ -7347,7 +3452,7 @@ since it is not analyzed for the possibility to run functions in parallel.</p> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple"> +<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> <li><strong>input_nodes</strong> (<em>str</em><em>, </em><em>list</em>) – input nodes of the mathematical function</li> <li><strong>function_node</strong> (<em>str</em>) – function node of the mathematical function</li> <li><strong>output_nodes</strong> (<em>str</em><em>, </em><em>list</em>) – output nodes of the mathematical function</li> @@ -7355,6 +3460,12 @@ since it is not analyzed for the possibility to run functions in parallel.</p> </ul> </td> </tr> +<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">mathematical function</p> +</td> +</tr> +<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">str</p> +</td> +</tr> </tbody> </table> </dd></dl> @@ -7371,26 +3482,36 @@ since it is not analyzed for the possibility to run functions in parallel.</p> <dt id="kadmos.graph.mixin_vistoms.VistomsMixin.vistoms_add"> <code class="descname">vistoms_add</code><span class="sig-paren">(</span><em>vistoms_dir</em>, <em>mpg=None</em>, <em>function_order=None</em>, <em>reference_file=None</em>, <em>compress=False</em>, <em>remove_after_compress=True</em>, <em>graph_id=None</em>, <em>replacement_id=None</em>, <em>xml_file=None</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.graph.mixin_vistoms.VistomsMixin.vistoms_add" title="Permalink to this definition">¶</a></dt> <dd><p>Function to add a graph to a existing VISTOMS instance.</p> -<p>In one VISTOMS instance different graphs can be shown. For example it is possible to include different -architectures for the same problem in one VISTOMS instance.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple"> +<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> <li><strong>vistoms_dir</strong> (<em>str</em>) – directory of the VISTOMS directory to be used for addition</li> <li><strong>mpg</strong> (<a class="reference internal" href="#kadmos.graph.graph_process.MdaoProcessGraph" title="kadmos.graph.graph_process.MdaoProcessGraph"><em>MdaoProcessGraph</em></a>) – optional MPG graph to be saved with MDG as XDSM (if None a DSM is created)</li> <li><strong>function_order</strong> (<em>list</em>) – optional function order for the diagonal of the graph (only applicable for DSMs)</li> <li><strong>reference_file</strong> (<em>str</em>) – file from which reference values are extracted (either full path or file in same folder)</li> <li><strong>compress</strong> (<em>bool</em>) – setting whether to compress the final VISTOMS instance folder to a zip file</li> <li><strong>remove_after_compress</strong> (<em>bool</em>) – setting whether to remove the original folder after compression</li> -<li><strong>replacement_id</strong> (<em>basestr</em>) – indentifier of the graph to be replaced</li> +<li><strong>graph_id</strong> (<em>basestring</em>) – indentifier of the new graph</li> +<li><strong>replacement_id</strong> (<em>basestring</em>) – indentifier of the graph to be replaced</li> <li><strong>xml_file</strong> (<em>file</em>) – Name of the CMDOWS xml-file</li> </ul> </td> </tr> +<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">enriched vistoms instance</p> +</td> +</tr> +<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last"><a class="reference internal" href="#kadmos.graph.mixin_vistoms.VistomsMixin" title="kadmos.graph.mixin_vistoms.VistomsMixin">VistomsMixin</a></p> +</td> +</tr> </tbody> </table> +<div class="admonition hint"> +<p class="first admonition-title">Hint</p> +<p class="last">In one VISTOMS instance different graphs can be shown. For example it is possible to include different +architectures for the same problem in one VISTOMS instance.</p> +</div> </dd></dl> <dl class="method"> @@ -7401,10 +3522,10 @@ architectures for the same problem in one VISTOMS instance.</p> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple"> +<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> <li><strong>vistoms_dir</strong> (<em>str</em>) – directory of the VISTOMS directory to be created</li> <li><strong>vistoms_version</strong> – version of the VISTOMS instance to be used (as stored in the package itself)</li> -<li><strong>vispack_version</strong> – str</li> +<li><strong>vistoms_version</strong> – str</li> <li><strong>mpg</strong> (<a class="reference internal" href="#kadmos.graph.graph_process.MdaoProcessGraph" title="kadmos.graph.graph_process.MdaoProcessGraph"><em>MdaoProcessGraph</em></a>) – optional MPG graph to be saved with MDG as XDSM (if None a DSM is created)</li> <li><strong>function_order</strong> (<em>list</em>) – optional function order for the diagonal of the graph (only applicable for DSMs)</li> <li><strong>reference_file</strong> (<em>str</em>) – file from which reference values are extracted (either full path or file in same folder)</li> @@ -7417,6 +3538,12 @@ architectures for the same problem in one VISTOMS instance.</p> </ul> </td> </tr> +<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">vistoms instance</p> +</td> +</tr> +<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last"><a class="reference internal" href="#kadmos.graph.mixin_vistoms.VistomsMixin" title="kadmos.graph.mixin_vistoms.VistomsMixin">VistomsMixin</a></p> +</td> +</tr> </tbody> </table> </dd></dl> @@ -7442,36 +3569,187 @@ architectures for the same problem in one VISTOMS instance.</p> <dt id="kadmos.cmdows.cmdows.CMDOWS.add_contact"> <code class="descname">add_contact</code><span class="sig-paren">(</span><em>name</em>, <em>email</em>, <em>uid</em>, <em>company=None</em>, <em>department=None</em>, <em>function=None</em>, <em>address=None</em>, <em>telephone=None</em>, <em>country=None</em>, <em>roles=None</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.cmdows.cmdows.CMDOWS.add_contact" title="Permalink to this definition">¶</a></dt> <dd><p>Method to add a contact element to the organization branch.</p> +<table class="docutils field-list" frame="void" rules="none"> +<col class="field-name" /> +<col class="field-body" /> +<tbody valign="top"> +<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> +<li><strong>name</strong> (<em>str</em>) – contact name</li> +<li><strong>email</strong> (<em>str</em>) – contact email</li> +<li><strong>uid</strong> (<em>basestring</em>) – contact uID</li> +<li><strong>company</strong> (<em>str</em>) – (optional) contact company</li> +<li><strong>department</strong> (<em>str</em>) – (optional) company department</li> +<li><strong>function</strong> (<em>str</em>) – (optional) contact function</li> +<li><strong>address</strong> (<em>str</em>) – (optional) contact address</li> +<li><strong>telephone</strong> (<em>str</em>) – (optional) contact telephone number</li> +<li><strong>country</strong> (<em>str</em>) – (optional) contact country</li> +<li><strong>roles</strong> (<em>list</em><em>, </em><em>str</em>) – contact roles in project</li> +</ul> +</td> +</tr> +<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">XML with contact</p> +</td> +</tr> +<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">XMLSchema</p> +</td> +</tr> +</tbody> +</table> +<div class="admonition note"> +<p class="first admonition-title">Note</p> +<p>Role options are:</p> +<ul class="last simple"> +<li>‘architect’</li> +<li>‘integrator’</li> +<li>‘collaborative_engineer’</li> +<li>‘tool_specialist’</li> +<li>‘customer’</li> +</ul> +</div> </dd></dl> <dl class="method"> <dt id="kadmos.cmdows.cmdows.CMDOWS.add_dc"> <code class="descname">add_dc</code><span class="sig-paren">(</span><em>uid</em>, <em>id</em>, <em>mode_id</em>, <em>instance_id</em>, <em>version</em>, <em>label</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.cmdows.cmdows.CMDOWS.add_dc" title="Permalink to this definition">¶</a></dt> <dd><p>Method to add a designCompetence element to the designCompetences branch.</p> +<table class="docutils field-list" frame="void" rules="none"> +<col class="field-name" /> +<col class="field-body" /> +<tbody valign="top"> +<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> +<li><strong>uid</strong> (<em>basestring</em>) – designCompetence uID</li> +<li><strong>id</strong> (<em>str</em>) – designCompetence ID</li> +<li><strong>mode_id</strong> (<em>str</em>) – designCompetence mode</li> +<li><strong>instance_id</strong> (<em>int</em>) – designCompetence instance</li> +<li><strong>version</strong> (<em>str</em>) – designCompetence instance</li> +<li><strong>label</strong> (<em>str</em>) – designCompetence label</li> +</ul> +</td> +</tr> +<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">XML with designCompetence</p> +</td> +</tr> +<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">XMLSchema</p> +</td> +</tr> +</tbody> +</table> </dd></dl> <dl class="method"> <dt id="kadmos.cmdows.cmdows.CMDOWS.add_dc_general_info"> <code class="descname">add_dc_general_info</code><span class="sig-paren">(</span><em>dc_uid</em>, <em>description</em>, <em>status=None</em>, <em>creation_date=None</em>, <em>owner_uid=None</em>, <em>creator_uid=None</em>, <em>operator_uid=None</em>, <em>model_definition=None</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.cmdows.cmdows.CMDOWS.add_dc_general_info" title="Permalink to this definition">¶</a></dt> -<dd><p>Method to add a general info element to a dc branch.</p> +<dd><p>Method to add a general info element to a DC branch.</p> +<table class="docutils field-list" frame="void" rules="none"> +<col class="field-name" /> +<col class="field-body" /> +<tbody valign="top"> +<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> +<li><strong>dc_uid</strong> (<em>basestring</em>) – designCompetence uID</li> +<li><strong>description</strong> (<em>str</em>) – designCompetence description</li> +<li><strong>status</strong> (<em>str</em>) – (optional) designCompetence status</li> +<li><strong>creation_date</strong> (<em>datetime</em>) – (optional) designCompetence creation date</li> +<li><strong>owner_uid</strong> (<em>basestring</em>) – (optional) designCompetence owner uID</li> +<li><strong>creator_uid</strong> (<em>basestring</em>) – (optional) designCompetence creator uID</li> +<li><strong>operator_uid</strong> (<em>basestring</em>) – (optional) designCompetence operator uID</li> +<li><strong>model_definition</strong> (<em>str</em>) – (optional) designCompetence model definition</li> +</ul> +</td> +</tr> +<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">XML with general info</p> +</td> +</tr> +<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">XMLSchema</p> +</td> +</tr> +</tbody> +</table> </dd></dl> <dl class="method"> <dt id="kadmos.cmdows.cmdows.CMDOWS.add_dc_inputs_element"> <code class="descname">add_dc_inputs_element</code><span class="sig-paren">(</span><em>dc_uid</em>, <em>inputs_element</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.cmdows.cmdows.CMDOWS.add_dc_inputs_element" title="Permalink to this definition">¶</a></dt> -<dd><p>Method to add a inputs element to a DC element.</p> +<dd><p>Method to add a input element to a DC element.</p> +<table class="docutils field-list" frame="void" rules="none"> +<col class="field-name" /> +<col class="field-body" /> +<tbody valign="top"> +<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> +<li><strong>dc_uid</strong> (<em>basestring</em>) – designCompetence uID</li> +<li><strong>inputs_element</strong> (<em>str</em>) – input element to be added</li> +</ul> +</td> +</tr> +<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">XML with input element</p> +</td> +</tr> +<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">XMLSchema</p> +</td> +</tr> +</tbody> +</table> </dd></dl> <dl class="method"> <dt id="kadmos.cmdows.cmdows.CMDOWS.add_dc_outputs_element"> <code class="descname">add_dc_outputs_element</code><span class="sig-paren">(</span><em>dc_uid</em>, <em>outputs_element</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.cmdows.cmdows.CMDOWS.add_dc_outputs_element" title="Permalink to this definition">¶</a></dt> -<dd><p>Method to add a outputs element to a DC element.</p> +<dd><p>Method to add a output element to a DC element.</p> +<table class="docutils field-list" frame="void" rules="none"> +<col class="field-name" /> +<col class="field-body" /> +<tbody valign="top"> +<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> +<li><strong>dc_uid</strong> (<em>basestring</em>) – designCompetence uID</li> +<li><strong>outputs_element</strong> (<em>str</em>) – output element to be added</li> +</ul> +</td> +</tr> +<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">XML with output element</p> +</td> +</tr> +<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">XMLSchema</p> +</td> +</tr> +</tbody> +</table> </dd></dl> <dl class="method"> <dt id="kadmos.cmdows.cmdows.CMDOWS.add_dc_performance_info"> <code class="descname">add_dc_performance_info</code><span class="sig-paren">(</span><em>dc_uid</em>, <em>precision=None</em>, <em>fidelity_level=None</em>, <em>run_time=None</em>, <em>verification=None</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.cmdows.cmdows.CMDOWS.add_dc_performance_info" title="Permalink to this definition">¶</a></dt> <dd><p>Method to add a performance info element to a DC branch.</p> +<table class="docutils field-list" frame="void" rules="none"> +<col class="field-name" /> +<col class="field-body" /> +<tbody valign="top"> +<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> +<li><strong>dc_uid</strong> (<em>basestring</em>) – designCompetence uID</li> +<li><strong>precision</strong> (<em>float</em>) – (optional) designCompetence precision</li> +<li><strong>fidelity_level</strong> (<em>int</em>) – (optional) designCompetence fidelity level</li> +<li><strong>run_time</strong> (<em>float</em>) – (optional) designCompetence run time</li> +<li><strong>verification</strong> (<em>dict</em>) – designCompetence verification method</li> +</ul> +</td> +</tr> +<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">XML with performance info</p> +</td> +</tr> +<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">XMLSchema</p> +</td> +</tr> +</tbody> +</table> +<div class="admonition note"> +<p class="first admonition-title">Note</p> +<p>the verification dict should contain the following keys:</p> +<ul class="last simple"> +<li>‘method’ (str)</li> +<li>‘verifier’ (uid)</li> +<li>‘result’ (str)</li> +<li>‘date’ (datetime)</li> +<li>‘version’ (str)</li> +</ul> +</div> </dd></dl> <dl class="method"> @@ -7483,19 +3761,82 @@ architectures for the same problem in one VISTOMS instance.</p> <dl class="method"> <dt id="kadmos.cmdows.cmdows.CMDOWS.add_dc_verification"> <code class="descname">add_dc_verification</code><span class="sig-paren">(</span><em>dc_uid</em>, <em>method</em>, <em>verifier</em>, <em>result</em>, <em>date</em>, <em>version</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.cmdows.cmdows.CMDOWS.add_dc_verification" title="Permalink to this definition">¶</a></dt> -<dd><p>Method to add a verification to a DC</p> +<dd><p>Method to add a verification to a DC branch.</p> +<table class="docutils field-list" frame="void" rules="none"> +<col class="field-name" /> +<col class="field-body" /> +<tbody valign="top"> +<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> +<li><strong>dc_uid</strong> (<em>basestring</em>) – designCompetence uID</li> +<li><strong>method</strong> (<em>str</em>) – verification method</li> +<li><strong>verifier</strong> (<em>basestring</em>) – verifier uID</li> +<li><strong>result</strong> (<em>str</em>) – verification result</li> +<li><strong>date</strong> (<em>datetime</em>) – verification date</li> +<li><strong>version</strong> – designCompetence uID that was verified</li> +</ul> +</td> +</tr> +<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">XML with verification added to DC</p> +</td> +</tr> +<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">XMLSchema</p> +</td> +</tr> +</tbody> +</table> </dd></dl> <dl class="method"> <dt id="kadmos.cmdows.cmdows.CMDOWS.add_element_to_element_of_uid"> <code class="descname">add_element_to_element_of_uid</code><span class="sig-paren">(</span><em>uid</em>, <em>element_to_add</em>, <em>expected_tag_uid_el=None</em>, <em>expected_tag_new_el=None</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.cmdows.cmdows.CMDOWS.add_element_to_element_of_uid" title="Permalink to this definition">¶</a></dt> <dd><p>Generic method to add a subelement to an element with a certain UID.</p> +<table class="docutils field-list" frame="void" rules="none"> +<col class="field-name" /> +<col class="field-body" /> +<tbody valign="top"> +<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> +<li><strong>uid</strong> (<em>basestring</em>) – uID of element to be added to</li> +<li><strong>element_to_add</strong> (<em>str</em>) – subelement to be added</li> +<li><strong>expected_tag_uid_el</strong> (<em>str</em>) – expected tag of element</li> +<li><strong>expected_tag_new_el</strong> (<em>str</em>) – expected tag of subelement</li> +</ul> +</td> +</tr> +<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">XML with subelement</p> +</td> +</tr> +<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">XMLSchema</p> +</td> +</tr> +</tbody> +</table> </dd></dl> <dl class="method"> <dt id="kadmos.cmdows.cmdows.CMDOWS.add_header"> <code class="descname">add_header</code><span class="sig-paren">(</span><em>creator</em>, <em>description</em>, <em>timestamp=None</em>, <em>fileVersion='0.0'</em>, <em>cmdowsVersion='0.7'</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.cmdows.cmdows.CMDOWS.add_header" title="Permalink to this definition">¶</a></dt> <dd><p>Method to add a header to a CMDOWS file.</p> +<table class="docutils field-list" frame="void" rules="none"> +<col class="field-name" /> +<col class="field-body" /> +<tbody valign="top"> +<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> +<li><strong>creator</strong> (<em>str</em>) – name of creator</li> +<li><strong>description</strong> (<em>str</em>) – description of file content</li> +<li><strong>timestamp</strong> (<em>datetime</em>) – (optional) date and time of creation</li> +<li><strong>fileVersion</strong> (<em>str</em>) – version of the file</li> +<li><strong>cmdowsVersion</strong> (<em>str</em>) – version of the xsd schema</li> +</ul> +</td> +</tr> +<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">XML with header</p> +</td> +</tr> +<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">XMLSchema</p> +</td> +</tr> +</tbody> +</table> </dd></dl> <dl class="method"> @@ -7508,30 +3849,85 @@ architectures for the same problem in one VISTOMS instance.</p> <dt id="kadmos.cmdows.cmdows.CMDOWS.assert_element_tag"> <code class="descname">assert_element_tag</code><span class="sig-paren">(</span><em>el</em>, <em>expected_tag</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.cmdows.cmdows.CMDOWS.assert_element_tag" title="Permalink to this definition">¶</a></dt> <dd><p>Method to assert that the tag of an element is as expected.</p> +<table class="docutils field-list" frame="void" rules="none"> +<col class="field-name" /> +<col class="field-body" /> +<tbody valign="top"> +<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> +<li><strong>el</strong> – element</li> +<li><strong>expected_tag</strong> (<em>str</em>) – expected tag</li> +</ul> +</td> +</tr> +<tr class="field-even field"><th class="field-name">Rtype el:</th><td class="field-body"><p class="first last">str</p> +</td> +</tr> +</tbody> +</table> </dd></dl> <dl class="method"> <dt id="kadmos.cmdows.cmdows.CMDOWS.check"> <code class="descname">check</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.cmdows.cmdows.CMDOWS.check" title="Permalink to this definition">¶</a></dt> -<dd><p>Method to execute all checks</p> +<dd><p>Method to execute all checks and remove unused contacts</p> +<table class="docutils field-list" frame="void" rules="none"> +<col class="field-name" /> +<col class="field-body" /> +<tbody valign="top"> +<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">overall check result</td> +</tr> +<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">bool</td> +</tr> +</tbody> +</table> </dd></dl> <dl class="method"> <dt id="kadmos.cmdows.cmdows.CMDOWS.check_references"> <code class="descname">check_references</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.cmdows.cmdows.CMDOWS.check_references" title="Permalink to this definition">¶</a></dt> <dd><p>Method to check if references are actually pointing to a uID in a CMDOWS file</p> +<table class="docutils field-list" frame="void" rules="none"> +<col class="field-name" /> +<col class="field-body" /> +<tbody valign="top"> +<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">result of reference check</td> +</tr> +<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">bool</td> +</tr> +</tbody> +</table> </dd></dl> <dl class="method"> <dt id="kadmos.cmdows.cmdows.CMDOWS.check_schema"> <code class="descname">check_schema</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.cmdows.cmdows.CMDOWS.check_schema" title="Permalink to this definition">¶</a></dt> <dd><p>Method to check if a CMDOWS file adheres to its schema</p> +<table class="docutils field-list" frame="void" rules="none"> +<col class="field-name" /> +<col class="field-body" /> +<tbody valign="top"> +<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">result of schema check</td> +</tr> +<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">bool</td> +</tr> +</tbody> +</table> </dd></dl> <dl class="method"> <dt id="kadmos.cmdows.cmdows.CMDOWS.check_uids"> <code class="descname">check_uids</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.cmdows.cmdows.CMDOWS.check_uids" title="Permalink to this definition">¶</a></dt> <dd><p>Method to check if all uIDs are actually unique in a CMDOWS file</p> +<table class="docutils field-list" frame="void" rules="none"> +<col class="field-name" /> +<col class="field-body" /> +<tbody valign="top"> +<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">result of unique uID check</td> +</tr> +<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">bool</td> +</tr> +</tbody> +</table> </dd></dl> <dl class="method"> @@ -7544,54 +3940,164 @@ architectures for the same problem in one VISTOMS instance.</p> <dt id="kadmos.cmdows.cmdows.CMDOWS.get_design_competences_uids"> <code class="descname">get_design_competences_uids</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.cmdows.cmdows.CMDOWS.get_design_competences_uids" title="Permalink to this definition">¶</a></dt> <dd><p>Method to get a list of all the design competences UIDs present in the file.</p> +<table class="docutils field-list" frame="void" rules="none"> +<col class="field-name" /> +<col class="field-body" /> +<tbody valign="top"> +<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">design competence uIDs</td> +</tr> +<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">list</td> +</tr> +</tbody> +</table> </dd></dl> <dl class="method"> <dt id="kadmos.cmdows.cmdows.CMDOWS.get_element_of_uid"> <code class="descname">get_element_of_uid</code><span class="sig-paren">(</span><em>uid</em>, <em>expected_tag=None</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.cmdows.cmdows.CMDOWS.get_element_of_uid" title="Permalink to this definition">¶</a></dt> <dd><p>Method to get the element based on a UID value.</p> +<table class="docutils field-list" frame="void" rules="none"> +<col class="field-name" /> +<col class="field-body" /> +<tbody valign="top"> +<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> +<li><strong>uid</strong> (<em>basestring</em>) – uID of element</li> +<li><strong>expected_tag</strong> (<em>str</em>) – (optional) expected tag</li> +</ul> +</td> +</tr> +<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">element</p> +</td> +</tr> +<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">str</p> +</td> +</tr> +</tbody> +</table> </dd></dl> <dl class="method"> <dt id="kadmos.cmdows.cmdows.CMDOWS.get_executable_blocks_uids"> <code class="descname">get_executable_blocks_uids</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.cmdows.cmdows.CMDOWS.get_executable_blocks_uids" title="Permalink to this definition">¶</a></dt> <dd><p>Method to get a list of all the executable block UIDs present in the file.</p> +<table class="docutils field-list" frame="void" rules="none"> +<col class="field-name" /> +<col class="field-body" /> +<tbody valign="top"> +<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">executable blocks uIDs</td> +</tr> +<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">list</td> +</tr> +</tbody> +</table> </dd></dl> <dl class="method"> <dt id="kadmos.cmdows.cmdows.CMDOWS.get_inputs_uids"> <code class="descname">get_inputs_uids</code><span class="sig-paren">(</span><em>exblock_uid</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.cmdows.cmdows.CMDOWS.get_inputs_uids" title="Permalink to this definition">¶</a></dt> <dd><p>Method to collect the inputs of a CMDOWS file executableBlock entry</p> +<table class="docutils field-list" frame="void" rules="none"> +<col class="field-name" /> +<col class="field-body" /> +<tbody valign="top"> +<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>exblock_uid</strong> (<em>basestring</em>) – uid of the executableBlock entry</td> +</tr> +<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">path to input</td> +</tr> +<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body">xpath</td> +</tr> +</tbody> +</table> </dd></dl> <dl class="method"> <dt id="kadmos.cmdows.cmdows.CMDOWS.get_mathematical_functions_uids"> <code class="descname">get_mathematical_functions_uids</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.cmdows.cmdows.CMDOWS.get_mathematical_functions_uids" title="Permalink to this definition">¶</a></dt> <dd><p>Method to get a list of all the mathematical functions UIDs present in the file.</p> +<table class="docutils field-list" frame="void" rules="none"> +<col class="field-name" /> +<col class="field-body" /> +<tbody valign="top"> +<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">mathematical functions uIDs</td> +</tr> +<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">list</td> +</tr> +</tbody> +</table> </dd></dl> <dl class="method"> <dt id="kadmos.cmdows.cmdows.CMDOWS.get_outputs_uids"> <code class="descname">get_outputs_uids</code><span class="sig-paren">(</span><em>exblock_uid</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.cmdows.cmdows.CMDOWS.get_outputs_uids" title="Permalink to this definition">¶</a></dt> <dd><p>Method to collect the outputs of a CMDOWS file executableBlock entry</p> +<table class="docutils field-list" frame="void" rules="none"> +<col class="field-name" /> +<col class="field-body" /> +<tbody valign="top"> +<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>exblock_uid</strong> (<em>basestring</em>) – executableBlock entry</td> +</tr> +<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">path to output</td> +</tr> +<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body">xpath</td> +</tr> +</tbody> +</table> </dd></dl> <dl class="method"> <dt id="kadmos.cmdows.cmdows.CMDOWS.get_parameters_uids"> <code class="descname">get_parameters_uids</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.cmdows.cmdows.CMDOWS.get_parameters_uids" title="Permalink to this definition">¶</a></dt> <dd><p>Method to get a list of all the parameter UIDs present in the file.</p> +<table class="docutils field-list" frame="void" rules="none"> +<col class="field-name" /> +<col class="field-body" /> +<tbody valign="top"> +<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">parameter uIDs</td> +</tr> +<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">list</td> +</tr> +</tbody> +</table> </dd></dl> <dl class="method"> <dt id="kadmos.cmdows.cmdows.CMDOWS.get_used_parameter_uids"> <code class="descname">get_used_parameter_uids</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.cmdows.cmdows.CMDOWS.get_used_parameter_uids" title="Permalink to this definition">¶</a></dt> <dd><p>Method to get a list of all the parameter UIDs used in the file.</p> +<table class="docutils field-list" frame="void" rules="none"> +<col class="field-name" /> +<col class="field-body" /> +<tbody valign="top"> +<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">parameter uIDs</td> +</tr> +<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">list</td> +</tr> +</tbody> +</table> </dd></dl> <dl class="method"> <dt id="kadmos.cmdows.cmdows.CMDOWS.get_xpath_of_uid"> <code class="descname">get_xpath_of_uid</code><span class="sig-paren">(</span><em>uid</em>, <em>expected_tag=None</em><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.cmdows.cmdows.CMDOWS.get_xpath_of_uid" title="Permalink to this definition">¶</a></dt> <dd><p>Method to get the xpath based on a UID value.</p> +<table class="docutils field-list" frame="void" rules="none"> +<col class="field-name" /> +<col class="field-body" /> +<tbody valign="top"> +<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> +<li><strong>uid</strong> (<em>basestring</em>) – uID of xpath</li> +<li><strong>expected_tag</strong> (<em>str</em>) – (optional) expected_tag</li> +</ul> +</td> +</tr> +<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">xpath of element</p> +</td> +</tr> +<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">xpath</p> +</td> +</tr> +</tbody> +</table> </dd></dl> <dl class="method"> @@ -7675,7 +4181,17 @@ architectures for the same problem in one VISTOMS instance.</p> <dl class="method"> <dt id="kadmos.cmdows.cmdows.CMDOWS.remove_unused_contacts"> <code class="descname">remove_unused_contacts</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.cmdows.cmdows.CMDOWS.remove_unused_contacts" title="Permalink to this definition">¶</a></dt> -<dd><p>Method to check if there are uID in CMDOWS file which are not refered to and remove them</p> +<dd><p>Method to check if there are uID in CMDOWS file which are not referred to and remove them</p> +<table class="docutils field-list" frame="void" rules="none"> +<col class="field-name" /> +<col class="field-body" /> +<tbody valign="top"> +<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">XML without unused uID’s</td> +</tr> +<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">XMLSchema</td> +</tr> +</tbody> +</table> </dd></dl> <dl class="method"> @@ -7700,6 +4216,16 @@ architectures for the same problem in one VISTOMS instance.</p> <dt id="kadmos.cmdows.cmdows.CMDOWS.schema"> <code class="descname">schema</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.cmdows.cmdows.CMDOWS.schema" title="Permalink to this definition">¶</a></dt> <dd><p>Method to retrieve a schema either belonging to the CMDOWS file</p> +<table class="docutils field-list" frame="void" rules="none"> +<col class="field-name" /> +<col class="field-body" /> +<tbody valign="top"> +<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">schema</td> +</tr> +<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">XMLSchema</td> +</tr> +</tbody> +</table> </dd></dl> <dl class="method"> @@ -7712,12 +4238,32 @@ architectures for the same problem in one VISTOMS instance.</p> <dt id="kadmos.cmdows.cmdows.CMDOWS.simplify_equations"> <code class="descname">simplify_equations</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.cmdows.cmdows.CMDOWS.simplify_equations" title="Permalink to this definition">¶</a></dt> <dd><p>Method to replace duplicate equations elements by a single equations element and refs to this element</p> +<table class="docutils field-list" frame="void" rules="none"> +<col class="field-name" /> +<col class="field-body" /> +<tbody valign="top"> +<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">XML with simplified equation</td> +</tr> +<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">XMLSchema</td> +</tr> +</tbody> +</table> </dd></dl> <dl class="method"> <dt id="kadmos.cmdows.cmdows.CMDOWS.version"> <code class="descname">version</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#kadmos.cmdows.cmdows.CMDOWS.version" title="Permalink to this definition">¶</a></dt> <dd><p>Method to retrieve the version of the CMDOWS file</p> +<table class="docutils field-list" frame="void" rules="none"> +<col class="field-name" /> +<col class="field-body" /> +<tbody valign="top"> +<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">version</td> +</tr> +<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">str</td> +</tr> +</tbody> +</table> </dd></dl> </dd></dl> @@ -8463,7 +5009,7 @@ items that are not present in the given dictionary. All keys of the dictionary s <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple"> <li><strong>print_container</strong> (<em>iterable</em>) – container for iterables –> [[row1], [row2], …]</li> -<li><strong>kwargs</strong> (<em>str</em>) – keyword arguments for printing</li> +<li><strong>kwargs</strong> (<em>str</em><em>, </em><em>bool</em>) – keyword arguments for printing</li> </ul> </td> </tr> @@ -8616,7 +5162,6 @@ argument is specified, only the input or output of the function will be included <li><a class="reference internal" href="#datagraph">DataGraph</a></li> <li><a class="reference internal" href="#repositoryconnectivitygraph">RepositoryConnectivityGraph</a></li> <li><a class="reference internal" href="#fundamentalproblemgraph">FundamentalProblemGraph</a></li> -<li><a class="reference internal" href="#processgraph">ProcessGraph</a></li> <li><a class="reference internal" href="#mdaoprocessgraph">MdaoProcessGraph</a></li> <li><a class="reference internal" href="#mdaomixin">MdaoMixin</a></li> <li><a class="reference internal" href="#equationmixin">EquationMixin</a></li> diff --git a/doc/_sources/KADMOS.rst.txt b/doc/_sources/KADMOS.rst.txt index 0d6721f5080856020c770ae466f0043a774b101d..865dfcfa0438c9f3dba62e631ada773e7043368b 100644 --- a/doc/_sources/KADMOS.rst.txt +++ b/doc/_sources/KADMOS.rst.txt @@ -38,13 +38,11 @@ KadmosGraph ~~~~~~~~~~~ .. autoclass:: kadmos.graph.graph_kadmos.KadmosGraph :members: - :inherited-members: DataGraph ~~~~~~~~~ .. autoclass:: kadmos.graph.graph_data.DataGraph :members: - :inherited-members: RepositoryConnectivityGraph ~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -56,11 +54,6 @@ FundamentalProblemGraph .. autoclass:: kadmos.graph.graph_data.FundamentalProblemGraph :members: -ProcessGraph -~~~~~~~~~~~~~~~~ -.. autoclass:: kadmos.graph.graph_process.ProcessGraph - :members: - MdaoProcessGraph ~~~~~~~~~~~~~~~~ .. autoclass:: kadmos.graph.graph_process.MdaoProcessGraph diff --git a/doc/genindex.html b/doc/genindex.html index d52b6a1aed848a08685ee8796c48f2d0b86a5e00..72b0451e838ac800c33ffe85c70c1276465cd6d3 100644 --- a/doc/genindex.html +++ b/doc/genindex.html @@ -70,24 +70,16 @@ <li><a href="KADMOS.html#kadmos.cmdows.cmdows.CMDOWS.add_contact">add_contact() (kadmos.cmdows.cmdows.CMDOWS method)</a> <ul> - <li><a href="KADMOS.html#kadmos.graph.graph_data.DataGraph.add_contact">(kadmos.graph.graph_data.DataGraph method)</a> -</li> <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.add_contact">(kadmos.graph.graph_kadmos.KadmosGraph method)</a> </li> </ul></li> - <li><a href="KADMOS.html#kadmos.graph.graph_data.DataGraph.add_contact_roles">add_contact_roles() (kadmos.graph.graph_data.DataGraph method)</a> - - <ul> - <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.add_contact_roles">(kadmos.graph.graph_kadmos.KadmosGraph method)</a> + <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.add_contact_roles">add_contact_roles() (kadmos.graph.graph_kadmos.KadmosGraph method)</a> </li> - </ul></li> <li><a href="KADMOS.html#kadmos.cmdows.cmdows.CMDOWS.add_dc">add_dc() (kadmos.cmdows.cmdows.CMDOWS method)</a> </li> <li><a href="KADMOS.html#kadmos.cmdows.cmdows.CMDOWS.add_dc_general_info">add_dc_general_info() (kadmos.cmdows.cmdows.CMDOWS method)</a> <ul> - <li><a href="KADMOS.html#kadmos.graph.graph_data.DataGraph.add_dc_general_info">(kadmos.graph.graph_data.DataGraph method)</a> -</li> <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.add_dc_general_info">(kadmos.graph.graph_kadmos.KadmosGraph method)</a> </li> </ul></li> @@ -98,147 +90,55 @@ <li><a href="KADMOS.html#kadmos.cmdows.cmdows.CMDOWS.add_dc_performance_info">add_dc_performance_info() (kadmos.cmdows.cmdows.CMDOWS method)</a> <ul> - <li><a href="KADMOS.html#kadmos.graph.graph_data.DataGraph.add_dc_performance_info">(kadmos.graph.graph_data.DataGraph method)</a> -</li> <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.add_dc_performance_info">(kadmos.graph.graph_kadmos.KadmosGraph method)</a> </li> </ul></li> <li><a href="KADMOS.html#kadmos.cmdows.cmdows.CMDOWS.add_dc_remote_component_info">add_dc_remote_component_info() (kadmos.cmdows.cmdows.CMDOWS method)</a> <ul> - <li><a href="KADMOS.html#kadmos.graph.graph_data.DataGraph.add_dc_remote_component_info">(kadmos.graph.graph_data.DataGraph method)</a> -</li> <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.add_dc_remote_component_info">(kadmos.graph.graph_kadmos.KadmosGraph method)</a> </li> </ul></li> <li><a href="KADMOS.html#kadmos.cmdows.cmdows.CMDOWS.add_dc_verification">add_dc_verification() (kadmos.cmdows.cmdows.CMDOWS method)</a> </li> - <li><a href="KADMOS.html#kadmos.graph.graph_data.DataGraph.add_default_description">add_default_description() (kadmos.graph.graph_data.DataGraph method)</a> - - <ul> - <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.add_default_description">(kadmos.graph.graph_kadmos.KadmosGraph method)</a> + <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.add_default_description">add_default_description() (kadmos.graph.graph_kadmos.KadmosGraph method)</a> </li> - </ul></li> - <li><a href="KADMOS.html#kadmos.graph.graph_data.DataGraph.add_default_name">add_default_name() (kadmos.graph.graph_data.DataGraph method)</a> - - <ul> - <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.add_default_name">(kadmos.graph.graph_kadmos.KadmosGraph method)</a> + <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.add_default_name">add_default_name() (kadmos.graph.graph_kadmos.KadmosGraph method)</a> </li> - </ul></li> - <li><a href="KADMOS.html#kadmos.graph.graph_data.DataGraph.add_edge">add_edge() (kadmos.graph.graph_data.DataGraph method)</a> - - <ul> - <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.add_edge">(kadmos.graph.graph_kadmos.KadmosGraph method)</a> -</li> - </ul></li> - <li><a href="KADMOS.html#kadmos.graph.graph_data.DataGraph.add_edges_from">add_edges_from() (kadmos.graph.graph_data.DataGraph method)</a> - - <ul> - <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.add_edges_from">(kadmos.graph.graph_kadmos.KadmosGraph method)</a> + </ul></td> + <td style="width: 33%; vertical-align: top;"><ul> + <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.add_edge">add_edge() (kadmos.graph.graph_kadmos.KadmosGraph method)</a> </li> - </ul></li> <li><a href="KADMOS.html#kadmos.cmdows.cmdows.CMDOWS.add_element_to_element_of_uid">add_element_to_element_of_uid() (kadmos.cmdows.cmdows.CMDOWS method)</a> </li> - <li><a href="KADMOS.html#kadmos.graph.graph_data.DataGraph.add_equation">add_equation() (kadmos.graph.graph_data.DataGraph method)</a> - - <ul> - <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.add_equation">(kadmos.graph.graph_kadmos.KadmosGraph method)</a> -</li> - <li><a href="KADMOS.html#kadmos.graph.mixin_equation.EquationMixin.add_equation">(kadmos.graph.mixin_equation.EquationMixin method)</a> -</li> - </ul></li> - <li><a href="KADMOS.html#kadmos.graph.graph_data.DataGraph.add_equation_label">add_equation_label() (kadmos.graph.graph_data.DataGraph method)</a> - - <ul> - <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.add_equation_label">(kadmos.graph.graph_kadmos.KadmosGraph method)</a> -</li> - <li><a href="KADMOS.html#kadmos.graph.mixin_equation.EquationMixin.add_equation_label">(kadmos.graph.mixin_equation.EquationMixin method)</a> + <li><a href="KADMOS.html#kadmos.graph.mixin_equation.EquationMixin.add_equation">add_equation() (kadmos.graph.mixin_equation.EquationMixin method)</a> </li> - </ul></li> - </ul></td> - <td style="width: 33%; vertical-align: top;"><ul> - <li><a href="KADMOS.html#kadmos.graph.graph_data.DataGraph.add_equation_labels">add_equation_labels() (kadmos.graph.graph_data.DataGraph method)</a> - - <ul> - <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.add_equation_labels">(kadmos.graph.graph_kadmos.KadmosGraph method)</a> + <li><a href="KADMOS.html#kadmos.graph.mixin_equation.EquationMixin.add_equation_label">add_equation_label() (kadmos.graph.mixin_equation.EquationMixin method)</a> </li> - <li><a href="KADMOS.html#kadmos.graph.mixin_equation.EquationMixin.add_equation_labels">(kadmos.graph.mixin_equation.EquationMixin method)</a> + <li><a href="KADMOS.html#kadmos.graph.mixin_equation.EquationMixin.add_equation_labels">add_equation_labels() (kadmos.graph.mixin_equation.EquationMixin method)</a> </li> - </ul></li> <li><a href="KADMOS.html#kadmos.graph.graph_data.FundamentalProblemGraph.add_function_problem_roles">add_function_problem_roles() (kadmos.graph.graph_data.FundamentalProblemGraph method)</a> </li> <li><a href="KADMOS.html#kadmos.cmdows.cmdows.CMDOWS.add_header">add_header() (kadmos.cmdows.cmdows.CMDOWS method)</a> </li> - <li><a href="KADMOS.html#kadmos.graph.graph_data.DataGraph.add_instance">add_instance() (kadmos.graph.graph_data.DataGraph method)</a> - - <ul> - <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.add_instance">(kadmos.graph.graph_kadmos.KadmosGraph method)</a> + <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.add_instance">add_instance() (kadmos.graph.graph_kadmos.KadmosGraph method)</a> </li> - </ul></li> - <li><a href="KADMOS.html#kadmos.graph.graph_data.DataGraph.add_mathematical_function">add_mathematical_function() (kadmos.graph.graph_data.DataGraph method)</a> - - <ul> - <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.add_mathematical_function">(kadmos.graph.graph_kadmos.KadmosGraph method)</a> + <li><a href="KADMOS.html#kadmos.graph.mixin_equation.EquationMixin.add_mathematical_function">add_mathematical_function() (kadmos.graph.mixin_equation.EquationMixin method)</a> </li> - <li><a href="KADMOS.html#kadmos.graph.mixin_equation.EquationMixin.add_mathematical_function">(kadmos.graph.mixin_equation.EquationMixin method)</a> -</li> - </ul></li> <li><a href="KADMOS.html#kadmos.cmdows.cmdows.CMDOWS.add_new_parameters_from_element">add_new_parameters_from_element() (kadmos.cmdows.cmdows.CMDOWS method)</a> </li> - <li><a href="KADMOS.html#kadmos.graph.graph_data.DataGraph.add_node">add_node() (kadmos.graph.graph_data.DataGraph method)</a> - - <ul> - <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.add_node">(kadmos.graph.graph_kadmos.KadmosGraph method)</a> + <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.add_node">add_node() (kadmos.graph.graph_kadmos.KadmosGraph method)</a> </li> - </ul></li> - <li><a href="KADMOS.html#kadmos.graph.graph_data.DataGraph.add_nodes_from">add_nodes_from() (kadmos.graph.graph_data.DataGraph method)</a> - - <ul> - <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.add_nodes_from">(kadmos.graph.graph_kadmos.KadmosGraph method)</a> + <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.add_objective_function_by_nodes">add_objective_function_by_nodes() (kadmos.graph.graph_kadmos.KadmosGraph method)</a> </li> - </ul></li> - <li><a href="KADMOS.html#kadmos.graph.graph_data.DataGraph.add_objective_function_by_nodes">add_objective_function_by_nodes() (kadmos.graph.graph_data.DataGraph method)</a> - - <ul> - <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.add_objective_function_by_nodes">(kadmos.graph.graph_kadmos.KadmosGraph method)</a> + <li><a href="KADMOS.html#kadmos.graph.graph_data.FundamentalProblemGraph.add_problem_formulation">add_problem_formulation() (kadmos.graph.graph_data.FundamentalProblemGraph method)</a> </li> - </ul></li> <li><a href="KADMOS.html#kadmos.graph.graph_process.MdaoProcessGraph.add_process">add_process() (kadmos.graph.graph_process.MdaoProcessGraph method)</a> </li> <li><a href="KADMOS.html#kadmos.utilities.xml.ExtendedElement.add_process_hierarchy">add_process_hierarchy() (kadmos.utilities.xml.ExtendedElement method)</a> </li> <li><a href="KADMOS.html#kadmos.graph.graph_process.MdaoProcessGraph.add_process_partitions">add_process_partitions() (kadmos.graph.graph_process.MdaoProcessGraph method)</a> </li> - <li><a href="KADMOS.html#kadmos.graph.graph_data.DataGraph.add_weighted_edges_from">add_weighted_edges_from() (kadmos.graph.graph_data.DataGraph method)</a> - - <ul> - <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.add_weighted_edges_from">(kadmos.graph.graph_kadmos.KadmosGraph method)</a> -</li> - </ul></li> - <li><a href="KADMOS.html#kadmos.graph.graph_data.DataGraph.adj">adj (kadmos.graph.graph_data.DataGraph attribute)</a> - - <ul> - <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.adj">(kadmos.graph.graph_kadmos.KadmosGraph attribute)</a> -</li> - </ul></li> - <li><a href="KADMOS.html#kadmos.graph.graph_data.DataGraph.adjacency">adjacency() (kadmos.graph.graph_data.DataGraph method)</a> - - <ul> - <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.adjacency">(kadmos.graph.graph_kadmos.KadmosGraph method)</a> -</li> - </ul></li> - <li><a href="KADMOS.html#kadmos.graph.graph_data.DataGraph.adjlist_inner_dict_factory">adjlist_inner_dict_factory (kadmos.graph.graph_data.DataGraph attribute)</a> - - <ul> - <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.adjlist_inner_dict_factory">(kadmos.graph.graph_kadmos.KadmosGraph attribute)</a> -</li> - </ul></li> - <li><a href="KADMOS.html#kadmos.graph.graph_data.DataGraph.adjlist_outer_dict_factory">adjlist_outer_dict_factory (kadmos.graph.graph_data.DataGraph attribute)</a> - - <ul> - <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.adjlist_outer_dict_factory">(kadmos.graph.graph_kadmos.KadmosGraph attribute)</a> -</li> - </ul></li> <li><a href="KADMOS.html#kadmos.utilities.general.assert_dict_keys">assert_dict_keys() (in module kadmos.utilities.general)</a> </li> <li><a href="KADMOS.html#kadmos.cmdows.cmdows.CMDOWS.assert_element_tag">assert_element_tag() (kadmos.cmdows.cmdows.CMDOWS method)</a> @@ -249,92 +149,54 @@ <h2 id="C">C</h2> <table style="width: 100%" class="indextable genindextable"><tr> <td style="width: 33%; vertical-align: top;"><ul> - <li><a href="KADMOS.html#kadmos.graph.graph_data.DataGraph.change_graph_class">change_graph_class() (kadmos.graph.graph_data.DataGraph method)</a> - - <ul> - <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.change_graph_class">(kadmos.graph.graph_kadmos.KadmosGraph method)</a> + <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.change_graph_class">change_graph_class() (kadmos.graph.graph_kadmos.KadmosGraph method)</a> </li> - </ul></li> <li><a href="KADMOS.html#kadmos.cmdows.cmdows.CMDOWS.check">check() (kadmos.cmdows.cmdows.CMDOWS method)</a> <ul> - <li><a href="KADMOS.html#kadmos.graph.graph_data.DataGraph.check">(kadmos.graph.graph_data.DataGraph method)</a> -</li> <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.check">(kadmos.graph.graph_kadmos.KadmosGraph method)</a> </li> </ul></li> - <li><a href="KADMOS.html#kadmos.graph.graph_data.DataGraph.check_cmdows_integrity">check_cmdows_integrity() (kadmos.graph.graph_data.DataGraph method)</a> - - <ul> - <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.check_cmdows_integrity">(kadmos.graph.graph_kadmos.KadmosGraph method)</a> + <li><a href="KADMOS.html#kadmos.graph.graph_data.FundamentalProblemGraph.check_and_get_coupled_functions_groups">check_and_get_coupled_functions_groups() (kadmos.graph.graph_data.FundamentalProblemGraph method)</a> </li> - </ul></li> - <li><a href="KADMOS.html#kadmos.graph.graph_data.DataGraph.check_for_coupling">check_for_coupling() (kadmos.graph.graph_data.DataGraph method)</a> - - <ul> - <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.check_for_coupling">(kadmos.graph.graph_kadmos.KadmosGraph method)</a> + <li><a href="KADMOS.html#kadmos.graph.graph_data.FundamentalProblemGraph.check_and_get_design_variables">check_and_get_design_variables() (kadmos.graph.graph_data.FundamentalProblemGraph method)</a> +</li> + <li><a href="KADMOS.html#kadmos.graph.graph_data.FundamentalProblemGraph.check_and_get_post_coupling_functions">check_and_get_post_coupling_functions() (kadmos.graph.graph_data.FundamentalProblemGraph method)</a> +</li> + <li><a href="KADMOS.html#kadmos.graph.graph_data.FundamentalProblemGraph.check_and_get_pre_coupling_functions">check_and_get_pre_coupling_functions() (kadmos.graph.graph_data.FundamentalProblemGraph method)</a> +</li> + <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.check_cmdows_integrity">check_cmdows_integrity() (kadmos.graph.graph_kadmos.KadmosGraph method)</a> +</li> + <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.check_for_coupling">check_for_coupling() (kadmos.graph.graph_kadmos.KadmosGraph method)</a> </li> - </ul></li> <li><a href="KADMOS.html#kadmos.cmdows.cmdows.CMDOWS.check_references">check_references() (kadmos.cmdows.cmdows.CMDOWS method)</a> </li> <li><a href="KADMOS.html#kadmos.cmdows.cmdows.CMDOWS.check_schema">check_schema() (kadmos.cmdows.cmdows.CMDOWS method)</a> </li> <li><a href="KADMOS.html#kadmos.cmdows.cmdows.CMDOWS.check_uids">check_uids() (kadmos.cmdows.cmdows.CMDOWS method)</a> </li> + </ul></td> + <td style="width: 33%; vertical-align: top;"><ul> <li><a href="KADMOS.html#kadmos.utilities.xml.ExtendedElement.clean">clean() (kadmos.utilities.xml.ExtendedElement method)</a> </li> - <li><a href="KADMOS.html#kadmos.graph.graph_data.DataGraph.clear">clear() (kadmos.graph.graph_data.DataGraph method)</a> - - <ul> - <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.clear">(kadmos.graph.graph_kadmos.KadmosGraph method)</a> -</li> - </ul></li> <li><a href="KADMOS.html#kadmos.cmdows.cmdows.CMDOWS">CMDOWS (class in kadmos.cmdows.cmdows)</a> </li> <li><a href="KADMOS.html#kadmos.utilities.general.color_list">color_list() (in module kadmos.utilities.general)</a> </li> - </ul></td> - <td style="width: 33%; vertical-align: top;"><ul> <li><a href="KADMOS.html#kadmos.graph.graph_process.MdaoProcessGraph.connect_nested_iterators">connect_nested_iterators() (kadmos.graph.graph_process.MdaoProcessGraph method)</a> </li> <li><a href="KADMOS.html#kadmos.utilities.general.convert_bytes">convert_bytes() (in module kadmos.utilities.general)</a> </li> - <li><a href="KADMOS.html#kadmos.graph.graph_data.DataGraph.copy">copy() (kadmos.graph.graph_data.DataGraph method)</a> - - <ul> - <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.copy">(kadmos.graph.graph_kadmos.KadmosGraph method)</a> + <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.copy_as">copy_as() (kadmos.graph.graph_kadmos.KadmosGraph method)</a> </li> - </ul></li> - <li><a href="KADMOS.html#kadmos.graph.graph_data.DataGraph.copy_as">copy_as() (kadmos.graph.graph_data.DataGraph method)</a> - - <ul> - <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.copy_as">(kadmos.graph.graph_kadmos.KadmosGraph method)</a> -</li> - </ul></li> - <li><a href="KADMOS.html#kadmos.graph.graph_data.DataGraph.copy_edge">copy_edge() (kadmos.graph.graph_data.DataGraph method)</a> - - <ul> - <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.copy_edge">(kadmos.graph.graph_kadmos.KadmosGraph method)</a> + <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.copy_edge">copy_edge() (kadmos.graph.graph_kadmos.KadmosGraph method)</a> </li> - </ul></li> - <li><a href="KADMOS.html#kadmos.graph.graph_data.DataGraph.copy_node_with_suffix">copy_node_with_suffix() (kadmos.graph.graph_data.DataGraph method)</a> - - <ul> - <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.copy_node_with_suffix">(kadmos.graph.graph_kadmos.KadmosGraph method)</a> + <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.copy_node_with_suffix">copy_node_with_suffix() (kadmos.graph.graph_kadmos.KadmosGraph method)</a> </li> - </ul></li> - <li><a href="KADMOS.html#kadmos.graph.graph_data.DataGraph.count_function_nodes">count_function_nodes() (kadmos.graph.graph_data.DataGraph method)</a> - - <ul> - <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.count_function_nodes">(kadmos.graph.graph_kadmos.KadmosGraph method)</a> + <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.count_function_nodes">count_function_nodes() (kadmos.graph.graph_kadmos.KadmosGraph method)</a> </li> - </ul></li> - <li><a href="KADMOS.html#kadmos.graph.graph_data.DataGraph.create_dsm">create_dsm() (kadmos.graph.graph_data.DataGraph method)</a> - - <ul> - <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.create_dsm">(kadmos.graph.graph_kadmos.KadmosGraph method)</a> + <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.create_dsm">create_dsm() (kadmos.graph.graph_kadmos.KadmosGraph method)</a> </li> - </ul></li> <li><a href="KADMOS.html#kadmos.graph.graph_data.RepositoryConnectivityGraph.create_mathematical_problem">create_mathematical_problem() (kadmos.graph.graph_data.RepositoryConnectivityGraph method)</a> </li> <li><a href="KADMOS.html#kadmos.graph.graph_data.FundamentalProblemGraph.create_mdg">create_mdg() (kadmos.graph.graph_data.FundamentalProblemGraph method)</a> @@ -349,64 +211,32 @@ <td style="width: 33%; vertical-align: top;"><ul> <li><a href="KADMOS.html#kadmos.graph.graph_data.DataGraph">DataGraph (class in kadmos.graph.graph_data)</a> </li> - <li><a href="KADMOS.html#kadmos.graph.graph_data.DataGraph.deepcopy">deepcopy() (kadmos.graph.graph_data.DataGraph method)</a> - - <ul> - <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.deepcopy">(kadmos.graph.graph_kadmos.KadmosGraph method)</a> + <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.deepcopy">deepcopy() (kadmos.graph.graph_kadmos.KadmosGraph method)</a> </li> - </ul></li> - <li><a href="KADMOS.html#kadmos.graph.graph_data.DataGraph.deepcopy_as">deepcopy_as() (kadmos.graph.graph_data.DataGraph method)</a> - - <ul> - <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.deepcopy_as">(kadmos.graph.graph_kadmos.KadmosGraph method)</a> + <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.deepcopy_as">deepcopy_as() (kadmos.graph.graph_kadmos.KadmosGraph method)</a> </li> - </ul></li> </ul></td> <td style="width: 33%; vertical-align: top;"><ul> - <li><a href="KADMOS.html#kadmos.graph.graph_data.DataGraph.degree">degree (kadmos.graph.graph_data.DataGraph attribute)</a> - - <ul> - <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.degree">(kadmos.graph.graph_kadmos.KadmosGraph attribute)</a> + <li><a href="KADMOS.html#kadmos.graph.graph_data.FundamentalProblemGraph.determine_scope_constraint_functions">determine_scope_constraint_functions() (kadmos.graph.graph_data.FundamentalProblemGraph method)</a> +</li> + <li><a href="KADMOS.html#kadmos.graph.graph_data.FundamentalProblemGraph.determine_scope_design_variables">determine_scope_design_variables() (kadmos.graph.graph_data.FundamentalProblemGraph method)</a> </li> - </ul></li> <li><a href="KADMOS.html#kadmos.utilities.general.dict_to_ord_dict">dict_to_ord_dict() (in module kadmos.utilities.general)</a> </li> - <li><a href="KADMOS.html#kadmos.graph.graph_data.DataGraph.disconnect_problematic_variables_from">disconnect_problematic_variables_from() (kadmos.graph.graph_data.DataGraph method)</a> - - <ul> - <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.disconnect_problematic_variables_from">(kadmos.graph.graph_kadmos.KadmosGraph method)</a> + <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.disconnect_problematic_variables_from">disconnect_problematic_variables_from() (kadmos.graph.graph_kadmos.KadmosGraph method)</a> </li> - </ul></li> </ul></td> </tr></table> <h2 id="E">E</h2> <table style="width: 100%" class="indextable genindextable"><tr> - <td style="width: 33%; vertical-align: top;"><ul> - <li><a href="KADMOS.html#kadmos.graph.graph_data.DataGraph.edge_attr_dict_factory">edge_attr_dict_factory (kadmos.graph.graph_data.DataGraph attribute)</a> - - <ul> - <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.edge_attr_dict_factory">(kadmos.graph.graph_kadmos.KadmosGraph attribute)</a> -</li> - </ul></li> - <li><a href="KADMOS.html#kadmos.graph.graph_data.DataGraph.edge_subgraph">edge_subgraph() (kadmos.graph.graph_data.DataGraph method)</a> - - <ul> - <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.edge_subgraph">(kadmos.graph.graph_kadmos.KadmosGraph method)</a> -</li> - </ul></li> - <li><a href="KADMOS.html#kadmos.graph.graph_data.DataGraph.edges">edges (kadmos.graph.graph_data.DataGraph attribute)</a> - - <ul> - <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.edges">(kadmos.graph.graph_kadmos.KadmosGraph attribute)</a> -</li> - </ul></li> - </ul></td> <td style="width: 33%; vertical-align: top;"><ul> <li><a href="KADMOS.html#kadmos.cmdows.cmdows.CMDOWS.ensure_abs_xpath">ensure_abs_xpath() (kadmos.cmdows.cmdows.CMDOWS method)</a> </li> <li><a href="KADMOS.html#kadmos.graph.mixin_equation.EquationMixin">EquationMixin (class in kadmos.graph.mixin_equation)</a> </li> + </ul></td> + <td style="width: 33%; vertical-align: top;"><ul> <li><a href="KADMOS.html#kadmos.utilities.general.export_as_json">export_as_json() (in module kadmos.utilities.general)</a> </li> <li><a href="KADMOS.html#kadmos.utilities.xml.ExtendedElement">ExtendedElement (class in kadmos.utilities.xml)</a> @@ -423,28 +253,18 @@ </li> <li><a href="KADMOS.html#kadmos.utilities.general.filter_group_vars">filter_group_vars() (in module kadmos.utilities.general)</a> </li> - <li><a href="KADMOS.html#kadmos.graph.graph_data.DataGraph.find_all_nodes">find_all_nodes() (kadmos.graph.graph_data.DataGraph method)</a> - - <ul> - <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.find_all_nodes">(kadmos.graph.graph_kadmos.KadmosGraph method)</a> -</li> - </ul></li> - <li><a href="KADMOS.html#kadmos.utilities.xml.ExtendedElement.findasttext">findasttext() (kadmos.utilities.xml.ExtendedElement method)</a> + <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.find_all_nodes">find_all_nodes() (kadmos.graph.graph_kadmos.KadmosGraph method)</a> </li> </ul></td> <td style="width: 33%; vertical-align: top;"><ul> + <li><a href="KADMOS.html#kadmos.utilities.xml.ExtendedElement.findasttext">findasttext() (kadmos.utilities.xml.ExtendedElement method)</a> +</li> <li><a href="KADMOS.html#kadmos.utilities.xml.ExtendedElement.finddict">finddict() (kadmos.utilities.xml.ExtendedElement method)</a> </li> <li><a href="KADMOS.html#kadmos.utilities.general.format_string_for_latex">format_string_for_latex() (in module kadmos.utilities.general)</a> </li> <li><a href="KADMOS.html#kadmos.utilities.general.format_string_for_vistoms">format_string_for_vistoms() (in module kadmos.utilities.general)</a> </li> - <li><a href="KADMOS.html#kadmos.graph.graph_data.DataGraph.fresh_copy">fresh_copy() (kadmos.graph.graph_data.DataGraph method)</a> - - <ul> - <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.fresh_copy">(kadmos.graph.graph_kadmos.KadmosGraph method)</a> -</li> - </ul></li> <li><a href="KADMOS.html#kadmos.graph.graph_data.FundamentalProblemGraph">FundamentalProblemGraph (class in kadmos.graph.graph_data)</a> </li> </ul></td> @@ -453,52 +273,24 @@ <h2 id="G">G</h2> <table style="width: 100%" class="indextable genindextable"><tr> <td style="width: 33%; vertical-align: top;"><ul> - <li><a href="KADMOS.html#kadmos.graph.graph_data.DataGraph.get_adjacency_matrix">get_adjacency_matrix() (kadmos.graph.graph_data.DataGraph method)</a> - - <ul> - <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.get_adjacency_matrix">(kadmos.graph.graph_kadmos.KadmosGraph method)</a> + <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.get_adjacency_matrix">get_adjacency_matrix() (kadmos.graph.graph_kadmos.KadmosGraph method)</a> </li> - </ul></li> - <li><a href="KADMOS.html#kadmos.graph.graph_data.DataGraph.get_architecture_node_ids">get_architecture_node_ids() (kadmos.graph.graph_data.DataGraph method)</a> - - <ul> - <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.get_architecture_node_ids">(kadmos.graph.graph_kadmos.KadmosGraph method)</a> + <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.get_architecture_node_ids">get_architecture_node_ids() (kadmos.graph.graph_kadmos.KadmosGraph method)</a> </li> - </ul></li> - <li><a href="KADMOS.html#kadmos.graph.graph_data.DataGraph.get_architecture_node_labels">get_architecture_node_labels() (kadmos.graph.graph_data.DataGraph method)</a> - - <ul> - <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.get_architecture_node_labels">(kadmos.graph.graph_kadmos.KadmosGraph method)</a> + <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.get_architecture_node_labels">get_architecture_node_labels() (kadmos.graph.graph_kadmos.KadmosGraph method)</a> </li> - </ul></li> - <li><a href="KADMOS.html#kadmos.graph.graph_data.DataGraph.get_categorized_nodes">get_categorized_nodes() (kadmos.graph.graph_data.DataGraph method)</a> - - <ul> - <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.get_categorized_nodes">(kadmos.graph.graph_kadmos.KadmosGraph method)</a> + <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.get_categorized_nodes">get_categorized_nodes() (kadmos.graph.graph_kadmos.KadmosGraph method)</a> </li> - </ul></li> - <li><a href="KADMOS.html#kadmos.graph.graph_data.DataGraph.get_contracted_graph">get_contracted_graph() (kadmos.graph.graph_data.DataGraph method)</a> - - <ul> - <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.get_contracted_graph">(kadmos.graph.graph_kadmos.KadmosGraph method)</a> + <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.get_contracted_graph">get_contracted_graph() (kadmos.graph.graph_kadmos.KadmosGraph method)</a> +</li> + <li><a href="KADMOS.html#kadmos.graph.graph_data.DataGraph.get_coupling_dictionary">get_coupling_dictionary() (kadmos.graph.graph_data.DataGraph method)</a> </li> - </ul></li> <li><a href="KADMOS.html#kadmos.graph.graph_data.DataGraph.get_coupling_matrix">get_coupling_matrix() (kadmos.graph.graph_data.DataGraph method)</a> </li> <li><a href="KADMOS.html#kadmos.cmdows.cmdows.CMDOWS.get_design_competences_uids">get_design_competences_uids() (kadmos.cmdows.cmdows.CMDOWS method)</a> </li> - <li><a href="KADMOS.html#kadmos.graph.graph_data.DataGraph.get_direct_coupling_nodes">get_direct_coupling_nodes() (kadmos.graph.graph_data.DataGraph method)</a> - - <ul> - <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.get_direct_coupling_nodes">(kadmos.graph.graph_kadmos.KadmosGraph method)</a> + <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.get_direct_coupling_nodes">get_direct_coupling_nodes() (kadmos.graph.graph_kadmos.KadmosGraph method)</a> </li> - </ul></li> - <li><a href="KADMOS.html#kadmos.graph.graph_data.DataGraph.get_edge_data">get_edge_data() (kadmos.graph.graph_data.DataGraph method)</a> - - <ul> - <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.get_edge_data">(kadmos.graph.graph_kadmos.KadmosGraph method)</a> -</li> - </ul></li> <li><a href="KADMOS.html#kadmos.utilities.xml.get_element_details">get_element_details() (in module kadmos.utilities.xml)</a> </li> <li><a href="KADMOS.html#kadmos.utilities.general.get_element_dict">get_element_dict() (in module kadmos.utilities.general)</a> @@ -509,12 +301,8 @@ </li> <li><a href="KADMOS.html#kadmos.graph.graph_data.DataGraph.get_feedback_info">get_feedback_info() (kadmos.graph.graph_data.DataGraph method)</a> </li> - <li><a href="KADMOS.html#kadmos.graph.graph_data.DataGraph.get_first_node_instance">get_first_node_instance() (kadmos.graph.graph_data.DataGraph method)</a> - - <ul> - <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.get_first_node_instance">(kadmos.graph.graph_kadmos.KadmosGraph method)</a> + <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.get_first_node_instance">get_first_node_instance() (kadmos.graph.graph_kadmos.KadmosGraph method)</a> </li> - </ul></li> <li><a href="KADMOS.html#kadmos.graph.graph_data.RepositoryConnectivityGraph.get_fpg_based_on_function_nodes">get_fpg_based_on_function_nodes() (kadmos.graph.graph_data.RepositoryConnectivityGraph method)</a> </li> <li><a href="KADMOS.html#kadmos.graph.graph_data.RepositoryConnectivityGraph.get_fpg_based_on_list_functions">get_fpg_based_on_list_functions() (kadmos.graph.graph_data.RepositoryConnectivityGraph method)</a> @@ -527,35 +315,25 @@ </li> <li><a href="KADMOS.html#kadmos.knowledgebase.knowledgebase.KnowledgeBase.get_function_dependencies">get_function_dependencies() (kadmos.knowledgebase.knowledgebase.KnowledgeBase method)</a> </li> - <li><a href="KADMOS.html#kadmos.graph.graph_data.DataGraph.get_function_graph">get_function_graph() (kadmos.graph.graph_data.DataGraph method)</a> + <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.get_function_graph">get_function_graph() (kadmos.graph.graph_kadmos.KadmosGraph method)</a> <ul> - <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.get_function_graph">(kadmos.graph.graph_kadmos.KadmosGraph method)</a> -</li> <li><a href="KADMOS.html#kadmos.knowledgebase.knowledgebase.KnowledgeBase.get_function_graph">(kadmos.knowledgebase.knowledgebase.KnowledgeBase method)</a> </li> </ul></li> - <li><a href="KADMOS.html#kadmos.graph.graph_data.DataGraph.get_function_metadata">get_function_metadata() (kadmos.graph.graph_data.DataGraph method)</a> - - <ul> - <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.get_function_metadata">(kadmos.graph.graph_kadmos.KadmosGraph method)</a> + <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.get_function_metadata">get_function_metadata() (kadmos.graph.graph_kadmos.KadmosGraph method)</a> </li> - </ul></li> - <li><a href="KADMOS.html#kadmos.graph.graph_data.DataGraph.get_function_nodes">get_function_nodes() (kadmos.graph.graph_data.DataGraph method)</a> - - <ul> - <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.get_function_nodes">(kadmos.graph.graph_kadmos.KadmosGraph method)</a> + <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.get_function_nodes">get_function_nodes() (kadmos.graph.graph_kadmos.KadmosGraph method)</a> </li> - </ul></li> <li><a href="KADMOS.html#kadmos.graph.graph_data.RepositoryConnectivityGraph.get_function_paths_by_objective">get_function_paths_by_objective() (kadmos.graph.graph_data.RepositoryConnectivityGraph method)</a> </li> - <li><a href="KADMOS.html#kadmos.graph.graph_data.DataGraph.get_graph_properties">get_graph_properties() (kadmos.graph.graph_data.DataGraph method)</a> - - <ul> - <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.get_graph_properties">(kadmos.graph.graph_kadmos.KadmosGraph method)</a> + <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.get_graph_properties">get_graph_properties() (kadmos.graph.graph_kadmos.KadmosGraph method)</a> +</li> + <li><a href="KADMOS.html#kadmos.graph.graph_data.FundamentalProblemGraph.get_group_couplings">get_group_couplings() (kadmos.graph.graph_data.FundamentalProblemGraph method)</a> </li> - </ul></li> <li><a href="KADMOS.html#kadmos.utilities.general.get_group_vars">get_group_vars() (in module kadmos.utilities.general)</a> +</li> + <li><a href="KADMOS.html#kadmos.graph.graph_data.DataGraph.get_highest_instance">get_highest_instance() (kadmos.graph.graph_data.DataGraph method)</a> </li> <li><a href="KADMOS.html#kadmos.cmdows.cmdows.CMDOWS.get_inputs_uids">get_inputs_uids() (kadmos.cmdows.cmdows.CMDOWS method)</a> </li> @@ -565,67 +343,41 @@ </li> <li><a href="KADMOS.html#kadmos.graph.graph_process.MdaoProcessGraph.get_lowest_psn">get_lowest_psn() (kadmos.graph.graph_process.MdaoProcessGraph method)</a> </li> - </ul></td> - <td style="width: 33%; vertical-align: top;"><ul> <li><a href="KADMOS.html#kadmos.cmdows.cmdows.CMDOWS.get_mathematical_functions_uids">get_mathematical_functions_uids() (kadmos.cmdows.cmdows.CMDOWS method)</a> </li> + </ul></td> + <td style="width: 33%; vertical-align: top;"><ul> <li><a href="KADMOS.html#kadmos.utilities.general.get_mdao_setup">get_mdao_setup() (in module kadmos.utilities.general)</a> </li> <li><a href="KADMOS.html#kadmos.graph.graph_data.FundamentalProblemGraph.get_mdg">get_mdg() (kadmos.graph.graph_data.FundamentalProblemGraph method)</a> </li> <li><a href="KADMOS.html#kadmos.graph.graph_data.FundamentalProblemGraph.get_mg_function_ordering">get_mg_function_ordering() (kadmos.graph.graph_data.FundamentalProblemGraph method)</a> </li> - <li><a href="KADMOS.html#kadmos.graph.graph_data.FundamentalProblemGraph.get_mpg">get_mpg() (kadmos.graph.graph_data.FundamentalProblemGraph method)</a> + <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.get_node_attributes">get_node_attributes() (kadmos.graph.graph_kadmos.KadmosGraph method)</a> </li> - <li><a href="KADMOS.html#kadmos.graph.graph_data.DataGraph.get_node_attributes">get_node_attributes() (kadmos.graph.graph_data.DataGraph method)</a> - - <ul> - <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.get_node_attributes">(kadmos.graph.graph_kadmos.KadmosGraph method)</a> + <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.get_node_subcategory">get_node_subcategory() (kadmos.graph.graph_kadmos.KadmosGraph method)</a> </li> - </ul></li> - <li><a href="KADMOS.html#kadmos.graph.graph_data.DataGraph.get_node_subcategory">get_node_subcategory() (kadmos.graph.graph_data.DataGraph method)</a> - - <ul> - <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.get_node_subcategory">(kadmos.graph.graph_kadmos.KadmosGraph method)</a> -</li> - </ul></li> <li><a href="KADMOS.html#kadmos.graph.graph_process.MdaoProcessGraph.get_node_text">get_node_text() (kadmos.graph.graph_process.MdaoProcessGraph method)</a> </li> - <li><a href="KADMOS.html#kadmos.graph.graph_data.DataGraph.get_nodes_based_on_strings">get_nodes_based_on_strings() (kadmos.graph.graph_data.DataGraph method)</a> - - <ul> - <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.get_nodes_based_on_strings">(kadmos.graph.graph_kadmos.KadmosGraph method)</a> + <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.get_nodes_based_on_strings">get_nodes_based_on_strings() (kadmos.graph.graph_kadmos.KadmosGraph method)</a> </li> - </ul></li> - <li><a href="KADMOS.html#kadmos.graph.graph_data.DataGraph.get_nodes_indegree">get_nodes_indegree() (kadmos.graph.graph_data.DataGraph method)</a> - - <ul> - <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.get_nodes_indegree">(kadmos.graph.graph_kadmos.KadmosGraph method)</a> + <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.get_nodes_indegree">get_nodes_indegree() (kadmos.graph.graph_kadmos.KadmosGraph method)</a> </li> - </ul></li> - <li><a href="KADMOS.html#kadmos.graph.graph_data.DataGraph.get_nodes_outdegree">get_nodes_outdegree() (kadmos.graph.graph_data.DataGraph method)</a> - - <ul> - <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.get_nodes_outdegree">(kadmos.graph.graph_kadmos.KadmosGraph method)</a> + <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.get_nodes_outdegree">get_nodes_outdegree() (kadmos.graph.graph_kadmos.KadmosGraph method)</a> </li> - </ul></li> - <li><a href="KADMOS.html#kadmos.graph.graph_data.DataGraph.get_nodes_subcategory">get_nodes_subcategory() (kadmos.graph.graph_data.DataGraph method)</a> - - <ul> - <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.get_nodes_subcategory">(kadmos.graph.graph_kadmos.KadmosGraph method)</a> + <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.get_nodes_subcategory">get_nodes_subcategory() (kadmos.graph.graph_kadmos.KadmosGraph method)</a> </li> - </ul></li> - <li><a href="KADMOS.html#kadmos.graph.graph_data.DataGraph.get_number_of_couplings">get_number_of_couplings() (kadmos.graph.graph_data.DataGraph method)</a> - - <ul> - <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.get_number_of_couplings">(kadmos.graph.graph_kadmos.KadmosGraph method)</a> + <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.get_number_of_couplings">get_number_of_couplings() (kadmos.graph.graph_kadmos.KadmosGraph method)</a> +</li> + <li><a href="KADMOS.html#kadmos.graph.graph_data.FundamentalProblemGraph.get_objective_node">get_objective_node() (kadmos.graph.graph_data.FundamentalProblemGraph method)</a> </li> - </ul></li> <li><a href="KADMOS.html#kadmos.graph.graph_process.MdaoProcessGraph.get_ordered_cycles">get_ordered_cycles() (kadmos.graph.graph_process.MdaoProcessGraph method)</a> </li> <li><a href="KADMOS.html#kadmos.cmdows.cmdows.CMDOWS.get_outputs_uids">get_outputs_uids() (kadmos.cmdows.cmdows.CMDOWS method)</a> </li> <li><a href="KADMOS.html#kadmos.cmdows.cmdows.CMDOWS.get_parameters_uids">get_parameters_uids() (kadmos.cmdows.cmdows.CMDOWS method)</a> +</li> + <li><a href="KADMOS.html#kadmos.graph.graph_data.FundamentalProblemGraph.get_partition_info">get_partition_info() (kadmos.graph.graph_data.FundamentalProblemGraph method)</a> </li> <li><a href="KADMOS.html#kadmos.graph.graph_data.RepositoryConnectivityGraph.get_path_combinations">get_path_combinations() (kadmos.graph.graph_data.RepositoryConnectivityGraph method)</a> </li> @@ -637,36 +389,22 @@ </li> <li><a href="KADMOS.html#kadmos.knowledgebase.knowledgebase.KnowledgeBase.get_rcg">get_rcg() (kadmos.knowledgebase.knowledgebase.KnowledgeBase method)</a> </li> - <li><a href="KADMOS.html#kadmos.graph.graph_data.DataGraph.get_same_graph_class">get_same_graph_class() (kadmos.graph.graph_data.DataGraph method)</a> - - <ul> - <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.get_same_graph_class">(kadmos.graph.graph_kadmos.KadmosGraph method)</a> + <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.get_same_graph_class">get_same_graph_class() (kadmos.graph.graph_kadmos.KadmosGraph method)</a> </li> - </ul></li> - <li><a href="KADMOS.html#kadmos.graph.graph_data.DataGraph.get_sources">get_sources() (kadmos.graph.graph_data.DataGraph method)</a> - - <ul> - <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.get_sources">(kadmos.graph.graph_kadmos.KadmosGraph method)</a> + <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.get_sources">get_sources() (kadmos.graph.graph_kadmos.KadmosGraph method)</a> </li> - </ul></li> - <li><a href="KADMOS.html#kadmos.graph.graph_data.DataGraph.get_subgraph_by_function_nodes">get_subgraph_by_function_nodes() (kadmos.graph.graph_data.DataGraph method)</a> - - <ul> - <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.get_subgraph_by_function_nodes">(kadmos.graph.graph_kadmos.KadmosGraph method)</a> + <li><a href="KADMOS.html#kadmos.graph.graph_data.FundamentalProblemGraph.get_sub_level_functions">get_sub_level_functions() (kadmos.graph.graph_data.FundamentalProblemGraph method)</a> </li> - </ul></li> - <li><a href="KADMOS.html#kadmos.graph.graph_data.DataGraph.get_system_inputs">get_system_inputs() (kadmos.graph.graph_data.DataGraph method)</a> - - <ul> - <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.get_system_inputs">(kadmos.graph.graph_kadmos.KadmosGraph method)</a> + <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.get_subgraph_by_function_nodes">get_subgraph_by_function_nodes() (kadmos.graph.graph_kadmos.KadmosGraph method)</a> </li> - </ul></li> - <li><a href="KADMOS.html#kadmos.graph.graph_data.DataGraph.get_targets">get_targets() (kadmos.graph.graph_data.DataGraph method)</a> - - <ul> - <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.get_targets">(kadmos.graph.graph_kadmos.KadmosGraph method)</a> + <li><a href="KADMOS.html#kadmos.graph.graph_data.FundamentalProblemGraph.get_sys_post_couplings">get_sys_post_couplings() (kadmos.graph.graph_data.FundamentalProblemGraph method)</a> +</li> + <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.get_system_inputs">get_system_inputs() (kadmos.graph.graph_kadmos.KadmosGraph method)</a> +</li> + <li><a href="KADMOS.html#kadmos.graph.graph_data.FundamentalProblemGraph.get_system_level_functions">get_system_level_functions() (kadmos.graph.graph_data.FundamentalProblemGraph method)</a> +</li> + <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.get_targets">get_targets() (kadmos.graph.graph_kadmos.KadmosGraph method)</a> </li> - </ul></li> <li><a href="KADMOS.html#kadmos.utilities.general.get_uid">get_uid() (in module kadmos.utilities.general)</a> </li> <li><a href="KADMOS.html#kadmos.utilities.xml.get_uid_search_xpath">get_uid_search_xpath() (in module kadmos.utilities.xml)</a> @@ -677,50 +415,18 @@ </li> <li><a href="KADMOS.html#kadmos.cmdows.cmdows.CMDOWS.get_xpath_of_uid">get_xpath_of_uid() (kadmos.cmdows.cmdows.CMDOWS method)</a> </li> - <li><a href="KADMOS.html#kadmos.graph.graph_data.DataGraph.graph_has_nested_attributes">graph_has_nested_attributes() (kadmos.graph.graph_data.DataGraph method)</a> - - <ul> - <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.graph_has_nested_attributes">(kadmos.graph.graph_kadmos.KadmosGraph method)</a> + <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.graph_has_nested_attributes">graph_has_nested_attributes() (kadmos.graph.graph_kadmos.KadmosGraph method)</a> </li> - </ul></li> </ul></td> </tr></table> <h2 id="H">H</h2> <table style="width: 100%" class="indextable genindextable"><tr> <td style="width: 33%; vertical-align: top;"><ul> - <li><a href="KADMOS.html#kadmos.graph.graph_data.DataGraph.has_edge">has_edge() (kadmos.graph.graph_data.DataGraph method)</a> - - <ul> - <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.has_edge">(kadmos.graph.graph_kadmos.KadmosGraph method)</a> + <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.has_nodes">has_nodes() (kadmos.graph.graph_kadmos.KadmosGraph method)</a> </li> - </ul></li> - <li><a href="KADMOS.html#kadmos.graph.graph_data.DataGraph.has_node">has_node() (kadmos.graph.graph_data.DataGraph method)</a> - - <ul> - <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.has_node">(kadmos.graph.graph_kadmos.KadmosGraph method)</a> -</li> - </ul></li> - <li><a href="KADMOS.html#kadmos.graph.graph_data.DataGraph.has_nodes">has_nodes() (kadmos.graph.graph_data.DataGraph method)</a> - - <ul> - <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.has_nodes">(kadmos.graph.graph_kadmos.KadmosGraph method)</a> -</li> - </ul></li> </ul></td> <td style="width: 33%; vertical-align: top;"><ul> - <li><a href="KADMOS.html#kadmos.graph.graph_data.DataGraph.has_predecessor">has_predecessor() (kadmos.graph.graph_data.DataGraph method)</a> - - <ul> - <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.has_predecessor">(kadmos.graph.graph_kadmos.KadmosGraph method)</a> -</li> - </ul></li> - <li><a href="KADMOS.html#kadmos.graph.graph_data.DataGraph.has_successor">has_successor() (kadmos.graph.graph_data.DataGraph method)</a> - - <ul> - <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.has_successor">(kadmos.graph.graph_kadmos.KadmosGraph method)</a> -</li> - </ul></li> <li><a href="KADMOS.html#kadmos.utilities.general.hex_to_rgb">hex_to_rgb() (in module kadmos.utilities.general)</a> </li> </ul></td> @@ -731,54 +437,18 @@ <td style="width: 33%; vertical-align: top;"><ul> <li><a href="KADMOS.html#kadmos.graph.graph_data.FundamentalProblemGraph.impose_mdao_architecture">impose_mdao_architecture() (kadmos.graph.graph_data.FundamentalProblemGraph method)</a> </li> - <li><a href="KADMOS.html#kadmos.graph.graph_data.DataGraph.in_degree">in_degree (kadmos.graph.graph_data.DataGraph attribute)</a> - - <ul> - <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.in_degree">(kadmos.graph.graph_kadmos.KadmosGraph attribute)</a> -</li> - </ul></li> - <li><a href="KADMOS.html#kadmos.graph.graph_data.DataGraph.in_edges">in_edges (kadmos.graph.graph_data.DataGraph attribute)</a> - - <ul> - <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.in_edges">(kadmos.graph.graph_kadmos.KadmosGraph attribute)</a> -</li> - </ul></li> <li><a href="KADMOS.html#kadmos.graph.mixin_mdao.MdaoMixin.insert_node_on_diagonal">insert_node_on_diagonal() (kadmos.graph.mixin_mdao.MdaoMixin method)</a> </li> - <li><a href="KADMOS.html#kadmos.graph.graph_data.DataGraph.inspect">inspect() (kadmos.graph.graph_data.DataGraph method)</a> - - <ul> - <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.inspect">(kadmos.graph.graph_kadmos.KadmosGraph method)</a> + <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.inspect">inspect() (kadmos.graph.graph_kadmos.KadmosGraph method)</a> </li> - </ul></li> </ul></td> <td style="width: 33%; vertical-align: top;"><ul> - <li><a href="KADMOS.html#kadmos.graph.graph_data.DataGraph.inspect_node">inspect_node() (kadmos.graph.graph_data.DataGraph method)</a> - - <ul> - <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.inspect_node">(kadmos.graph.graph_kadmos.KadmosGraph method)</a> + <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.inspect_node">inspect_node() (kadmos.graph.graph_kadmos.KadmosGraph method)</a> </li> - </ul></li> - <li><a href="KADMOS.html#kadmos.graph.graph_data.DataGraph.inspect_nodes">inspect_nodes() (kadmos.graph.graph_data.DataGraph method)</a> - - <ul> - <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.inspect_nodes">(kadmos.graph.graph_kadmos.KadmosGraph method)</a> + <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.inspect_nodes">inspect_nodes() (kadmos.graph.graph_kadmos.KadmosGraph method)</a> </li> - </ul></li> <li><a href="KADMOS.html#kadmos.graph.graph_process.MdaoProcessGraph.inspect_process">inspect_process() (kadmos.graph.graph_process.MdaoProcessGraph method)</a> </li> - <li><a href="KADMOS.html#kadmos.graph.graph_data.DataGraph.is_directed">is_directed() (kadmos.graph.graph_data.DataGraph method)</a> - - <ul> - <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.is_directed">(kadmos.graph.graph_kadmos.KadmosGraph method)</a> -</li> - </ul></li> - <li><a href="KADMOS.html#kadmos.graph.graph_data.DataGraph.is_multigraph">is_multigraph() (kadmos.graph.graph_data.DataGraph method)</a> - - <ul> - <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.is_multigraph">(kadmos.graph.graph_kadmos.KadmosGraph method)</a> -</li> - </ul></li> </ul></td> </tr></table> @@ -807,24 +477,16 @@ <h2 id="L">L</h2> <table style="width: 100%" class="indextable genindextable"><tr> <td style="width: 33%; vertical-align: top;"><ul> - <li><a href="KADMOS.html#kadmos.graph.graph_data.DataGraph.load_cmdows">load_cmdows() (kadmos.graph.graph_data.DataGraph method)</a> - - <ul> - <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.load_cmdows">(kadmos.graph.graph_kadmos.KadmosGraph method)</a> + <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.load_cmdows">load_cmdows() (kadmos.graph.graph_kadmos.KadmosGraph method)</a> </li> - </ul></li> </ul></td> </tr></table> <h2 id="M">M</h2> <table style="width: 100%" class="indextable genindextable"><tr> <td style="width: 33%; vertical-align: top;"><ul> - <li><a href="KADMOS.html#kadmos.graph.graph_data.DataGraph.make_all_variables_valid">make_all_variables_valid() (kadmos.graph.graph_data.DataGraph method)</a> - - <ul> - <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.make_all_variables_valid">(kadmos.graph.graph_kadmos.KadmosGraph method)</a> + <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.make_all_variables_valid">make_all_variables_valid() (kadmos.graph.graph_kadmos.KadmosGraph method)</a> </li> - </ul></li> <li><a href="KADMOS.html#kadmos.utilities.general.make_camel_case">make_camel_case() (in module kadmos.utilities.general)</a> </li> <li><a href="KADMOS.html#kadmos.utilities.general.make_plural">make_plural() (in module kadmos.utilities.general)</a> @@ -841,46 +503,26 @@ </li> <li><a href="KADMOS.html#kadmos.graph.graph_data.DataGraph.mark_as_objective">mark_as_objective() (kadmos.graph.graph_data.DataGraph method)</a> </li> + </ul></td> + <td style="width: 33%; vertical-align: top;"><ul> <li><a href="KADMOS.html#kadmos.graph.graph_data.DataGraph.mark_as_qois">mark_as_qois() (kadmos.graph.graph_data.DataGraph method)</a> </li> <li><a href="KADMOS.html#kadmos.graph.mixin_mdao.MdaoMixin">MdaoMixin (class in kadmos.graph.mixin_mdao)</a> </li> - </ul></td> - <td style="width: 33%; vertical-align: top;"><ul> <li><a href="KADMOS.html#kadmos.graph.graph_process.MdaoProcessGraph">MdaoProcessGraph (class in kadmos.graph.graph_process)</a> </li> <li><a href="KADMOS.html#kadmos.utilities.xml.merge">merge() (in module kadmos.utilities.xml)</a> </li> - <li><a href="KADMOS.html#kadmos.graph.graph_data.DataGraph.merge_function_modes">merge_function_modes() (kadmos.graph.graph_data.DataGraph method)</a> - - <ul> - <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.merge_function_modes">(kadmos.graph.graph_kadmos.KadmosGraph method)</a> + <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.merge_function_modes">merge_function_modes() (kadmos.graph.graph_kadmos.KadmosGraph method)</a> </li> - </ul></li> - <li><a href="KADMOS.html#kadmos.graph.graph_data.DataGraph.merge_function_nodes_based_on_modes">merge_function_nodes_based_on_modes() (kadmos.graph.graph_data.DataGraph method)</a> - - <ul> - <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.merge_function_nodes_based_on_modes">(kadmos.graph.graph_kadmos.KadmosGraph method)</a> + <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.merge_function_nodes_based_on_modes">merge_function_nodes_based_on_modes() (kadmos.graph.graph_kadmos.KadmosGraph method)</a> </li> - </ul></li> - <li><a href="KADMOS.html#kadmos.graph.graph_data.DataGraph.merge_functions">merge_functions() (kadmos.graph.graph_data.DataGraph method)</a> - - <ul> - <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.merge_functions">(kadmos.graph.graph_kadmos.KadmosGraph method)</a> + <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.merge_functions">merge_functions() (kadmos.graph.graph_kadmos.KadmosGraph method)</a> </li> - </ul></li> - <li><a href="KADMOS.html#kadmos.graph.graph_data.DataGraph.merge_parallel_functions">merge_parallel_functions() (kadmos.graph.graph_data.DataGraph method)</a> - - <ul> - <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.merge_parallel_functions">(kadmos.graph.graph_kadmos.KadmosGraph method)</a> + <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.merge_parallel_functions">merge_parallel_functions() (kadmos.graph.graph_kadmos.KadmosGraph method)</a> </li> - </ul></li> - <li><a href="KADMOS.html#kadmos.graph.graph_data.DataGraph.merge_sequential_functions">merge_sequential_functions() (kadmos.graph.graph_data.DataGraph method)</a> - - <ul> - <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.merge_sequential_functions">(kadmos.graph.graph_kadmos.KadmosGraph method)</a> + <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.merge_sequential_functions">merge_sequential_functions() (kadmos.graph.graph_kadmos.KadmosGraph method)</a> </li> - </ul></li> <li><a href="KADMOS.html#kadmos.graph.graph_data.DataGraph.minimize_feedback">minimize_feedback() (kadmos.graph.graph_data.DataGraph method)</a> </li> </ul></td> @@ -889,86 +531,18 @@ <h2 id="N">N</h2> <table style="width: 100%" class="indextable genindextable"><tr> <td style="width: 33%; vertical-align: top;"><ul> - <li><a href="KADMOS.html#kadmos.graph.graph_data.DataGraph.name">name (kadmos.graph.graph_data.DataGraph attribute)</a> - - <ul> - <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.name">(kadmos.graph.graph_kadmos.KadmosGraph attribute)</a> + <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.node_is_function">node_is_function() (kadmos.graph.graph_kadmos.KadmosGraph method)</a> </li> - </ul></li> - <li><a href="KADMOS.html#kadmos.graph.graph_data.DataGraph.nbunch_iter">nbunch_iter() (kadmos.graph.graph_data.DataGraph method)</a> - - <ul> - <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.nbunch_iter">(kadmos.graph.graph_kadmos.KadmosGraph method)</a> + <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.node_is_hole">node_is_hole() (kadmos.graph.graph_kadmos.KadmosGraph method)</a> </li> - </ul></li> - <li><a href="KADMOS.html#kadmos.graph.graph_data.DataGraph.neighbors">neighbors() (kadmos.graph.graph_data.DataGraph method)</a> - - <ul> - <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.neighbors">(kadmos.graph.graph_kadmos.KadmosGraph method)</a> -</li> - </ul></li> - <li><a href="KADMOS.html#kadmos.graph.graph_data.DataGraph.node">node (kadmos.graph.graph_data.DataGraph attribute)</a> - - <ul> - <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.node">(kadmos.graph.graph_kadmos.KadmosGraph attribute)</a> -</li> - </ul></li> - <li><a href="KADMOS.html#kadmos.graph.graph_data.DataGraph.node_dict_factory">node_dict_factory (kadmos.graph.graph_data.DataGraph attribute)</a> - - <ul> - <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.node_dict_factory">(kadmos.graph.graph_kadmos.KadmosGraph attribute)</a> -</li> - </ul></li> - <li><a href="KADMOS.html#kadmos.graph.graph_data.DataGraph.node_is_function">node_is_function() (kadmos.graph.graph_data.DataGraph method)</a> - - <ul> - <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.node_is_function">(kadmos.graph.graph_kadmos.KadmosGraph method)</a> -</li> - </ul></li> - <li><a href="KADMOS.html#kadmos.graph.graph_data.DataGraph.node_is_hole">node_is_hole() (kadmos.graph.graph_data.DataGraph method)</a> - - <ul> - <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.node_is_hole">(kadmos.graph.graph_kadmos.KadmosGraph method)</a> -</li> - </ul></li> </ul></td> <td style="width: 33%; vertical-align: top;"><ul> - <li><a href="KADMOS.html#kadmos.graph.graph_data.DataGraph.node_is_objective_function">node_is_objective_function() (kadmos.graph.graph_data.DataGraph method)</a> - - <ul> - <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.node_is_objective_function">(kadmos.graph.graph_kadmos.KadmosGraph method)</a> -</li> - </ul></li> - <li><a href="KADMOS.html#kadmos.graph.graph_data.DataGraph.node_is_output">node_is_output() (kadmos.graph.graph_data.DataGraph method)</a> - - <ul> - <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.node_is_output">(kadmos.graph.graph_kadmos.KadmosGraph method)</a> -</li> - </ul></li> - <li><a href="KADMOS.html#kadmos.graph.graph_data.DataGraph.node_is_variable">node_is_variable() (kadmos.graph.graph_data.DataGraph method)</a> - - <ul> - <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.node_is_variable">(kadmos.graph.graph_kadmos.KadmosGraph method)</a> + <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.node_is_objective_function">node_is_objective_function() (kadmos.graph.graph_kadmos.KadmosGraph method)</a> </li> - </ul></li> - <li><a href="KADMOS.html#kadmos.graph.graph_data.DataGraph.nodes">nodes (kadmos.graph.graph_data.DataGraph attribute)</a> - - <ul> - <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.nodes">(kadmos.graph.graph_kadmos.KadmosGraph attribute)</a> + <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.node_is_output">node_is_output() (kadmos.graph.graph_kadmos.KadmosGraph method)</a> </li> - </ul></li> - <li><a href="KADMOS.html#kadmos.graph.graph_data.DataGraph.number_of_edges">number_of_edges() (kadmos.graph.graph_data.DataGraph method)</a> - - <ul> - <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.number_of_edges">(kadmos.graph.graph_kadmos.KadmosGraph method)</a> + <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.node_is_variable">node_is_variable() (kadmos.graph.graph_kadmos.KadmosGraph method)</a> </li> - </ul></li> - <li><a href="KADMOS.html#kadmos.graph.graph_data.DataGraph.number_of_nodes">number_of_nodes() (kadmos.graph.graph_data.DataGraph method)</a> - - <ul> - <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.number_of_nodes">(kadmos.graph.graph_kadmos.KadmosGraph method)</a> -</li> - </ul></li> </ul></td> </tr></table> @@ -977,71 +551,27 @@ <td style="width: 33%; vertical-align: top;"><ul> <li><a href="KADMOS.html#kadmos.utilities.general.open_file">open_file() (in module kadmos.utilities.general)</a> </li> - <li><a href="KADMOS.html#kadmos.graph.graph_data.DataGraph.order">order() (kadmos.graph.graph_data.DataGraph method)</a> - - <ul> - <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.order">(kadmos.graph.graph_kadmos.KadmosGraph method)</a> -</li> - </ul></li> - </ul></td> - <td style="width: 33%; vertical-align: top;"><ul> - <li><a href="KADMOS.html#kadmos.graph.graph_data.DataGraph.out_degree">out_degree (kadmos.graph.graph_data.DataGraph attribute)</a> - - <ul> - <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.out_degree">(kadmos.graph.graph_kadmos.KadmosGraph attribute)</a> -</li> - </ul></li> - <li><a href="KADMOS.html#kadmos.graph.graph_data.DataGraph.out_edges">out_edges (kadmos.graph.graph_data.DataGraph attribute)</a> - - <ul> - <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.out_edges">(kadmos.graph.graph_kadmos.KadmosGraph attribute)</a> -</li> - </ul></li> </ul></td> </tr></table> <h2 id="P">P</h2> <table style="width: 100%" class="indextable genindextable"><tr> <td style="width: 33%; vertical-align: top;"><ul> - <li><a href="KADMOS.html#kadmos.graph.graph_data.DataGraph.plot_adjacency_matrix">plot_adjacency_matrix() (kadmos.graph.graph_data.DataGraph method)</a> - - <ul> - <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.plot_adjacency_matrix">(kadmos.graph.graph_kadmos.KadmosGraph method)</a> -</li> - </ul></li> - <li><a href="KADMOS.html#kadmos.graph.graph_data.DataGraph.plot_graph">plot_graph() (kadmos.graph.graph_data.DataGraph method)</a> - - <ul> - <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.plot_graph">(kadmos.graph.graph_kadmos.KadmosGraph method)</a> + <li><a href="KADMOS.html#kadmos.graph.graph_data.FundamentalProblemGraph.partition_graph">partition_graph() (kadmos.graph.graph_data.FundamentalProblemGraph method)</a> </li> - </ul></li> - <li><a href="KADMOS.html#kadmos.graph.graph_data.DataGraph.pred">pred (kadmos.graph.graph_data.DataGraph attribute)</a> - - <ul> - <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.pred">(kadmos.graph.graph_kadmos.KadmosGraph attribute)</a> + <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.plot_adjacency_matrix">plot_adjacency_matrix() (kadmos.graph.graph_kadmos.KadmosGraph method)</a> </li> - </ul></li> - <li><a href="KADMOS.html#kadmos.graph.graph_data.DataGraph.predecessors">predecessors() (kadmos.graph.graph_data.DataGraph method)</a> - - <ul> - <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.predecessors">(kadmos.graph.graph_kadmos.KadmosGraph method)</a> + <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.plot_graph">plot_graph() (kadmos.graph.graph_kadmos.KadmosGraph method)</a> </li> - </ul></li> </ul></td> <td style="width: 33%; vertical-align: top;"><ul> <li><a href="KADMOS.html#kadmos.knowledgebase.knowledgebase.KnowledgeBase.print_circular_connections_in_log">print_circular_connections_in_log() (kadmos.knowledgebase.knowledgebase.KnowledgeBase method)</a> </li> - <li><a href="KADMOS.html#kadmos.graph.graph_data.DataGraph.print_graph">print_graph() (kadmos.graph.graph_data.DataGraph method)</a> - - <ul> - <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.print_graph">(kadmos.graph.graph_kadmos.KadmosGraph method)</a> + <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.print_graph">print_graph() (kadmos.graph.graph_kadmos.KadmosGraph method)</a> </li> - </ul></li> <li><a href="KADMOS.html#kadmos.utilities.printing.print_in_table">print_in_table() (in module kadmos.utilities.printing)</a> </li> <li><a href="KADMOS.html#kadmos.utilities.printing.print_indexed_list">print_indexed_list() (in module kadmos.utilities.printing)</a> -</li> - <li><a href="KADMOS.html#kadmos.graph.graph_process.ProcessGraph">ProcessGraph (class in kadmos.graph.graph_process)</a> </li> </ul></td> </tr></table> @@ -1055,12 +585,8 @@ </li> <li><a href="KADMOS.html#kadmos.utilities.xml.recursively_unique_attribute">recursively_unique_attribute() (in module kadmos.utilities.xml)</a> </li> - <li><a href="KADMOS.html#kadmos.graph.graph_data.DataGraph.relabel_function_nodes">relabel_function_nodes() (kadmos.graph.graph_data.DataGraph method)</a> - - <ul> - <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.relabel_function_nodes">(kadmos.graph.graph_kadmos.KadmosGraph method)</a> + <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.relabel_function_nodes">relabel_function_nodes() (kadmos.graph.graph_kadmos.KadmosGraph method)</a> </li> - </ul></li> <li><a href="KADMOS.html#kadmos.cmdows.cmdows.CMDOWS.remove_children_of_uid">remove_children_of_uid() (kadmos.cmdows.cmdows.CMDOWS method)</a> </li> <li><a href="KADMOS.html#kadmos.cmdows.cmdows.CMDOWS.remove_children_of_xpath">remove_children_of_xpath() (kadmos.cmdows.cmdows.CMDOWS method)</a> @@ -1069,28 +595,12 @@ </li> <li><a href="KADMOS.html#kadmos.cmdows.cmdows.CMDOWS.remove_data_graph_element">remove_data_graph_element() (kadmos.cmdows.cmdows.CMDOWS method)</a> </li> - <li><a href="KADMOS.html#kadmos.graph.graph_data.DataGraph.remove_edge">remove_edge() (kadmos.graph.graph_data.DataGraph method)</a> - - <ul> - <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.remove_edge">(kadmos.graph.graph_kadmos.KadmosGraph method)</a> -</li> - </ul></li> - <li><a href="KADMOS.html#kadmos.graph.graph_data.DataGraph.remove_edges_from">remove_edges_from() (kadmos.graph.graph_data.DataGraph method)</a> - - <ul> - <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.remove_edges_from">(kadmos.graph.graph_kadmos.KadmosGraph method)</a> -</li> - </ul></li> <li><a href="KADMOS.html#kadmos.cmdows.cmdows.CMDOWS.remove_element_based_on_uid">remove_element_based_on_uid() (kadmos.cmdows.cmdows.CMDOWS method)</a> </li> <li><a href="KADMOS.html#kadmos.cmdows.cmdows.CMDOWS.remove_element_based_on_xpath">remove_element_based_on_xpath() (kadmos.cmdows.cmdows.CMDOWS method)</a> </li> - <li><a href="KADMOS.html#kadmos.graph.graph_data.DataGraph.remove_function_nodes">remove_function_nodes() (kadmos.graph.graph_data.DataGraph method)</a> - - <ul> - <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.remove_function_nodes">(kadmos.graph.graph_kadmos.KadmosGraph method)</a> + <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.remove_function_nodes">remove_function_nodes() (kadmos.graph.graph_kadmos.KadmosGraph method)</a> </li> - </ul></li> <li><a href="KADMOS.html#kadmos.utilities.general.remove_if_exists">remove_if_exists() (in module kadmos.utilities.general)</a> </li> </ul></td> @@ -1099,20 +609,8 @@ </li> <li><a href="KADMOS.html#kadmos.cmdows.cmdows.CMDOWS.remove_inputs">remove_inputs() (kadmos.cmdows.cmdows.CMDOWS method)</a> </li> - <li><a href="KADMOS.html#kadmos.graph.graph_data.DataGraph.remove_node">remove_node() (kadmos.graph.graph_data.DataGraph method)</a> - - <ul> - <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.remove_node">(kadmos.graph.graph_kadmos.KadmosGraph method)</a> -</li> - </ul></li> <li><a href="KADMOS.html#kadmos.graph.mixin_mdao.MdaoMixin.remove_node_from_diagonal">remove_node_from_diagonal() (kadmos.graph.mixin_mdao.MdaoMixin method)</a> </li> - <li><a href="KADMOS.html#kadmos.graph.graph_data.DataGraph.remove_nodes_from">remove_nodes_from() (kadmos.graph.graph_data.DataGraph method)</a> - - <ul> - <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.remove_nodes_from">(kadmos.graph.graph_kadmos.KadmosGraph method)</a> -</li> - </ul></li> <li><a href="KADMOS.html#kadmos.cmdows.cmdows.CMDOWS.remove_outputs">remove_outputs() (kadmos.cmdows.cmdows.CMDOWS method)</a> </li> <li><a href="KADMOS.html#kadmos.cmdows.cmdows.CMDOWS.remove_parameter">remove_parameter() (kadmos.cmdows.cmdows.CMDOWS method)</a> @@ -1133,12 +631,6 @@ </li> <li><a href="KADMOS.html#kadmos.cmdows.cmdows.CMDOWS.resolve_uids">resolve_uids() (kadmos.cmdows.cmdows.CMDOWS method)</a> </li> - <li><a href="KADMOS.html#kadmos.graph.graph_data.DataGraph.reverse">reverse() (kadmos.graph.graph_data.DataGraph method)</a> - - <ul> - <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.reverse">(kadmos.graph.graph_kadmos.KadmosGraph method)</a> -</li> - </ul></li> </ul></td> </tr></table> @@ -1148,59 +640,29 @@ <li><a href="KADMOS.html#kadmos.cmdows.cmdows.CMDOWS.save">save() (kadmos.cmdows.cmdows.CMDOWS method)</a> <ul> - <li><a href="KADMOS.html#kadmos.graph.graph_data.DataGraph.save">(kadmos.graph.graph_data.DataGraph method)</a> -</li> <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.save">(kadmos.graph.graph_kadmos.KadmosGraph method)</a> </li> </ul></li> <li><a href="KADMOS.html#kadmos.cmdows.cmdows.CMDOWS.schema">schema() (kadmos.cmdows.cmdows.CMDOWS method)</a> </li> - <li><a href="KADMOS.html#kadmos.graph.graph_data.RepositoryConnectivityGraph.select_function_combination_from">select_function_combination_from() (kadmos.graph.graph_data.RepositoryConnectivityGraph method)</a> -</li> - <li><a href="KADMOS.html#kadmos.graph.graph_data.DataGraph.select_objectives_from_graph">select_objectives_from_graph() (kadmos.graph.graph_data.DataGraph method)</a> - - <ul> - <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.select_objectives_from_graph">(kadmos.graph.graph_kadmos.KadmosGraph method)</a> + <li><a href="KADMOS.html#kadmos.graph.graph_data.FundamentalProblemGraph.select_distributed_architecture">select_distributed_architecture() (kadmos.graph.graph_data.FundamentalProblemGraph method)</a> </li> - </ul></li> - <li><a href="KADMOS.html#kadmos.cmdows.cmdows.CMDOWS.simplify">simplify() (kadmos.cmdows.cmdows.CMDOWS method)</a> -</li> - <li><a href="KADMOS.html#kadmos.cmdows.cmdows.CMDOWS.simplify_equations">simplify_equations() (kadmos.cmdows.cmdows.CMDOWS method)</a> -</li> - <li><a href="KADMOS.html#kadmos.graph.graph_data.DataGraph.size">size() (kadmos.graph.graph_data.DataGraph method)</a> - - <ul> - <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.size">(kadmos.graph.graph_kadmos.KadmosGraph method)</a> + <li><a href="KADMOS.html#kadmos.graph.graph_data.RepositoryConnectivityGraph.select_function_combination_from">select_function_combination_from() (kadmos.graph.graph_data.RepositoryConnectivityGraph method)</a> </li> - </ul></li> </ul></td> <td style="width: 33%; vertical-align: top;"><ul> - <li><a href="KADMOS.html#kadmos.graph.graph_data.DataGraph.sort_non_coupled_nodes">sort_non_coupled_nodes() (kadmos.graph.graph_data.DataGraph method)</a> + <li><a href="KADMOS.html#kadmos.graph.graph_data.FundamentalProblemGraph.select_number_of_partitions">select_number_of_partitions() (kadmos.graph.graph_data.FundamentalProblemGraph method)</a> </li> - <li><a href="KADMOS.html#kadmos.graph.graph_data.DataGraph.split_variables">split_variables() (kadmos.graph.graph_data.DataGraph method)</a> - - <ul> - <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.split_variables">(kadmos.graph.graph_kadmos.KadmosGraph method)</a> + <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.select_objectives_from_graph">select_objectives_from_graph() (kadmos.graph.graph_kadmos.KadmosGraph method)</a> </li> - </ul></li> - <li><a href="KADMOS.html#kadmos.graph.graph_data.DataGraph.subgraph">subgraph() (kadmos.graph.graph_data.DataGraph method)</a> - - <ul> - <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.subgraph">(kadmos.graph.graph_kadmos.KadmosGraph method)</a> + <li><a href="KADMOS.html#kadmos.cmdows.cmdows.CMDOWS.simplify">simplify() (kadmos.cmdows.cmdows.CMDOWS method)</a> </li> - </ul></li> - <li><a href="KADMOS.html#kadmos.graph.graph_data.DataGraph.succ">succ (kadmos.graph.graph_data.DataGraph attribute)</a> - - <ul> - <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.succ">(kadmos.graph.graph_kadmos.KadmosGraph attribute)</a> + <li><a href="KADMOS.html#kadmos.cmdows.cmdows.CMDOWS.simplify_equations">simplify_equations() (kadmos.cmdows.cmdows.CMDOWS method)</a> </li> - </ul></li> - <li><a href="KADMOS.html#kadmos.graph.graph_data.DataGraph.successors">successors() (kadmos.graph.graph_data.DataGraph method)</a> - - <ul> - <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.successors">(kadmos.graph.graph_kadmos.KadmosGraph method)</a> + <li><a href="KADMOS.html#kadmos.graph.graph_data.DataGraph.sort_nodes_for_process">sort_nodes_for_process() (kadmos.graph.graph_data.DataGraph method)</a> +</li> + <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.split_variables">split_variables() (kadmos.graph.graph_kadmos.KadmosGraph method)</a> </li> - </ul></li> </ul></td> </tr></table> @@ -1209,22 +671,10 @@ <td style="width: 33%; vertical-align: top;"><ul> <li><a href="KADMOS.html#kadmos.utilities.general.test_attr_cond">test_attr_cond() (in module kadmos.utilities.general)</a> </li> - <li><a href="KADMOS.html#kadmos.graph.graph_data.DataGraph.to_directed">to_directed() (kadmos.graph.graph_data.DataGraph method)</a> - - <ul> - <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.to_directed">(kadmos.graph.graph_kadmos.KadmosGraph method)</a> -</li> - </ul></li> - <li><a href="KADMOS.html#kadmos.graph.graph_data.DataGraph.to_undirected">to_undirected() (kadmos.graph.graph_data.DataGraph method)</a> - - <ul> - <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.to_undirected">(kadmos.graph.graph_kadmos.KadmosGraph method)</a> + <li><a href="KADMOS.html#kadmos.utilities.general.transform_data_into_strings">transform_data_into_strings() (in module kadmos.utilities.general)</a> </li> - </ul></li> </ul></td> <td style="width: 33%; vertical-align: top;"><ul> - <li><a href="KADMOS.html#kadmos.utilities.general.transform_data_into_strings">transform_data_into_strings() (in module kadmos.utilities.general)</a> -</li> <li><a href="KADMOS.html#kadmos.utilities.general.transform_string_into_format">transform_string_into_format() (in module kadmos.utilities.general)</a> </li> <li><a href="KADMOS.html#kadmos.utilities.general.translate_dict_keys">translate_dict_keys() (in module kadmos.utilities.general)</a> @@ -1251,24 +701,12 @@ <td style="width: 33%; vertical-align: top;"><ul> <li><a href="KADMOS.html#kadmos.cmdows.cmdows.CMDOWS.version">version() (kadmos.cmdows.cmdows.CMDOWS method)</a> </li> - <li><a href="KADMOS.html#kadmos.graph.graph_data.DataGraph.vistoms_add">vistoms_add() (kadmos.graph.graph_data.DataGraph method)</a> - - <ul> - <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.vistoms_add">(kadmos.graph.graph_kadmos.KadmosGraph method)</a> -</li> - <li><a href="KADMOS.html#kadmos.graph.mixin_vistoms.VistomsMixin.vistoms_add">(kadmos.graph.mixin_vistoms.VistomsMixin method)</a> + <li><a href="KADMOS.html#kadmos.graph.mixin_vistoms.VistomsMixin.vistoms_add">vistoms_add() (kadmos.graph.mixin_vistoms.VistomsMixin method)</a> </li> - </ul></li> </ul></td> <td style="width: 33%; vertical-align: top;"><ul> - <li><a href="KADMOS.html#kadmos.graph.graph_data.DataGraph.vistoms_create">vistoms_create() (kadmos.graph.graph_data.DataGraph method)</a> - - <ul> - <li><a href="KADMOS.html#kadmos.graph.graph_kadmos.KadmosGraph.vistoms_create">(kadmos.graph.graph_kadmos.KadmosGraph method)</a> -</li> - <li><a href="KADMOS.html#kadmos.graph.mixin_vistoms.VistomsMixin.vistoms_create">(kadmos.graph.mixin_vistoms.VistomsMixin method)</a> + <li><a href="KADMOS.html#kadmos.graph.mixin_vistoms.VistomsMixin.vistoms_create">vistoms_create() (kadmos.graph.mixin_vistoms.VistomsMixin method)</a> </li> - </ul></li> <li><a href="KADMOS.html#kadmos.graph.mixin_vistoms.VistomsMixin">VistomsMixin (class in kadmos.graph.mixin_vistoms)</a> </li> </ul></td> diff --git a/doc/objects.inv b/doc/objects.inv index 97a15969fe67392da5dc7cb310578a0741a766a2..dc3bd8df38ca36123cc3e6dc8e54fc401aba4bbc 100644 Binary files a/doc/objects.inv and b/doc/objects.inv differ diff --git a/doc/searchindex.js b/doc/searchindex.js index 021b5a5a3303b2a751307cfaf0bfadf48511e02d..b4fdfc03f9a77bb2b82ab8a9d2a6f84447d23b71 100644 --- a/doc/searchindex.js +++ b/doc/searchindex.js @@ -1 +1 @@ -Search.setIndex({docnames:["KADMOS"],envversion:52,filenames:["KADMOS.rst"],objects:{"":{kadmos:[0,0,0,"-"]},"kadmos.cmdows.cmdows":{CMDOWS:[0,1,1,""]},"kadmos.cmdows.cmdows.CMDOWS":{add_actor:[0,2,1,""],add_contact:[0,2,1,""],add_dc:[0,2,1,""],add_dc_general_info:[0,2,1,""],add_dc_inputs_element:[0,2,1,""],add_dc_outputs_element:[0,2,1,""],add_dc_performance_info:[0,2,1,""],add_dc_remote_component_info:[0,2,1,""],add_dc_verification:[0,2,1,""],add_element_to_element_of_uid:[0,2,1,""],add_header:[0,2,1,""],add_new_parameters_from_element:[0,2,1,""],assert_element_tag:[0,2,1,""],check:[0,2,1,""],check_references:[0,2,1,""],check_schema:[0,2,1,""],check_uids:[0,2,1,""],ensure_abs_xpath:[0,2,1,""],get_design_competences_uids:[0,2,1,""],get_element_of_uid:[0,2,1,""],get_executable_blocks_uids:[0,2,1,""],get_inputs_uids:[0,2,1,""],get_mathematical_functions_uids:[0,2,1,""],get_outputs_uids:[0,2,1,""],get_parameters_uids:[0,2,1,""],get_used_parameter_uids:[0,2,1,""],get_xpath_of_uid:[0,2,1,""],remove_children_of_uid:[0,2,1,""],remove_children_of_xpath:[0,2,1,""],remove_contact:[0,2,1,""],remove_data_graph_element:[0,2,1,""],remove_element_based_on_uid:[0,2,1,""],remove_element_based_on_xpath:[0,2,1,""],remove_in_and_outputs:[0,2,1,""],remove_inputs:[0,2,1,""],remove_outputs:[0,2,1,""],remove_parameter:[0,2,1,""],remove_parameters:[0,2,1,""],remove_parameters_element:[0,2,1,""],remove_process_graph_element:[0,2,1,""],remove_unused_contacts:[0,2,1,""],remove_workflow_element:[0,2,1,""],resolve_uids:[0,2,1,""],save:[0,2,1,""],schema:[0,2,1,""],simplify:[0,2,1,""],simplify_equations:[0,2,1,""],version:[0,2,1,""]},"kadmos.graph.graph_data":{DataGraph:[0,1,1,""],FundamentalProblemGraph:[0,1,1,""],RepositoryConnectivityGraph:[0,1,1,""]},"kadmos.graph.graph_data.DataGraph":{add_contact:[0,2,1,""],add_contact_roles:[0,2,1,""],add_dc_general_info:[0,2,1,""],add_dc_performance_info:[0,2,1,""],add_dc_remote_component_info:[0,2,1,""],add_default_description:[0,2,1,""],add_default_name:[0,2,1,""],add_edge:[0,2,1,""],add_edges_from:[0,2,1,""],add_equation:[0,2,1,""],add_equation_label:[0,2,1,""],add_equation_labels:[0,2,1,""],add_instance:[0,2,1,""],add_mathematical_function:[0,2,1,""],add_node:[0,2,1,""],add_nodes_from:[0,2,1,""],add_objective_function_by_nodes:[0,2,1,""],add_weighted_edges_from:[0,2,1,""],adj:[0,3,1,""],adjacency:[0,2,1,""],adjlist_inner_dict_factory:[0,3,1,""],adjlist_outer_dict_factory:[0,3,1,""],change_graph_class:[0,2,1,""],check:[0,2,1,""],check_cmdows_integrity:[0,2,1,""],check_for_coupling:[0,2,1,""],clear:[0,2,1,""],copy:[0,2,1,""],copy_as:[0,2,1,""],copy_edge:[0,2,1,""],copy_node_with_suffix:[0,2,1,""],count_function_nodes:[0,2,1,""],create_dsm:[0,2,1,""],deepcopy:[0,2,1,""],deepcopy_as:[0,2,1,""],degree:[0,3,1,""],disconnect_problematic_variables_from:[0,2,1,""],edge_attr_dict_factory:[0,3,1,""],edge_subgraph:[0,2,1,""],edges:[0,3,1,""],find_all_nodes:[0,2,1,""],fresh_copy:[0,2,1,""],get_adjacency_matrix:[0,2,1,""],get_architecture_node_ids:[0,2,1,""],get_architecture_node_labels:[0,2,1,""],get_categorized_nodes:[0,2,1,""],get_contracted_graph:[0,2,1,""],get_coupling_matrix:[0,2,1,""],get_direct_coupling_nodes:[0,2,1,""],get_edge_data:[0,2,1,""],get_feedback_info:[0,2,1,""],get_first_node_instance:[0,2,1,""],get_function_graph:[0,2,1,""],get_function_metadata:[0,2,1,""],get_function_nodes:[0,2,1,""],get_graph_properties:[0,2,1,""],get_node_attributes:[0,2,1,""],get_node_subcategory:[0,2,1,""],get_nodes_based_on_strings:[0,2,1,""],get_nodes_indegree:[0,2,1,""],get_nodes_outdegree:[0,2,1,""],get_nodes_subcategory:[0,2,1,""],get_number_of_couplings:[0,2,1,""],get_possible_function_order:[0,2,1,""],get_same_graph_class:[0,2,1,""],get_sources:[0,2,1,""],get_subgraph_by_function_nodes:[0,2,1,""],get_system_inputs:[0,2,1,""],get_targets:[0,2,1,""],graph_has_nested_attributes:[0,2,1,""],has_edge:[0,2,1,""],has_node:[0,2,1,""],has_nodes:[0,2,1,""],has_predecessor:[0,2,1,""],has_successor:[0,2,1,""],in_degree:[0,3,1,""],in_edges:[0,3,1,""],inspect:[0,2,1,""],inspect_node:[0,2,1,""],inspect_nodes:[0,2,1,""],is_directed:[0,2,1,""],is_multigraph:[0,2,1,""],load_cmdows:[0,2,1,""],make_all_variables_valid:[0,2,1,""],mark_as_constraint:[0,2,1,""],mark_as_constraints:[0,2,1,""],mark_as_design_variable:[0,2,1,""],mark_as_design_variables:[0,2,1,""],mark_as_objective:[0,2,1,""],mark_as_qois:[0,2,1,""],merge_function_modes:[0,2,1,""],merge_function_nodes_based_on_modes:[0,2,1,""],merge_functions:[0,2,1,""],merge_parallel_functions:[0,2,1,""],merge_sequential_functions:[0,2,1,""],minimize_feedback:[0,2,1,""],name:[0,3,1,""],nbunch_iter:[0,2,1,""],neighbors:[0,2,1,""],node:[0,3,1,""],node_dict_factory:[0,3,1,""],node_is_function:[0,2,1,""],node_is_hole:[0,2,1,""],node_is_objective_function:[0,2,1,""],node_is_output:[0,2,1,""],node_is_variable:[0,2,1,""],nodes:[0,3,1,""],number_of_edges:[0,2,1,""],number_of_nodes:[0,2,1,""],order:[0,2,1,""],out_degree:[0,3,1,""],out_edges:[0,3,1,""],plot_adjacency_matrix:[0,2,1,""],plot_graph:[0,2,1,""],pred:[0,3,1,""],predecessors:[0,2,1,""],print_graph:[0,2,1,""],relabel_function_nodes:[0,2,1,""],remove_edge:[0,2,1,""],remove_edges_from:[0,2,1,""],remove_function_nodes:[0,2,1,""],remove_node:[0,2,1,""],remove_nodes_from:[0,2,1,""],remove_unused_outputs:[0,2,1,""],reverse:[0,2,1,""],save:[0,2,1,""],select_objectives_from_graph:[0,2,1,""],size:[0,2,1,""],sort_non_coupled_nodes:[0,2,1,""],split_variables:[0,2,1,""],subgraph:[0,2,1,""],succ:[0,3,1,""],successors:[0,2,1,""],to_directed:[0,2,1,""],to_undirected:[0,2,1,""],unmark_variable:[0,2,1,""],vistoms_add:[0,2,1,""],vistoms_create:[0,2,1,""]},"kadmos.graph.graph_data.FundamentalProblemGraph":{add_function_problem_roles:[0,2,1,""],create_mdg:[0,2,1,""],create_mpg:[0,2,1,""],get_mdg:[0,2,1,""],get_mg_function_ordering:[0,2,1,""],get_mpg:[0,2,1,""],impose_mdao_architecture:[0,2,1,""]},"kadmos.graph.graph_data.RepositoryConnectivityGraph":{create_mathematical_problem:[0,2,1,""],get_fpg_based_on_function_nodes:[0,2,1,""],get_fpg_based_on_list_functions:[0,2,1,""],get_fpg_based_on_sinks:[0,2,1,""],get_fpg_by_function_nodes:[0,2,1,""],get_function_paths_by_objective:[0,2,1,""],get_path_combinations:[0,2,1,""],select_function_combination_from:[0,2,1,""]},"kadmos.graph.graph_kadmos":{KadmosGraph:[0,1,1,""]},"kadmos.graph.graph_kadmos.KadmosGraph":{add_contact:[0,2,1,""],add_contact_roles:[0,2,1,""],add_dc_general_info:[0,2,1,""],add_dc_performance_info:[0,2,1,""],add_dc_remote_component_info:[0,2,1,""],add_default_description:[0,2,1,""],add_default_name:[0,2,1,""],add_edge:[0,2,1,""],add_edges_from:[0,2,1,""],add_equation:[0,2,1,""],add_equation_label:[0,2,1,""],add_equation_labels:[0,2,1,""],add_instance:[0,2,1,""],add_mathematical_function:[0,2,1,""],add_node:[0,2,1,""],add_nodes_from:[0,2,1,""],add_objective_function_by_nodes:[0,2,1,""],add_weighted_edges_from:[0,2,1,""],adj:[0,3,1,""],adjacency:[0,2,1,""],adjlist_inner_dict_factory:[0,3,1,""],adjlist_outer_dict_factory:[0,3,1,""],change_graph_class:[0,2,1,""],check:[0,2,1,""],check_cmdows_integrity:[0,2,1,""],check_for_coupling:[0,2,1,""],clear:[0,2,1,""],copy:[0,2,1,""],copy_as:[0,2,1,""],copy_edge:[0,2,1,""],copy_node_with_suffix:[0,2,1,""],count_function_nodes:[0,2,1,""],create_dsm:[0,2,1,""],deepcopy:[0,2,1,""],deepcopy_as:[0,2,1,""],degree:[0,3,1,""],disconnect_problematic_variables_from:[0,2,1,""],edge_attr_dict_factory:[0,3,1,""],edge_subgraph:[0,2,1,""],edges:[0,3,1,""],find_all_nodes:[0,2,1,""],fresh_copy:[0,2,1,""],get_adjacency_matrix:[0,2,1,""],get_architecture_node_ids:[0,2,1,""],get_architecture_node_labels:[0,2,1,""],get_categorized_nodes:[0,2,1,""],get_contracted_graph:[0,2,1,""],get_direct_coupling_nodes:[0,2,1,""],get_edge_data:[0,2,1,""],get_first_node_instance:[0,2,1,""],get_function_graph:[0,2,1,""],get_function_metadata:[0,2,1,""],get_function_nodes:[0,2,1,""],get_graph_properties:[0,2,1,""],get_node_attributes:[0,2,1,""],get_node_subcategory:[0,2,1,""],get_nodes_based_on_strings:[0,2,1,""],get_nodes_indegree:[0,2,1,""],get_nodes_outdegree:[0,2,1,""],get_nodes_subcategory:[0,2,1,""],get_number_of_couplings:[0,2,1,""],get_same_graph_class:[0,2,1,""],get_sources:[0,2,1,""],get_subgraph_by_function_nodes:[0,2,1,""],get_system_inputs:[0,2,1,""],get_targets:[0,2,1,""],graph_has_nested_attributes:[0,2,1,""],has_edge:[0,2,1,""],has_node:[0,2,1,""],has_nodes:[0,2,1,""],has_predecessor:[0,2,1,""],has_successor:[0,2,1,""],in_degree:[0,3,1,""],in_edges:[0,3,1,""],inspect:[0,2,1,""],inspect_node:[0,2,1,""],inspect_nodes:[0,2,1,""],is_directed:[0,2,1,""],is_multigraph:[0,2,1,""],load_cmdows:[0,2,1,""],make_all_variables_valid:[0,2,1,""],merge_function_modes:[0,2,1,""],merge_function_nodes_based_on_modes:[0,2,1,""],merge_functions:[0,2,1,""],merge_parallel_functions:[0,2,1,""],merge_sequential_functions:[0,2,1,""],name:[0,3,1,""],nbunch_iter:[0,2,1,""],neighbors:[0,2,1,""],node:[0,3,1,""],node_dict_factory:[0,3,1,""],node_is_function:[0,2,1,""],node_is_hole:[0,2,1,""],node_is_objective_function:[0,2,1,""],node_is_output:[0,2,1,""],node_is_variable:[0,2,1,""],nodes:[0,3,1,""],number_of_edges:[0,2,1,""],number_of_nodes:[0,2,1,""],order:[0,2,1,""],out_degree:[0,3,1,""],out_edges:[0,3,1,""],plot_adjacency_matrix:[0,2,1,""],plot_graph:[0,2,1,""],pred:[0,3,1,""],predecessors:[0,2,1,""],print_graph:[0,2,1,""],relabel_function_nodes:[0,2,1,""],remove_edge:[0,2,1,""],remove_edges_from:[0,2,1,""],remove_function_nodes:[0,2,1,""],remove_node:[0,2,1,""],remove_nodes_from:[0,2,1,""],reverse:[0,2,1,""],save:[0,2,1,""],select_objectives_from_graph:[0,2,1,""],size:[0,2,1,""],split_variables:[0,2,1,""],subgraph:[0,2,1,""],succ:[0,3,1,""],successors:[0,2,1,""],to_directed:[0,2,1,""],to_undirected:[0,2,1,""],vistoms_add:[0,2,1,""],vistoms_create:[0,2,1,""]},"kadmos.graph.graph_process":{MdaoProcessGraph:[0,1,1,""],ProcessGraph:[0,1,1,""]},"kadmos.graph.graph_process.MdaoProcessGraph":{add_process:[0,2,1,""],add_process_partitions:[0,2,1,""],connect_nested_iterators:[0,2,1,""],get_lowest_psn:[0,2,1,""],get_node_text:[0,2,1,""],get_ordered_cycles:[0,2,1,""],get_process_hierarchy:[0,2,1,""],get_process_list:[0,2,1,""],inspect_process:[0,2,1,""]},"kadmos.graph.mixin_equation":{EquationMixin:[0,1,1,""]},"kadmos.graph.mixin_equation.EquationMixin":{add_equation:[0,2,1,""],add_equation_label:[0,2,1,""],add_equation_labels:[0,2,1,""],add_mathematical_function:[0,2,1,""]},"kadmos.graph.mixin_mdao":{MdaoMixin:[0,1,1,""]},"kadmos.graph.mixin_mdao.MdaoMixin":{insert_node_on_diagonal:[0,2,1,""],remove_node_from_diagonal:[0,2,1,""]},"kadmos.graph.mixin_vistoms":{VistomsMixin:[0,1,1,""]},"kadmos.graph.mixin_vistoms.VistomsMixin":{vistoms_add:[0,2,1,""],vistoms_create:[0,2,1,""]},"kadmos.knowledgebase.knowledgebase":{KnowledgeBase:[0,1,1,""]},"kadmos.knowledgebase.knowledgebase.KnowledgeBase":{get_function_dependencies:[0,2,1,""],get_function_graph:[0,2,1,""],get_kb_graphs:[0,2,1,""],get_rcg:[0,2,1,""],print_circular_connections_in_log:[0,2,1,""]},"kadmos.utilities":{general:[0,0,0,"-"],printing:[0,0,0,"-"],strings:[0,0,0,"-"],xml:[0,0,0,"-"]},"kadmos.utilities.general":{assert_dict_keys:[0,4,1,""],color_list:[0,4,1,""],convert_bytes:[0,4,1,""],dict_to_ord_dict:[0,4,1,""],export_as_json:[0,4,1,""],file_size:[0,4,1,""],file_size_MB:[0,4,1,""],filter_group_vars:[0,4,1,""],format_string_for_latex:[0,4,1,""],format_string_for_vistoms:[0,4,1,""],get_element_dict:[0,4,1,""],get_friendly_id:[0,4,1,""],get_group_vars:[0,4,1,""],get_list_entries:[0,4,1,""],get_mdao_setup:[0,4,1,""],get_uid:[0,4,1,""],get_unique_friendly_id:[0,4,1,""],hex_to_rgb:[0,4,1,""],make_camel_case:[0,4,1,""],make_plural:[0,4,1,""],make_singular:[0,4,1,""],open_file:[0,4,1,""],remove_if_exists:[0,4,1,""],test_attr_cond:[0,4,1,""],transform_data_into_strings:[0,4,1,""],transform_string_into_format:[0,4,1,""],translate_dict_keys:[0,4,1,""],translate_list:[0,4,1,""],unmake_camel_case:[0,4,1,""]},"kadmos.utilities.printing":{print_in_table:[0,4,1,""],print_indexed_list:[0,4,1,""]},"kadmos.utilities.xml":{ExtendedElement:[0,1,1,""],get_element_details:[0,4,1,""],get_uid_search_xpath:[0,4,1,""],merge:[0,4,1,""],recursively_empty:[0,4,1,""],recursively_stringify:[0,4,1,""],recursively_unique_attribute:[0,4,1,""]},"kadmos.utilities.xml.ExtendedElement":{add:[0,2,1,""],add_process_hierarchy:[0,2,1,""],clean:[0,2,1,""],findasttext:[0,2,1,""],finddict:[0,2,1,""]}},objnames:{"0":["py","module","Python module"],"1":["py","class","Python class"],"2":["py","method","Python method"],"3":["py","attribute","Python attribute"],"4":["py","function","Python function"]},objtypes:{"0":"py:module","1":"py:class","2":"py:method","3":"py:attribute","4":"py:function"},terms:{"13S":0,"1e4":0,"5pm":0,"boolean":0,"byte":0,"case":0,"class":0,"default":0,"export":0,"final":0,"float":0,"function":0,"import":0,"int":0,"long":0,"new":0,"return":0,"super":0,"true":0,"try":0,"while":0,Adding:0,But:0,For:0,IDs:0,Not:0,That:0,The:0,There:0,These:0,Use:0,Useful:0,Will:0,__all__:0,__builtin__:0,__class__:0,__iter__:0,__len__:0,__none__:0,_check_category_a:0,_check_category_b:0,_check_category_c:0,abbreviate_keyword:0,abl:0,abov:0,absolut:0,access:0,accord:0,account:0,act:0,action:0,actual:0,add:0,add_actor:0,add_contact:0,add_contact_rol:0,add_dc:0,add_dc_general_info:0,add_dc_inputs_el:0,add_dc_outputs_el:0,add_dc_performance_info:0,add_dc_remote_component_info:0,add_dc_verif:0,add_default_descript:0,add_default_nam:0,add_edg:0,add_edges_from:0,add_element_to_element_of_uid:0,add_equ:0,add_equation_label:0,add_function_problem_rol:0,add_head:0,add_inst:0,add_mathematical_funct:0,add_new_parameters_from_el:0,add_nod:0,add_nodes_from:0,add_objective_function_by_nod:0,add_path:0,add_process:0,add_process_hierarchi:0,add_process_partit:0,add_weighted_edges_from:0,added:0,addit:0,address:0,adher:0,adj:0,adj_it:0,adjac:0,adjlist_inner_dict_factori:0,adjlist_outer_dict_factori:0,adjust:0,adress:0,advanc:0,aerodynam:0,aerospac:0,affect:0,after:0,agil:0,aircraft:0,algorithm:0,alia:0,all:0,all_keys_requir:0,all_nod:0,allow:0,allow_unconverged_coupl:0,along:0,alreadi:0,als:0,also:0,american:0,amount:0,analys:0,analysi:0,analyt:0,analyz:0,ani:0,anoth:0,appear:0,append:0,appli:0,applic:0,appyl:0,arbitrari:0,architect:0,architectur:0,archiv:0,arg:0,argument:0,around:0,as_view:0,ask:0,assert:0,assert_dict_kei:0,assert_element_tag:0,assess:0,assign:0,associ:0,assum:0,ast:0,attempt:0,attr:0,attr_cond:0,attr_dict:0,attr_exclud:0,attr_includ:0,attr_list:0,attr_valu:0,attrb:0,attrdict:0,attrib:0,attribut:0,automat:0,avail:0,back:0,bar:0,base:0,baselin:0,basestr:0,becaus:0,becom:0,been:0,befor:0,behav:0,behavior:0,being:0,belong:0,below:0,between:0,bliss:0,block:0,blue:0,bool:0,both:0,bound:0,box:0,bracket:0,branch:0,build:0,busi:0,calcul:0,call:0,camel:0,camel_case_convers:0,camelcas:0,can:0,cannot:0,capac:0,care:0,casi:0,categori:0,caus:0,certain:0,chang:0,change_graph_class:0,charact:0,characterist:0,check:0,check_cmdows_integr:0,check_for_coupl:0,check_graph:0,check_list:0,check_refer:0,check_schema:0,check_uid:0,child:0,children:0,children_to_keep:0,children_to_remov:0,choic:0,choos:0,circular:0,circularconnect:0,clariti:0,clean:0,clear:0,close:0,clutter:0,cmdowsvers:0,collaborativeengin:0,collect:0,collid:0,collis:0,color:0,color_list:0,color_set:0,colors_based_on:0,column:0,combin:0,common:0,compani:0,compar:0,comparison:0,compet:0,compil:0,compile_pdf:0,complet:0,complex:0,compon:0,compos:0,compress:0,comput:0,condit:0,config:0,configur:0,confus:0,connect:0,connect_nested_iter:0,conserv:0,consid:0,consider:0,consist:0,consistent_root:0,consol:0,constraint:0,contact:0,contact_uid:0,contain:0,content:0,continu:0,contract:0,contracted_graph:0,contraction_level:0,contrast:0,control:0,conv:0,conveni:0,convent:0,converg:0,convers:0,convert:0,convert_byt:0,coor:0,copi:0,copy_a:0,copy_edg:0,copy_node_with_suffix:0,copy_typ:0,correct:0,correspond:0,could:0,count:0,count_function_nod:0,countri:0,coupl:0,coupling_strength:0,cpac:0,creat:0,create_dsm:0,create_mathematical_problem:0,create_mdg:0,create_mpg:0,creation:0,creation_d:0,creator:0,creator_uid:0,criteria:0,cross:0,current:0,current_group_idx:0,custom:0,cwd:0,cycl:0,d3j:0,data:0,data_dictionari:0,data_exchange_dict:0,datadict:0,date:0,datetim:0,dc_uid:0,ddict:0,decrib:0,deep:0,deepcopi:0,deepcopy_a:0,defin:0,definit:0,deg:0,degre:0,degreeview:0,delet:0,delft:0,depart:0,depend:0,deprec:0,descend:0,describ:0,descript:0,design:0,designcompet:0,desir:0,destin:0,destination_fold:0,detail:0,determin:0,develop:0,dewit:0,diagon:0,diagonal_po:0,diagram:0,dic:0,dict:0,dict_to_ord_dict:0,dictionari:0,differ:0,differenti:0,digraph:0,dimens:0,direct:0,directli:0,directori:0,disciplin:0,disciplinari:0,disconnect:0,disconnect_collided_target:0,disconnect_problematic_variables_from:0,disconnect_shared_sourc:0,disregard:0,distinguis:0,distribut:0,divid:0,doc:0,doctest:0,doe:0,doesn:0,doing:0,done:0,dont:0,download:0,draw:0,dsm:0,dubreuil:0,due:0,duplic:0,dynam:0,each:0,ebunch:0,ebunch_to_add:0,edg:0,edge_attr_dict_factori:0,edge_dict:0,edge_ind:0,edge_label:0,edge_or_nod:0,edge_subgraph:0,edgedataview:0,effect:0,either:0,element:0,element_to_add:0,elementtre:0,email:0,employe:0,empti:0,enabl:0,encod:0,encount:0,end:0,end_in_iterative_nod:0,engin:0,enrich:0,ensur:0,ensure_abs_xpath:0,entir:0,entri:0,entries_to_remov:0,equat:0,equival:0,error:0,especi:0,etc:0,evalu:0,even:0,everi:0,everyth:0,exactli:0,exampl:0,exblock_uid:0,exce:0,except:0,exchang:0,exclud:0,exclus:0,execut:0,executableblock:0,exhaust:0,exist:0,expect:0,expected_amount:0,expected_kei:0,expected_tag:0,expected_tag_new_el:0,expected_tag_uid_el:0,expected_text:0,explicit:0,export_as_json:0,express:0,extend:0,extendedel:0,extens:0,extra:0,extract:0,fail:0,fals:0,feedback:0,fidel:0,fidelity_level:0,fig_num:0,fig_siz:0,figur:0,file:0,file_nam:0,file_path:0,file_ref:0,file_s:0,file_size_mb:0,file_typ:0,filenam:0,filevers:0,filter:0,filter_group_var:0,filter_set:0,find:0,find_all_nod:0,findasttext:0,finddict:0,findtext:0,first:0,folder:0,follow:0,foo:0,foovalu:0,form:0,format:0,format_string_for_latex:0,format_string_for_vistom:0,found:0,four:0,fpg:0,french:0,fresh:0,fresh_copi:0,from:0,front:0,full:0,funcnam:0,function_nod:0,function_ord:0,function_order_method:0,function_typ:0,functiongraph:0,fundament:0,further:0,futur:0,gauss:0,get:0,get_adjacency_matrix:0,get_architecture_node_id:0,get_architecture_node_label:0,get_categorized_nod:0,get_contracted_graph:0,get_coupling_matrix:0,get_design_competences_uid:0,get_direct_coupling_nod:0,get_edge_data:0,get_element_detail:0,get_element_dict:0,get_element_of_uid:0,get_executable_blocks_uid:0,get_feedback_info:0,get_first_node_inst:0,get_fpg_based_on_function_nod:0,get_fpg_based_on_list_funct:0,get_fpg_based_on_sink:0,get_fpg_by_function_nod:0,get_friendly_id:0,get_function_depend:0,get_function_graph:0,get_function_metadata:0,get_function_nod:0,get_function_paths_by_object:0,get_graph_properti:0,get_group_var:0,get_inputs_uid:0,get_kb_graph:0,get_list_entri:0,get_lowest_psn:0,get_mathematical_functions_uid:0,get_mdao_setup:0,get_mdg:0,get_mg_function_ord:0,get_mpg:0,get_node_attribut:0,get_node_subcategori:0,get_node_text:0,get_nodes_based_on_str:0,get_nodes_indegre:0,get_nodes_outdegre:0,get_nodes_subcategori:0,get_number_of_coupl:0,get_ordered_cycl:0,get_outputs_uid:0,get_parameters_uid:0,get_path_combin:0,get_possible_function_ord:0,get_process_hierarchi:0,get_process_list:0,get_rcg:0,get_same_graph_class:0,get_sourc:0,get_subgraph_by_function_nod:0,get_system_input:0,get_target:0,get_uid:0,get_uid_search_xpath:0,get_unique_friendly_id:0,get_used_parameter_uid:0,get_xpath_of_uid:0,give:0,given:0,global:0,gov:0,graph_check_crit:0,graph_class:0,graph_data:0,graph_has_nested_attribut:0,graph_id:0,graph_kadmo:0,graph_process:0,graph_properti:0,graphml:0,group:0,group_dict:0,group_idx:0,guarante:0,guess:0,handl:0,has:0,has_edg:0,has_nod:0,has_predecessor:0,has_successor:0,hash:0,hashabl:0,have:0,header:0,hello:0,henc:0,here:0,hex:0,hex_to_rgb:0,hierarchi:0,higher_level_remov:0,highest:0,hold:0,hole:0,how:0,howev:0,html:0,http:0,ident:0,identifi:0,idf:0,idiom:0,ids:0,ignor:0,ignore_func:0,ignore_list:0,ignore_mod:0,ignorefunct:0,illustr:0,implement:0,impose_mdao_architectur:0,in_degre:0,in_edg:0,incid:0,includ:0,include_al:0,include_reference_data:0,include_system_var:0,indec:0,indegre:0,indegreeview:0,indent:0,indentifi:0,independ:0,index:0,index_bracket:0,indic:0,induc:0,inedgeview:0,info:0,inform:0,initi:0,inout:0,inp:0,inplac:0,input:0,input_list:0,input_nod:0,inputless:0,inputs_el:0,insert:0,insert_node_on_diagon:0,insid:0,inspect:0,inspect_nod:0,inspect_process:0,inspir:0,instanc:0,instance_id:0,instanceid:0,instead:0,integ:0,integr:0,interest:0,interfac:0,invalid:0,invalid_leaf_el:0,is_direct:0,is_multigraph:0,italian:0,item:0,iter:0,itertool:0,its:0,itself:0,ivang:0,japanes:0,jet:0,job:0,job_:0,job_nam:0,join:0,json:0,just:0,kb_dir_path:0,kdm:0,keep:0,keep_empty_el:0,keep_objective_vari:0,keep_run:0,keep_tex_fil:0,kei:0,key_ord:0,keyerror:0,keys_to_be_remov:0,keyword:0,knowledg:0,knowledge_bas:0,kwarg:0,lab:0,label:0,label_extens:0,labeling_method:0,lafag:0,languag:0,larg:0,last:0,latex:0,lead:0,leaf:0,least:0,left:0,len:0,length:0,let:0,level:0,librari:0,like:0,limit:0,line:0,link:0,list:0,list_of_funct:0,list_of_nod:0,list_of_sink:0,list_of_tool:0,literatur:0,load:0,load_cmdow:0,local:0,log:0,lookup:0,loop:0,lost:0,lower:0,lower_bound:0,lower_cas:0,lowest:0,maaik:0,mai:0,mainli:0,maintain:0,make:0,make_all_variables_valid:0,make_camel_cas:0,make_plur:0,make_plural_opt:0,make_singular:0,mani:0,manipul:0,manual:0,map:0,mark:0,mark_as_constraint:0,mark_as_design_vari:0,mark_as_object:0,mark_as_qoi:0,master:0,match:0,mathemat:0,matplotlib:0,matrix:0,max_func:0,maxim:0,maximum:0,mda:0,mda_typ:0,mdao:0,mdao_architectur:0,mdao_setup:0,mdaodatagraph:0,mddewit:0,mdf:0,mdg:0,mdo:0,mdo_architectur:0,meet:0,membership:0,memori:0,merg:0,merge_func:0,merge_funct:0,merge_function_mod:0,merge_function_nodes_based_on_mod:0,merge_parallel_funct:0,merge_sequential_funct:0,merger:0,messag:0,metadata:0,method:0,mg_function_ord:0,might:0,min_func:0,mind:0,minim:0,minimize_feedback:0,minimum:0,mixin_equ:0,mixin_mdao:0,mixin_vistom:0,mode:0,mode_id:0,modeid:0,model:0,model_definit:0,modul:0,more:0,most:0,mpg:0,multi_start:0,multidigraph:0,multigraph:0,multipl:0,must:0,mutabl:0,my_obj_fcn_nam:0,mygraph:0,n_coupling_var:0,n_disciplin:0,n_global_constraint:0,n_global_var:0,n_local_constraint:0,n_local_var:0,name:0,named_obj_fcn:0,namespac:0,nasa:0,nativ:0,nbr:0,nbrdict:0,nbunch:0,nbunch_it:0,nd_iter:0,nedg:0,need:0,neighbor:0,nest:0,networkx:0,networkxerror:0,never:0,new_edg:0,new_label:0,next_sequ:0,niter:0,nnode:0,node:0,node_dict_factori:0,node_id:0,node_is_funct:0,node_is_hol:0,node_is_objective_funct:0,node_is_output:0,node_is_vari:0,node_label:0,node_select:0,nodedata:0,nodedataview:0,nodes_for_ad:0,nodeview:0,nomin:0,nominal_valu:0,non:0,none:0,nonetyp:0,notat:0,note:0,notifi:0,notification_messag:0,ntr:0,num:0,number:0,number_of_edg:0,number_of_group:0,number_of_nod:0,numer:0,obj_vars_cov:0,object:0,obtain:0,off:0,old:0,old_edg:0,onc:0,one:0,onera:0,ones:0,onli:0,only_add_if_valu:0,only_feedback:0,open:0,open_fil:0,open_pdf:0,openmdao:0,oper:0,operator_uid:0,opt:0,optim:0,option:0,order:0,ordereddict:0,org:0,organ:0,organiz:0,origin:0,other:0,otherwis:0,our:0,out:0,out_degre:0,out_edg:0,outdegre:0,outdegreeview:0,outedgedataview:0,outedgeview:0,outgo:0,outp:0,output:0,output_nod:0,outputless:0,outputs_el:0,over:0,overal:0,overview:0,overwrit:0,own:0,owner:0,owner_uid:0,packag:0,page:0,pair:0,parallel:0,param:0,param_uid:0,paramet:0,parameters_el:0,params_uid:0,part:0,partit:0,pass:0,pate:0,path:0,path_graph:0,path_or_el:0,paus:0,pdf:0,peopl:0,per:0,percentag:0,perform:0,permit:0,pickl:0,place:0,platform:0,pleas:0,plot:0,plot_adjacency_matrix:0,plot_graph:0,plural:0,png:0,point:0,posit:0,possibl:0,post:0,pre:0,preced:0,precis:0,pred:0,predecessor:0,prefer:0,prefix:0,presenc:0,present:0,pretti:0,pretty_print:0,previous_sequ:0,print_attribut:0,print_circular_connections_in_log:0,print_contain:0,print_coupl:0,print_graph:0,print_in_log:0,print_in_t:0,print_indec:0,print_indexed_list:0,problem:0,problem_rol:0,problemat:0,process:0,process_hierarchi:0,process_step:0,produc:0,product:0,project:0,prompt:0,properti:0,propuls:0,provid:0,psg:0,psn:0,pull:0,pure:0,purpos:0,pymerg:0,pyplot:0,python:0,quantiti:0,queri:0,quickli:0,quietli:0,quot:0,rais:0,raise_error:0,raise_error_if_tru:0,rang:0,rce:0,rcg:0,read:0,readabl:0,reciproc:0,recognis:0,recommend:0,recurs:0,recursively_empti:0,recursively_stringifi:0,recursively_unique_attribut:0,red:0,reduc:0,reduct:0,ref:0,refer:0,reference_fil:0,reference_valu:0,refin:0,reflect:0,regular:0,reinstanti:0,rel:0,relabel:0,relabel_function_nod:0,relat:0,relev:0,remain:0,remi:0,remot:0,remote_engin:0,remov:0,remove_after_compress:0,remove_children_of_uid:0,remove_children_of_xpath:0,remove_contact:0,remove_data_graph_el:0,remove_edg:0,remove_edges_from:0,remove_element_based_on_uid:0,remove_element_based_on_xpath:0,remove_function_nod:0,remove_if_exist:0,remove_in_and_output:0,remove_input:0,remove_nod:0,remove_node_from_diagon:0,remove_nodes_from:0,remove_output:0,remove_paramet:0,remove_parameters_el:0,remove_process_graph_el:0,remove_unused_contact:0,remove_unused_output:0,remove_workflow_el:0,renam:0,replac:0,replacement_id:0,report:0,repres:0,represent:0,reproduc:0,request:0,requir:0,resolv:0,resolve_uid:0,resourc:0,respect:0,rest:0,result:0,retriev:0,revers:0,rgb:0,right:0,role:0,root:0,round:0,routin:0,row1:0,row2:0,rule:0,run:0,run_tim:0,runtim:0,safe:0,same:0,sampl:0,sampledir:0,samplefil:0,satisfi:0,save:0,save_a:0,scalar:0,schema:0,script:0,search:0,second:0,see:0,seidel:0,select:0,select_function_combination_from:0,select_objectives_from_graph:0,self:0,sellar:0,separ:0,sequenc:0,server:0,set:0,sever:0,shallow:0,share:0,shorter:0,should:0,show:0,show_now:0,shown:0,side:0,sidebar:0,signific:0,silent:0,similar:0,simpl:0,simpler:0,simpli:0,simplifi:0,simplify_equ:0,sinc:0,singl:0,single_or_multi:0,single_or_multi_execut:0,singular:0,sink:0,situat:0,size:0,skip:0,slave:0,small:0,some:0,some_fold:0,some_url:0,song:0,sonic:0,sort:0,sort_bi:0,sort_kei:0,sort_non_coupled_nod:0,sourc:0,space:0,specif:0,specifi:0,split:0,split_vari:0,splittabl:0,spring:0,squar:0,standard:0,start:0,start_step:0,statement:0,statu:0,step:0,still:0,stop:0,store:0,str:0,stringifi:0,structur:0,student:0,style:0,sub:0,subcategori:0,subclass:0,subel:0,subgraph:0,subgroup:0,subscript:0,subset:0,succ:0,successor:0,suffix:0,suit:0,sum:0,summar:0,summarize_var:0,suppli:0,sure:0,svg:0,sylvain:0,symbol:0,syntax:0,system:0,system_input:0,tabl:0,tabul:0,tag:0,take:0,taken:0,target:0,technic:0,telephon:0,test:0,test_attr_cond:0,test_valu:0,tex:0,text:0,textfil:0,thank:0,thei:0,them:0,thi:0,think:0,third:0,those:0,though:0,through:0,thu:0,time:0,timestamp:0,titl:0,to_direct:0,to_undirect:0,todo:0,togeth:0,tool:0,toolspecialist:0,total:0,transfer:0,transform:0,transform_data_into_str:0,transform_string_into_format:0,translat:0,translate_dict_kei:0,translate_list:0,tree:0,tudelft:0,tupl:0,twice:0,two:0,type:0,typic:0,uid:0,uid_length:0,uml:0,unconnect:0,under:0,underscor:0,undirect:0,uniqu:0,unmake_camel_cas:0,unmark:0,unmark_vari:0,unnamed_funct:0,unpack:0,until:0,updat:0,upper:0,upper_bound:0,urlsit:0,usag:0,use:0,use_d3js_node_id:0,use_png_fig:0,use_pretty_print:0,used:0,used_id:0,useful:0,user:0,user_prompt_select_opt:0,using:0,usual:0,utf:0,utm:0,uxpath:0,valid:0,valu:0,var_dim:0,var_valu:0,variabl:0,variableinstance1:0,variableinstance2:0,variableinstance3:0,variableinstance4:0,varieti:0,variou:0,verif:0,verifi:0,versatil:0,version:0,via:0,view:0,vispack_vers:0,vistom:0,vistoms_add:0,vistoms_cr:0,vistoms_dir:0,vistoms_vers:0,visual:0,wai:0,wang:0,want:0,warn:0,weight:0,well:0,were:0,what:0,when:0,where:0,whether:0,which:0,window:0,wing:0,wit:0,within:0,without:0,wn2898:0,work:0,workflow:0,write:0,write_problem_to_textfil:0,written:0,wrong:0,xdsm:0,xml_declar:0,xml_file:0,xpath:0,xpath_exclud:0,xpath_includ:0,yet:0,yield:0,you:0,your:0,zero:0,zhang:0,zip:0},titles:["Welcome to KADMOS\u2019s documentation!"],titleterms:{cmdow:0,code:0,datagraph:0,document:0,equationmixin:0,fundamentalproblemgraph:0,gener:0,graph:0,kadmo:0,kadmosgraph:0,knowledgebas:0,mdaomixin:0,mdaoprocessgraph:0,print:0,processgraph:0,repositoryconnectivitygraph:0,string:0,util:0,vistomsmixin:0,welcom:0,xml:0}}) \ No newline at end of file +Search.setIndex({docnames:["KADMOS"],envversion:52,filenames:["KADMOS.rst"],objects:{"":{kadmos:[0,0,0,"-"]},"kadmos.cmdows.cmdows":{CMDOWS:[0,1,1,""]},"kadmos.cmdows.cmdows.CMDOWS":{add_actor:[0,2,1,""],add_contact:[0,2,1,""],add_dc:[0,2,1,""],add_dc_general_info:[0,2,1,""],add_dc_inputs_element:[0,2,1,""],add_dc_outputs_element:[0,2,1,""],add_dc_performance_info:[0,2,1,""],add_dc_remote_component_info:[0,2,1,""],add_dc_verification:[0,2,1,""],add_element_to_element_of_uid:[0,2,1,""],add_header:[0,2,1,""],add_new_parameters_from_element:[0,2,1,""],assert_element_tag:[0,2,1,""],check:[0,2,1,""],check_references:[0,2,1,""],check_schema:[0,2,1,""],check_uids:[0,2,1,""],ensure_abs_xpath:[0,2,1,""],get_design_competences_uids:[0,2,1,""],get_element_of_uid:[0,2,1,""],get_executable_blocks_uids:[0,2,1,""],get_inputs_uids:[0,2,1,""],get_mathematical_functions_uids:[0,2,1,""],get_outputs_uids:[0,2,1,""],get_parameters_uids:[0,2,1,""],get_used_parameter_uids:[0,2,1,""],get_xpath_of_uid:[0,2,1,""],remove_children_of_uid:[0,2,1,""],remove_children_of_xpath:[0,2,1,""],remove_contact:[0,2,1,""],remove_data_graph_element:[0,2,1,""],remove_element_based_on_uid:[0,2,1,""],remove_element_based_on_xpath:[0,2,1,""],remove_in_and_outputs:[0,2,1,""],remove_inputs:[0,2,1,""],remove_outputs:[0,2,1,""],remove_parameter:[0,2,1,""],remove_parameters:[0,2,1,""],remove_parameters_element:[0,2,1,""],remove_process_graph_element:[0,2,1,""],remove_unused_contacts:[0,2,1,""],remove_workflow_element:[0,2,1,""],resolve_uids:[0,2,1,""],save:[0,2,1,""],schema:[0,2,1,""],simplify:[0,2,1,""],simplify_equations:[0,2,1,""],version:[0,2,1,""]},"kadmos.graph.graph_data":{DataGraph:[0,1,1,""],FundamentalProblemGraph:[0,1,1,""],RepositoryConnectivityGraph:[0,1,1,""]},"kadmos.graph.graph_data.DataGraph":{get_coupling_dictionary:[0,2,1,""],get_coupling_matrix:[0,2,1,""],get_feedback_info:[0,2,1,""],get_highest_instance:[0,2,1,""],get_possible_function_order:[0,2,1,""],mark_as_constraint:[0,2,1,""],mark_as_constraints:[0,2,1,""],mark_as_design_variable:[0,2,1,""],mark_as_design_variables:[0,2,1,""],mark_as_objective:[0,2,1,""],mark_as_qois:[0,2,1,""],minimize_feedback:[0,2,1,""],remove_unused_outputs:[0,2,1,""],sort_nodes_for_process:[0,2,1,""],unmark_variable:[0,2,1,""]},"kadmos.graph.graph_data.FundamentalProblemGraph":{add_function_problem_roles:[0,2,1,""],add_problem_formulation:[0,2,1,""],check_and_get_coupled_functions_groups:[0,2,1,""],check_and_get_design_variables:[0,2,1,""],check_and_get_post_coupling_functions:[0,2,1,""],check_and_get_pre_coupling_functions:[0,2,1,""],create_mdg:[0,2,1,""],create_mpg:[0,2,1,""],determine_scope_constraint_functions:[0,2,1,""],determine_scope_design_variables:[0,2,1,""],get_group_couplings:[0,2,1,""],get_mdg:[0,2,1,""],get_mg_function_ordering:[0,2,1,""],get_objective_node:[0,2,1,""],get_partition_info:[0,2,1,""],get_sub_level_functions:[0,2,1,""],get_sys_post_couplings:[0,2,1,""],get_system_level_functions:[0,2,1,""],impose_mdao_architecture:[0,2,1,""],partition_graph:[0,2,1,""],select_distributed_architecture:[0,2,1,""],select_number_of_partitions:[0,2,1,""]},"kadmos.graph.graph_data.RepositoryConnectivityGraph":{create_mathematical_problem:[0,2,1,""],get_fpg_based_on_function_nodes:[0,2,1,""],get_fpg_based_on_list_functions:[0,2,1,""],get_fpg_based_on_sinks:[0,2,1,""],get_fpg_by_function_nodes:[0,2,1,""],get_function_paths_by_objective:[0,2,1,""],get_path_combinations:[0,2,1,""],select_function_combination_from:[0,2,1,""]},"kadmos.graph.graph_kadmos":{KadmosGraph:[0,1,1,""]},"kadmos.graph.graph_kadmos.KadmosGraph":{add_contact:[0,2,1,""],add_contact_roles:[0,2,1,""],add_dc_general_info:[0,2,1,""],add_dc_performance_info:[0,2,1,""],add_dc_remote_component_info:[0,2,1,""],add_default_description:[0,2,1,""],add_default_name:[0,2,1,""],add_edge:[0,2,1,""],add_instance:[0,2,1,""],add_node:[0,2,1,""],add_objective_function_by_nodes:[0,2,1,""],change_graph_class:[0,2,1,""],check:[0,2,1,""],check_cmdows_integrity:[0,2,1,""],check_for_coupling:[0,2,1,""],copy_as:[0,2,1,""],copy_edge:[0,2,1,""],copy_node_with_suffix:[0,2,1,""],count_function_nodes:[0,2,1,""],create_dsm:[0,2,1,""],deepcopy:[0,2,1,""],deepcopy_as:[0,2,1,""],disconnect_problematic_variables_from:[0,2,1,""],find_all_nodes:[0,2,1,""],get_adjacency_matrix:[0,2,1,""],get_architecture_node_ids:[0,2,1,""],get_architecture_node_labels:[0,2,1,""],get_categorized_nodes:[0,2,1,""],get_contracted_graph:[0,2,1,""],get_direct_coupling_nodes:[0,2,1,""],get_first_node_instance:[0,2,1,""],get_function_graph:[0,2,1,""],get_function_metadata:[0,2,1,""],get_function_nodes:[0,2,1,""],get_graph_properties:[0,2,1,""],get_node_attributes:[0,2,1,""],get_node_subcategory:[0,2,1,""],get_nodes_based_on_strings:[0,2,1,""],get_nodes_indegree:[0,2,1,""],get_nodes_outdegree:[0,2,1,""],get_nodes_subcategory:[0,2,1,""],get_number_of_couplings:[0,2,1,""],get_same_graph_class:[0,2,1,""],get_sources:[0,2,1,""],get_subgraph_by_function_nodes:[0,2,1,""],get_system_inputs:[0,2,1,""],get_targets:[0,2,1,""],graph_has_nested_attributes:[0,2,1,""],has_nodes:[0,2,1,""],inspect:[0,2,1,""],inspect_node:[0,2,1,""],inspect_nodes:[0,2,1,""],load_cmdows:[0,2,1,""],make_all_variables_valid:[0,2,1,""],merge_function_modes:[0,2,1,""],merge_function_nodes_based_on_modes:[0,2,1,""],merge_functions:[0,2,1,""],merge_parallel_functions:[0,2,1,""],merge_sequential_functions:[0,2,1,""],node_is_function:[0,2,1,""],node_is_hole:[0,2,1,""],node_is_objective_function:[0,2,1,""],node_is_output:[0,2,1,""],node_is_variable:[0,2,1,""],plot_adjacency_matrix:[0,2,1,""],plot_graph:[0,2,1,""],print_graph:[0,2,1,""],relabel_function_nodes:[0,2,1,""],remove_function_nodes:[0,2,1,""],save:[0,2,1,""],select_objectives_from_graph:[0,2,1,""],split_variables:[0,2,1,""]},"kadmos.graph.graph_process":{MdaoProcessGraph:[0,1,1,""]},"kadmos.graph.graph_process.MdaoProcessGraph":{add_process:[0,2,1,""],add_process_partitions:[0,2,1,""],connect_nested_iterators:[0,2,1,""],get_lowest_psn:[0,2,1,""],get_node_text:[0,2,1,""],get_ordered_cycles:[0,2,1,""],get_process_hierarchy:[0,2,1,""],get_process_list:[0,2,1,""],inspect_process:[0,2,1,""]},"kadmos.graph.mixin_equation":{EquationMixin:[0,1,1,""]},"kadmos.graph.mixin_equation.EquationMixin":{add_equation:[0,2,1,""],add_equation_label:[0,2,1,""],add_equation_labels:[0,2,1,""],add_mathematical_function:[0,2,1,""]},"kadmos.graph.mixin_mdao":{MdaoMixin:[0,1,1,""]},"kadmos.graph.mixin_mdao.MdaoMixin":{insert_node_on_diagonal:[0,2,1,""],remove_node_from_diagonal:[0,2,1,""]},"kadmos.graph.mixin_vistoms":{VistomsMixin:[0,1,1,""]},"kadmos.graph.mixin_vistoms.VistomsMixin":{vistoms_add:[0,2,1,""],vistoms_create:[0,2,1,""]},"kadmos.knowledgebase.knowledgebase":{KnowledgeBase:[0,1,1,""]},"kadmos.knowledgebase.knowledgebase.KnowledgeBase":{get_function_dependencies:[0,2,1,""],get_function_graph:[0,2,1,""],get_kb_graphs:[0,2,1,""],get_rcg:[0,2,1,""],print_circular_connections_in_log:[0,2,1,""]},"kadmos.utilities":{general:[0,0,0,"-"],printing:[0,0,0,"-"],strings:[0,0,0,"-"],xml:[0,0,0,"-"]},"kadmos.utilities.general":{assert_dict_keys:[0,3,1,""],color_list:[0,3,1,""],convert_bytes:[0,3,1,""],dict_to_ord_dict:[0,3,1,""],export_as_json:[0,3,1,""],file_size:[0,3,1,""],file_size_MB:[0,3,1,""],filter_group_vars:[0,3,1,""],format_string_for_latex:[0,3,1,""],format_string_for_vistoms:[0,3,1,""],get_element_dict:[0,3,1,""],get_friendly_id:[0,3,1,""],get_group_vars:[0,3,1,""],get_list_entries:[0,3,1,""],get_mdao_setup:[0,3,1,""],get_uid:[0,3,1,""],get_unique_friendly_id:[0,3,1,""],hex_to_rgb:[0,3,1,""],make_camel_case:[0,3,1,""],make_plural:[0,3,1,""],make_singular:[0,3,1,""],open_file:[0,3,1,""],remove_if_exists:[0,3,1,""],test_attr_cond:[0,3,1,""],transform_data_into_strings:[0,3,1,""],transform_string_into_format:[0,3,1,""],translate_dict_keys:[0,3,1,""],translate_list:[0,3,1,""],unmake_camel_case:[0,3,1,""]},"kadmos.utilities.printing":{print_in_table:[0,3,1,""],print_indexed_list:[0,3,1,""]},"kadmos.utilities.xml":{ExtendedElement:[0,1,1,""],get_element_details:[0,3,1,""],get_uid_search_xpath:[0,3,1,""],merge:[0,3,1,""],recursively_empty:[0,3,1,""],recursively_stringify:[0,3,1,""],recursively_unique_attribute:[0,3,1,""]},"kadmos.utilities.xml.ExtendedElement":{add:[0,2,1,""],add_process_hierarchy:[0,2,1,""],clean:[0,2,1,""],findasttext:[0,2,1,""],finddict:[0,2,1,""]}},objnames:{"0":["py","module","Python module"],"1":["py","class","Python class"],"2":["py","method","Python method"],"3":["py","function","Python function"]},objtypes:{"0":"py:module","1":"py:class","2":"py:method","3":"py:function"},terms:{"13S":0,"1e4":0,"boolean":0,"byte":0,"case":0,"class":0,"default":0,"export":0,"final":0,"float":0,"function":0,"import":0,"int":0,"long":0,"new":0,"return":0,"super":0,"true":0,"try":0,"while":0,Adding:0,For:0,IDs:0,The:0,These:0,Use:0,Will:0,__all__:0,__none__:0,_check_category_a:0,_check_category_b:0,_check_category_c:0,abbreviate_keyword:0,abl:0,abov:0,absolut:0,access:0,accord:0,account:0,action:0,actual:0,add:0,add_actor:0,add_contact:0,add_contact_rol:0,add_dc:0,add_dc_general_info:0,add_dc_inputs_el:0,add_dc_outputs_el:0,add_dc_performance_info:0,add_dc_remote_component_info:0,add_dc_verif:0,add_default_descript:0,add_default_nam:0,add_edg:0,add_element_to_element_of_uid:0,add_equ:0,add_equation_label:0,add_function_problem_rol:0,add_head:0,add_inst:0,add_mathematical_funct:0,add_new_parameters_from_el:0,add_nod:0,add_objective_function_by_nod:0,add_problem_formul:0,add_process:0,add_process_hierarchi:0,add_process_partit:0,added:0,addit:0,address:0,adher:0,adjac:0,adjust:0,adress:0,advanc:0,aerodynam:0,aerospac:0,after:0,agil:0,aircraft:0,algorithm:0,all:0,all_keys_requir:0,all_nod:0,allow:0,allow_unconverged_coupl:0,alreadi:0,als:0,also:0,american:0,amount:0,analys:0,analysi:0,analyt:0,analyz:0,ani:0,anoth:0,append:0,appli:0,applic:0,appyl:0,arbitrari:0,architect:0,architectur:0,archiv:0,arg:0,argument:0,around:0,as_view:0,ascend:0,ascens:0,ask:0,assert:0,assert_dict_kei:0,assert_element_tag:0,assess:0,assign:0,associ:0,assum:0,ast:0,attr:0,attr_cond:0,attr_dict:0,attr_exclud:0,attr_includ:0,attr_list:0,attr_valu:0,attrb:0,attrib:0,attribut:0,automat:0,avail:0,back:0,base:0,baselin:0,basestr:0,becaus:0,becom:0,been:0,befor:0,being:0,belong:0,below:0,best:0,between:0,bisect:0,bli:0,bliss:0,block:0,bool:0,both:0,bound:0,box:0,bracket:0,branch:0,build:0,busi:0,calcul:0,camel:0,camel_case_convers:0,camelcas:0,can:0,capac:0,care:0,casi:0,categori:0,certain:0,chang:0,change_graph_class:0,charact:0,characterist:0,check:0,check_and_get_coupled_functions_group:0,check_and_get_design_vari:0,check_and_get_post_coupling_funct:0,check_and_get_pre_coupling_funct:0,check_cmdows_integr:0,check_for_coupl:0,check_graph:0,check_list:0,check_refer:0,check_schema:0,check_uid:0,child:0,children:0,children_to_keep:0,children_to_remov:0,choos:0,circular:0,circularconnect:0,clariti:0,clean:0,close:0,clutter:0,cmdowsvers:0,cnstrnt_var:0,collaborative_engin:0,collaborativeengin:0,collect:0,collid:0,collis:0,color:0,color_list:0,color_set:0,colors_based_on:0,column:0,combin:0,common:0,compani:0,compar:0,comparison:0,compet:0,compil:0,compile_pdf:0,complet:0,complex:0,compon:0,compos:0,compress:0,comput:0,condit:0,config:0,configur:0,connect:0,connect_nested_iter:0,conserv:0,consid:0,consider:0,consist:0,consistent_root:0,consol:0,constraint:0,contact:0,contact_uid:0,contain:0,content:0,contig:0,continu:0,contract:0,contracted_graph:0,contraction_level:0,conv:0,convent:0,converg:0,convers:0,convert:0,convert_byt:0,coor:0,copi:0,copy_a:0,copy_edg:0,copy_node_with_suffix:0,copy_typ:0,correspond:0,could:0,count:0,count_function_nod:0,countri:0,coupl:0,coupled_functions_group:0,coupling_dict:0,coupling_functions_group:0,coupling_strength:0,cpac:0,creat:0,create_dsm:0,create_mathematical_problem:0,create_mdg:0,create_mpg:0,creation:0,creation_d:0,creator:0,creator_uid:0,criteria:0,cross:0,current:0,current_group_idx:0,custom:0,cwd:0,cycl:0,d3j:0,data:0,data_exchange_dict:0,date:0,datetim:0,dc_uid:0,decrib:0,deep:0,deepcopi:0,deepcopy_a:0,defin:0,definit:0,degre:0,delet:0,delft:0,depart:0,depend:0,deprec:0,des_var:0,descend:0,describ:0,descript:0,design:0,designcompet:0,desir:0,destin:0,destination_fold:0,detail:0,determin:0,determine_scope_constraint_funct:0,determine_scope_design_vari:0,develop:0,dewit:0,diagon:0,diagonal_po:0,diagram:0,dic:0,dict:0,dict_to_ord_dict:0,dictionari:0,differ:0,differenti:0,digraph:0,dimens:0,direct:0,directli:0,directori:0,disciplin:0,disciplinari:0,disconnect:0,disconnect_collided_target:0,disconnect_problematic_variables_from:0,disconnect_shared_sourc:0,disregard:0,distinguis:0,distribut:0,divid:0,doe:0,doe_set:0,doesn:0,doing:0,done:0,download:0,draw:0,dsm:0,dtc:0,dubreuil:0,due:0,dummy_method:0,dummy_result:0,dummy_vers:0,duplic:0,dynam:0,each:0,easi:0,edg:0,edge_label:0,edge_or_nod:0,edu:0,either:0,element:0,element_to_add:0,elementtre:0,email:0,employe:0,empti:0,enabl:0,encod:0,end:0,end_in_iterative_nod:0,engin:0,enrich:0,ensur:0,ensure_abs_xpath:0,entri:0,entries_to_remov:0,equat:0,error:0,especi:0,etc:0,evalu:0,everi:0,everyth:0,exampl:0,exblock_uid:0,exce:0,except:0,exchang:0,exclud:0,exclus:0,execut:0,executableblock:0,exist:0,expect:0,expected_amount:0,expected_kei:0,expected_tag:0,expected_tag_new_el:0,expected_tag_uid_el:0,expected_text:0,explicit:0,export_as_json:0,express:0,extend:0,extendedel:0,extens:0,extra:0,extract:0,fals:0,feedback:0,feedforward:0,fidel:0,fidelity_level:0,fig_num:0,fig_siz:0,figur:0,file:0,file_nam:0,file_path:0,file_ref:0,file_s:0,file_size_mb:0,file_typ:0,filenam:0,filevers:0,filter:0,filter_group_var:0,filter_set:0,find:0,find_all_nod:0,findasttext:0,finddict:0,findtext:0,first:0,folder:0,follow:0,form:0,format:0,format_string_for_latex:0,format_string_for_vistom:0,formul:0,found:0,fpg:0,french:0,from:0,front:0,full:0,funcnam:0,function_nod:0,function_ord:0,function_order_method:0,function_typ:0,functiongraph:0,fundament:0,further:0,futur:0,gauss:0,get:0,get_adjacency_matrix:0,get_architecture_node_id:0,get_architecture_node_label:0,get_categorized_nod:0,get_contracted_graph:0,get_coupling_dictionari:0,get_coupling_matrix:0,get_design_competences_uid:0,get_direct_coupling_nod:0,get_element_detail:0,get_element_dict:0,get_element_of_uid:0,get_evalu:0,get_executable_blocks_uid:0,get_feedback_info:0,get_first_node_inst:0,get_fpg_based_on_function_nod:0,get_fpg_based_on_list_funct:0,get_fpg_based_on_sink:0,get_fpg_by_function_nod:0,get_friendly_id:0,get_function_depend:0,get_function_graph:0,get_function_metadata:0,get_function_nod:0,get_function_paths_by_object:0,get_graph_properti:0,get_group_coupl:0,get_group_var:0,get_highest_inst:0,get_inputs_uid:0,get_kb_graph:0,get_list_entri:0,get_lowest_psn:0,get_mathematical_functions_uid:0,get_mdao_setup:0,get_mdg:0,get_mg_function_ord:0,get_node_attribut:0,get_node_subcategori:0,get_node_text:0,get_nodes_based_on_str:0,get_nodes_indegre:0,get_nodes_outdegre:0,get_nodes_subcategori:0,get_number_of_coupl:0,get_objective_nod:0,get_ordered_cycl:0,get_outputs_uid:0,get_parameters_uid:0,get_partition_info:0,get_path_combin:0,get_possible_function_ord:0,get_process_hierarchi:0,get_process_list:0,get_rcg:0,get_same_graph_class:0,get_sourc:0,get_sub_level_funct:0,get_subgraph_by_function_nod:0,get_sys_post_coupl:0,get_system_input:0,get_system_level_funct:0,get_target:0,get_uid:0,get_uid_search_xpath:0,get_unique_friendly_id:0,get_used_parameter_uid:0,get_xpath_of_uid:0,give:0,given:0,gkhome:0,glaro:0,global:0,global_cnstrnt_funct:0,global_objective_funct:0,gov:0,graph_check_crit:0,graph_class:0,graph_data:0,graph_has_nested_attribut:0,graph_id:0,graph_kadmo:0,graph_process:0,graph_properti:0,graphml:0,group:0,group_dict:0,group_idx:0,guarante:0,guess:0,handl:0,has:0,has_nod:0,hash:0,hashabl:0,have:0,header:0,hello:0,here:0,hex:0,hex_to_rgb:0,hierarchi:0,higher_level_remov:0,highest:0,hold:0,hole:0,how:0,howev:0,html:0,http:0,identifi:0,idf:0,ids:0,ignor:0,ignore_func:0,ignore_list:0,ignore_mod:0,ignore_outdegre:0,ignorefunct:0,illustr:0,implement:0,impose_mdao_architectur:0,includ:0,include_al:0,include_reference_data:0,include_run_tim:0,include_system_var:0,increas:0,indec:0,indegre:0,indent:0,indentifi:0,independ:0,index:0,index_bracket:0,indic:0,info:0,inform:0,initi:0,inout:0,inp:0,input:0,input_list:0,input_nod:0,inputless:0,inputs_el:0,insert:0,insert_node_on_diagon:0,insid:0,inspect:0,inspect_nod:0,inspect_process:0,instanc:0,instance_id:0,instanceid:0,instead:0,integ:0,integr:0,interest:0,invalid:0,invalid_leaf_el:0,italian:0,item:0,iter:0,itertool:0,its:0,itself:0,ivang:0,japanes:0,jet:0,job:0,job_:0,job_nam:0,json:0,just:0,kb_dir_path:0,kdm:0,keep:0,keep_empty_el:0,keep_objective_vari:0,keep_run:0,keep_tex_fil:0,kei:0,key_ord:0,keys_to_be_remov:0,keyword:0,knowledg:0,knowledge_bas:0,kwarg:0,lab:0,label:0,label_extens:0,labeling_method:0,lafag:0,languag:0,larg:0,last:0,latex:0,lead:0,leaf:0,least:0,left:0,length:0,less:0,let:0,level:0,librari:0,limit:0,line:0,link:0,list:0,list_of_funct:0,list_of_nod:0,list_of_sink:0,list_of_tool:0,literatur:0,load:0,load_cmdow:0,local:0,local_cnstrnt_func:0,local_objective_funct:0,log:0,loop:0,lost:0,lower:0,lower_bound:0,lower_cas:0,lowest:0,maaik:0,mainli:0,maintain:0,make:0,make_all_variables_valid:0,make_camel_cas:0,make_plur:0,make_plural_opt:0,make_singular:0,mani:0,manipul:0,manual:0,map:0,mark:0,mark_as_constraint:0,mark_as_design_vari:0,mark_as_object:0,mark_as_qoi:0,master:0,match:0,mathemat:0,matplotlib:0,matrix:0,max_func:0,maxim:0,maximum:0,mda:0,mda_typ:0,mdao:0,mdao_architectur:0,mdao_definit:0,mdao_setup:0,mdaodatagraph:0,mdaograph:0,mddewit:0,mdf:0,mdg:0,mdo:0,mdo_architectur:0,meet:0,merg:0,merge_func:0,merge_funct:0,merge_function_mod:0,merge_function_nodes_based_on_mod:0,merge_parallel_funct:0,merge_sequential_funct:0,merger:0,messag:0,metadata:0,method:0,meti:0,mg_function_ord:0,might:0,min_func:0,mind:0,minim:0,minimize_feedback:0,minimum:0,mixin_equ:0,mixin_mdao:0,mixin_vistom:0,mode:0,mode_id:0,modeid:0,model:0,model_definit:0,modul:0,more:0,most:0,mpg:0,multi_start:0,multidigraph:0,multigraph:0,multipl:0,must:0,mutabl:0,my_obj_fcn_nam:0,mygraph:0,n_coupling_var:0,n_disciplin:0,n_global_constraint:0,n_global_var:0,n_limit:0,n_local_constraint:0,n_local_var:0,n_part:0,name:0,named_obj_fcn:0,namespac:0,nasa:0,nativ:0,need:0,neighbor:0,nest:0,networkx:0,new_edg:0,new_label:0,newli:0,next:0,next_sequ:0,node:0,node_id:0,node_is_funct:0,node_is_hol:0,node_is_objective_funct:0,node_is_output:0,node_is_vari:0,node_label:0,node_select:0,nomin:0,nominal_valu:0,non:0,none:0,nonetyp:0,notat:0,note:0,notifi:0,notification_messag:0,ntr:0,num:0,number:0,number_of_group:0,number_of_nod:0,numer:0,obj_vars_cov:0,object:0,obtain:0,off:0,old:0,old_edg:0,one:0,onera:0,ones:0,onli:0,only_add_if_valu:0,only_feedback:0,open:0,open_fil:0,open_pdf:0,openmdao:0,oper:0,operator_uid:0,opt:0,optim:0,option:0,order:0,ordereddict:0,organ:0,organiz:0,origin:0,other:0,otherwis:0,our:0,out:0,outdegre:0,outgo:0,outp:0,output:0,output_nod:0,outputless:0,outputs_el:0,overal:0,overview:0,owner:0,owner_uid:0,packag:0,page:0,pair:0,parallel:0,param:0,param_uid:0,paramet:0,parameters_el:0,params_uid:0,part:0,partit:0,partition_graph:0,partition_rang:0,partition_vari:0,pass:0,pate:0,path:0,path_or_el:0,paus:0,pdf:0,per:0,percentag:0,perform:0,pickl:0,place:0,platform:0,pleas:0,plot:0,plot_adjacency_matrix:0,plot_combo:0,plot_graph:0,plot_pareto_front:0,plural:0,png:0,point:0,posit:0,possibl:0,post:0,post_coupling_funct:0,pre:0,pre_coupling_funct:0,precis:0,predecessor:0,prefer:0,prefix:0,presenc:0,present:0,pretti:0,pretty_print:0,previou:0,previous_sequ:0,print_attribut:0,print_circular_connections_in_log:0,print_combo:0,print_contain:0,print_coupl:0,print_graph:0,print_in_log:0,print_in_t:0,print_indec:0,print_indexed_list:0,problem:0,problem_rol:0,problemat:0,problemgraph:0,process:0,process_hierarchi:0,process_step:0,processgraph:0,produc:0,product:0,project:0,prompt:0,properti:0,propuls:0,provid:0,psg:0,psn:0,pull:0,pure:0,purpos:0,pymerg:0,pyplot:0,python:0,quantiti:0,queri:0,quickli:0,quot:0,rais:0,raise_error:0,raise_error_if_tru:0,rang:0,rce:0,rcg:0,recognis:0,recommend:0,recurs:0,recursively_empti:0,recursively_stringifi:0,recursively_unique_attribut:0,reduc:0,ref:0,refer:0,reference_fil:0,reference_valu:0,refin:0,regular:0,reinstanti:0,rel:0,relabel:0,relabel_function_nod:0,relat:0,remain:0,remi:0,remot:0,remote_engin:0,remov:0,remove_after_compress:0,remove_children_of_uid:0,remove_children_of_xpath:0,remove_contact:0,remove_data_graph_el:0,remove_element_based_on_uid:0,remove_element_based_on_xpath:0,remove_function_nod:0,remove_if_exist:0,remove_in_and_output:0,remove_input:0,remove_nod:0,remove_node_from_diagon:0,remove_output:0,remove_paramet:0,remove_parameters_el:0,remove_process_graph_el:0,remove_unused_contact:0,remove_unused_output:0,remove_workflow_el:0,renam:0,replac:0,replacement_id:0,repres:0,request:0,requir:0,resolv:0,resolve_uid:0,resourc:0,respect:0,result:0,retriev:0,revers:0,rgb:0,right:0,role:0,root:0,round:0,row1:0,row2:0,rtype:0,run:0,run_tim:0,runtim:0,safe:0,same:0,sampl:0,sampledir:0,samplefil:0,satisfi:0,save:0,save_a:0,scalar:0,schema:0,scope:0,script:0,search:0,second:0,see:0,seidel:0,select:0,select_distributed_architectur:0,select_function_combination_from:0,select_number_of_partit:0,select_objectives_from_graph:0,self:0,sellar:0,separ:0,sequenc:0,server:0,set:0,sever:0,shallow:0,share:0,shorter:0,should:0,show:0,show_now:0,shown:0,side:0,sidebar:0,signific:0,simpl:0,simpli:0,simplifi:0,simplify_equ:0,sinc:0,singl:0,single_or_multi:0,single_or_multi_execut:0,singular:0,sink:0,situat:0,size:0,slave:0,small:0,some:0,some_fold:0,some_url:0,song:0,sonic:0,sort:0,sort_bi:0,sort_kei:0,sort_nodes_for_process:0,sourc:0,space:0,specif:0,specifi:0,split:0,split_vari:0,splittabl:0,spring:0,squar:0,standard:0,start:0,start_step:0,statement:0,statu:0,step:0,still:0,stop:0,store:0,str:0,stringifi:0,structur:0,student:0,sub:0,subcategori:0,subclass:0,subel:0,subgraph:0,subgroup:0,subscript:0,subset:0,subsystem:0,suffix:0,suit:0,summar:0,summarize_var:0,suppli:0,sure:0,svg:0,sylvain:0,symbol:0,sys_level_post_coupl:0,system:0,system_input:0,system_vari:0,tabl:0,tabul:0,tag:0,take:0,taken:0,target:0,telephon:0,test:0,test_attr_cond:0,test_valu:0,tex:0,text:0,textfil:0,thank:0,thei:0,them:0,therefor:0,thi:0,think:0,third:0,though:0,through:0,thu:0,time:0,timestamp:0,titl:0,togeth:0,tool:0,tool_specialist:0,toolspecialist:0,total:0,tpwgt:0,transform:0,transform_data_into_str:0,transform_string_into_format:0,translat:0,translate_dict_kei:0,translate_list:0,tree:0,tudelft:0,tupl:0,two:0,type:0,uid:0,uid_length:0,uml:0,umn:0,unconnect:0,under:0,underscor:0,undirect:0,uniqu:0,unmake_camel_cas:0,unmark:0,unmark_vari:0,unnamed_funct:0,until:0,unus:0,updat:0,upper:0,upper_bound:0,urlsit:0,usag:0,use:0,use_d3js_node_id:0,use_png_fig:0,use_pretty_print:0,used:0,used_id:0,useful:0,user:0,user_prompt_select_opt:0,using:0,utf:0,utm:0,uxpath:0,valid:0,valu:0,var_dim:0,var_valu:0,variabl:0,variableinstance1:0,variableinstance2:0,variableinstance3:0,variableinstance4:0,varieti:0,variou:0,verif:0,verifi:0,versatil:0,version:0,vistom:0,vistoms_add:0,vistoms_cr:0,vistoms_dir:0,vistoms_vers:0,visual:0,wai:0,wang:0,want:0,warn:0,weight:0,well:0,were:0,when:0,whether:0,which:0,window:0,wing:0,wit:0,within:0,without:0,work:0,workflow:0,write:0,write_problem_to_textfil:0,written:0,xdsm:0,xml_declar:0,xml_file:0,xmlschema:0,xpath:0,xpath_exclud:0,xpath_includ:0,xsd:0,yet:0,you:0,your:0,zero:0,zhang:0,zip:0},titles:["Welcome to KADMOS\u2019s documentation!"],titleterms:{cmdow:0,code:0,datagraph:0,document:0,equationmixin:0,fundamentalproblemgraph:0,gener:0,graph:0,kadmo:0,kadmosgraph:0,knowledgebas:0,mdaomixin:0,mdaoprocessgraph:0,print:0,repositoryconnectivitygraph:0,string:0,util:0,vistomsmixin:0,welcom:0,xml:0}}) \ No newline at end of file diff --git a/doc_source/KADMOS.rst b/doc_source/KADMOS.rst index 0d6721f5080856020c770ae466f0043a774b101d..865dfcfa0438c9f3dba62e631ada773e7043368b 100644 --- a/doc_source/KADMOS.rst +++ b/doc_source/KADMOS.rst @@ -38,13 +38,11 @@ KadmosGraph ~~~~~~~~~~~ .. autoclass:: kadmos.graph.graph_kadmos.KadmosGraph :members: - :inherited-members: DataGraph ~~~~~~~~~ .. autoclass:: kadmos.graph.graph_data.DataGraph :members: - :inherited-members: RepositoryConnectivityGraph ~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -56,11 +54,6 @@ FundamentalProblemGraph .. autoclass:: kadmos.graph.graph_data.FundamentalProblemGraph :members: -ProcessGraph -~~~~~~~~~~~~~~~~ -.. autoclass:: kadmos.graph.graph_process.ProcessGraph - :members: - MdaoProcessGraph ~~~~~~~~~~~~~~~~ .. autoclass:: kadmos.graph.graph_process.MdaoProcessGraph diff --git a/examples/scripts/sellar_problem.py b/examples/scripts/sellar_problem.py index 45ba5038fe8c1ac2e873f21766514cb3c71c94ee..2aec097aef8d53d08f8e877635668c974b153d94 100644 --- a/examples/scripts/sellar_problem.py +++ b/examples/scripts/sellar_problem.py @@ -27,7 +27,7 @@ mdao_definitions = ['unconverged-MDA-J', # 0 # Settings for scripting mdao_definitions_loop_all = True # Option for looping through all MDAO definitions -mdao_definition_id = 13 # Option for selecting a MDAO definition (in case mdao_definitions_loop_all=False) +mdao_definition_id = 12 # Option for selecting a MDAO definition (in case mdao_definitions_loop_all=False) # Settings for saving pdf_dir = 'sellar_problem/(X)DSM' @@ -113,16 +113,17 @@ rcg.add_equation('F1', '<math xmlns="http://www.w3.org/1998/Math/MathML"><mi>x</ '<mo>+</mo><mi>z</mi><mn>2</mn><mo>+</mo><mi>y</mi><mn>1</mn><mo>+</mo><msup><mi>e</mi><mrow>' '<mo>-</mo><mi>y</mi><mn>2</mn></mrow></msup></math>', 'MathML') # Add some (optional) organization information -rcg.add_contact('Imco van Gent','i.vangent@tudelft.nl','ivangent',company='TU Delft', roles=['architect','integrator']) -rcg.add_contact('Lukas Muller','l.muller@student.tudelft.nl','lmuller',company='TU Delft', roles='architect') +rcg.add_contact('Imco van Gent', 'i.vangent@tudelft.nl', 'ivangent', company='TU Delft', roles=['architect', + 'integrator']) +rcg.add_contact('Lukas Muller', 'l.muller@student.tudelft.nl', 'lmuller', company='TU Delft', roles='architect') # Add some (optional) ranges rcg.adj['/data_schema/geometry/z1']['D1']['valid_ranges'] = {'limit_range': {'minimum': -5, 'maximum': 5.}, 'list_range': [('list_range_item', 7.5), ('list_range_item', 8)]} # Add some (optional) metadata -rcg.add_dc_general_info('F2','dummy function that is not part of the original Sellar problem') -rcg.add_dc_performance_info('F2',precision=20,fidelity_level=2,run_time=1.5) +rcg.add_dc_general_info('F2', 'dummy function that is not part of the original Sellar problem') +rcg.add_dc_performance_info('F2', precision=20, fidelity_level=2, run_time=1.5) function_order = ['A', 'D1', 'D2', 'D3', 'F1', 'F2', 'G1', 'G2'] @@ -194,19 +195,20 @@ for mdao_definition in mdao_definitions: # to allow direct execution of all different options. if mdao_architecture in ['IDF', 'MDF', 'unconverged-OPT', 'CO']: fpg.mark_as_objective('/data_schema/analyses/f') - fpg.mark_as_constraints(['/data_schema/analyses/g1','/data_schema/analyses/g2'], '>=', 0.0) - fpg.mark_as_design_variables(['/data_schema/geometry/z1','/data_schema/geometry/z2','/data_schema/geometry/x1'], - lower_bounds=[-10,0.0,0.0], upper_bounds=10, nominal_values=0.0) + fpg.mark_as_constraints(['/data_schema/analyses/g1', '/data_schema/analyses/g2'], '>=', 0.0) + fpg.mark_as_design_variables(['/data_schema/geometry/z1', '/data_schema/geometry/z2', + '/data_schema/geometry/x1'], lower_bounds=[-10, 0.0, 0.0], upper_bounds=10, + nominal_values=0.0) elif mdao_architecture in ['unconverged-MDA', 'converged-MDA']: fpg.mark_as_qois(['/data_schema/analyses/f', - '/data_schema/analyses/g1', - '/data_schema/analyses/g2', - '/data_schema/analyses/y1', - '/data_schema/analyses/y2']) + '/data_schema/analyses/g1', + '/data_schema/analyses/g2', + '/data_schema/analyses/y1', + '/data_schema/analyses/y2']) elif mdao_architecture in ['unconverged-DOE', 'converged-DOE']: fpg.mark_as_qois(['/data_schema/analyses/f', - '/data_schema/analyses/g1', - '/data_schema/analyses/g2']) + '/data_schema/analyses/g1', + '/data_schema/analyses/g2']) if fpg.graph['problem_formulation']['doe_settings']['doe_method'] == 'Custom design table': fpg.mark_as_design_variable('/data_schema/geometry/z1', samples=[0.0, 0.1, 0.5, 0.75]) fpg.mark_as_design_variable('/data_schema/geometry/z2', samples=[1.0, 1.1, 1.5, 1.75]) @@ -216,8 +218,8 @@ for mdao_definition in mdao_definitions: fpg.mark_as_design_variable('/data_schema/geometry/z2', lower_bound=0., upper_bound=10.) fpg.mark_as_design_variable('/data_schema/geometry/x1', lower_bound=0., upper_bound=10.) if mdao_architecture == 'IDF': - fpg.node['/data_schema/analyses/y1']['valid_ranges'] = {'limit_range': {'minimum': -100., 'maximum': 100.}} - fpg.node['/data_schema/analyses/y2']['valid_ranges'] = {'limit_range': {'minimum': -100., 'maximum': 100.}} + fpg.nodes['/data_schema/analyses/y1']['valid_ranges'] = {'limit_range': {'minimum': -100., 'maximum': 100.}} + fpg.nodes['/data_schema/analyses/y2']['valid_ranges'] = {'limit_range': {'minimum': -100., 'maximum': 100.}} # Search for problem roles fpg.add_function_problem_roles() @@ -242,8 +244,8 @@ for mdao_definition in mdao_definitions: mdg = fpg.get_mdg(name='mdg Sellar problem') mpg = mdg.get_mpg(name='mpg Sellar problem') mdg.graph['name'] = 'XDSM - ' + mdao_definition - mdg.graph['description'] = 'Solution strategy to solve the Sellar problem using the strategy: ' \ - + str(mdao_architecture) + ('_' + str(convergence_type) if convergence_type else '') + '.' + mdg.graph['description'] = 'Solution strategy to solve the Sellar problem using the strategy: ' + \ + str(mdao_architecture) + ('_' + str(convergence_type) if convergence_type else '') + '.' # Create a DSM visualization of the Mdao mdg.create_dsm(file_name='Mdao_'+mdao_definition, include_system_vars=True, destination_folder=pdf_dir, mpg=mpg) @@ -253,7 +255,7 @@ for mdao_definition in mdao_definitions: # Save the Mdao as kdms mdg.save('Mdao_'+mdao_definition, destination_folder=kdms_dir, mpg=mpg) # Save the Mdao as cmdows (and do an integrity check) - if mdao_architecture != 'CO': # TODO: Fix CO writing of CMDOWS w.r.t. mathematical functions. + if mdao_architecture != 'CO': # TODO: Fix CO writing of CMDOWS w.r.t. mathematical functions. mdg.save('Mdao_'+mdao_definition, file_type='cmdows', destination_folder=cmdows_dir, mpg=mpg, description='Mdao CMDOWS file of the well-known Sellar problem', diff --git a/kadmos/cmdows/cmdows.py b/kadmos/cmdows/cmdows.py index 65372a00e55502f70f6338a00052cfa0c689d746..5c5d3f0d17e5a77dfe773761334c8bb03846ded9 100644 --- a/kadmos/cmdows/cmdows.py +++ b/kadmos/cmdows/cmdows.py @@ -28,7 +28,8 @@ class CMDOWS(object): def __init__(self, file_path=None, element=None): self.SINGLE_MULTI_OPTIONS = ['single', 'multiple'] self.VERIFICATION_ELEMENTS = ['method', 'verifier', 'result', 'date', 'version'] - self.MODEL_DEFINITION_ELEMENTS = ['reference_data_set', 'analysis_method', 'fitting_method', 'relatedDesignCompetenceID', 'relatedDesignCompetenceVersion'] #CHANGE last two added. + self.MODEL_DEFINITION_ELEMENTS = ['reference_data_set', 'analysis_method', 'fitting_method', + 'relatedDesignCompetenceID', 'relatedDesignCompetenceVersion'] self.DATA_EXCHANGE_SETTINGS_ELEMENTS = ['dataserver', 'urlsite', 'web_authentication_protocol', 'context', 'folder', 'polling_time', 'max_iterations', 'time_out', 'shared_file_policy', 'servermutex'] @@ -37,6 +38,7 @@ class CMDOWS(object): self.XMLNS_PREFIX = 'https://bitbucket.org/imcovangent/cmdows/raw/master/schema/' self.XMLNS_SUFFIX = '/cmdows.xsd' if file_path: + assert os.path.isfile(file_path), 'File {} does not seem to exist.'.format(file_path) self.file = file_path if element is not None: self.root = ElementTree(element).getroot() @@ -49,14 +51,22 @@ class CMDOWS(object): nsmap={'xsi': self.XSI}) def version(self): - """Method to retrieve the version of the CMDOWS file""" + """Method to retrieve the version of the CMDOWS file + + :return: version + :rtype: str + """ url_prefix = '{http://www.w3.org/2001/XMLSchema-instance}noNamespaceSchemaLocation' version = self.root.attrib[url_prefix].split('/')[-2] version = str(version) return version def schema(self): - """Method to retrieve a schema either belonging to the CMDOWS file""" + """Method to retrieve a schema either belonging to the CMDOWS file + + :return: schema + :rtype: XMLSchema + """ version = self.version() try: url = '{}{}{}'.format(self.XMLNS_PREFIX, version, self.XMLNS_SUFFIX) @@ -81,7 +91,11 @@ class CMDOWS(object): method() def simplify_equations(self): - """Method to replace duplicate equations elements by a single equations element and refs to this element""" + """Method to replace duplicate equations elements by a single equations element and refs to this element + + :return: XML with simplified equation + :rtype: XMLSchema + """ # Make deepcopy of all equations (as some attributes are going to be deleted for the check) equations_xml = copy.deepcopy(self.root.xpath('.//equations')) # Create dictionary with all equations @@ -105,22 +119,26 @@ class CMDOWS(object): old_equations_element.getparent().replace(old_equations_element, new_equations_element) def check(self): - """Method to execute all checks""" + """Method to execute all checks and remove unused contacts + + :return: overall check result + :rtype: bool + """ result = True - #for name in dir(self): - # if name.startswith('check_'): - # method = getattr(self, name) - # result = result and method() result_uids = CMDOWS.check_uids(self) result_schema = CMDOWS.check_schema(self) result_references = CMDOWS.check_references(self) CMDOWS.remove_unused_contacts(self) - if result_uids == False or result_schema == False or result_references == False: + if not result_uids or not result_schema or not result_references: result = False return result def check_schema(self): - """Method to check if a CMDOWS file adheres to its schema""" + """Method to check if a CMDOWS file adheres to its schema + + :return: result of schema check + :rtype: bool + """ try: result = self.schema().validate(self.root) except: @@ -130,7 +148,11 @@ class CMDOWS(object): return result def check_uids(self): - """Method to check if all uIDs are actually unique in a CMDOWS file""" + """Method to check if all uIDs are actually unique in a CMDOWS file + + :return: result of unique uID check + :rtype: bool + """ ids = [element.attrib['uID'] for element in self.root.xpath('.//*[@uID]')] result = (len(ids) == len(set(ids))) if not result: @@ -139,7 +161,11 @@ class CMDOWS(object): return result def check_references(self): - """Method to check if references are actually pointing to a uID in a CMDOWS file""" + """Method to check if references are actually pointing to a uID in a CMDOWS file + + :return: result of reference check + :rtype: bool + """ ids = [element.attrib['uID'] for element in self.root.xpath('.//*[@uID]')] references = [element.text for element in self.root.xpath('.//*[contains(name(), "UID")]')] invalids = list(set([reference for reference in references if reference not in ids])) @@ -149,7 +175,11 @@ class CMDOWS(object): return result def remove_unused_contacts(self): - """Method to check if there are uID in CMDOWS file which are not refered to and remove them""" + """Method to check if there are uID in CMDOWS file which are not referred to and remove them + + :return: XML without unused uID's + :rtype: XMLSchema + """ ids = [element.attrib['uID'] for element in self.root.xpath('.//contact[@uID]')] references = [element.text for element in self.root.xpath('.//*[contains(name(), "UID")]')] invalids = list(set([id for id in ids if id not in references])) @@ -159,7 +189,13 @@ class CMDOWS(object): return def assert_element_tag(self, el, expected_tag): - """Method to assert that the tag of an element is as expected.""" + """Method to assert that the tag of an element is as expected. + + :param el: element + :rtype el: str + :param expected_tag: expected tag + :type expected_tag: str + """ if expected_tag: assert el.tag == expected_tag, 'Element should have tag {}, but has tag: {}.'.format(expected_tag, el.tag) @@ -167,21 +203,41 @@ class CMDOWS(object): # Get functions # # ----------------------------------------- # def get_inputs_uids(self, exblock_uid): - """Method to collect the inputs of a CMDOWS file executableBlock entry""" + """Method to collect the inputs of a CMDOWS file executableBlock entry + + :param exblock_uid: uid of the executableBlock entry + :type exblock_uid: basestring + :return: path to input + :rtype: xpath + """ assert self.get_element_of_uid(exblock_uid).getparent().getparent().tag == 'executableBlocks', \ 'UID ' + exblock_uid + ' does not seem to refer to an executableBlock.' xpath = self.get_xpath_of_uid(exblock_uid) return self.root.xpath(xpath + '/inputs/input/parameterUID/text()') def get_outputs_uids(self, exblock_uid): - """Method to collect the outputs of a CMDOWS file executableBlock entry""" + """Method to collect the outputs of a CMDOWS file executableBlock entry + + :param exblock_uid: executableBlock entry + :type exblock_uid: basestring + :return: path to output + :rtype: xpath + """ assert self.get_element_of_uid(exblock_uid).getparent().getparent().tag == 'executableBlocks', \ 'UID ' + exblock_uid + ' does not seem to refer to an executableBlock.' xpath = self.get_xpath_of_uid(exblock_uid) return self.root.xpath(xpath + '/outputs/output/parameterUID/text()') def get_element_of_uid(self, uid, expected_tag=None): - """Method to get the element based on a UID value.""" + """Method to get the element based on a UID value. + + :param uid: uID of element + :type uid: basestring + :param expected_tag: (optional) expected tag + :type expected_tag: str + :return: element + :rtype: str + """ xpath_expression = get_uid_search_xpath(uid) els = self.root.xpath(xpath_expression) if len(els) > 1: @@ -193,12 +249,25 @@ class CMDOWS(object): return els[0] def get_xpath_of_uid(self, uid, expected_tag=None): - """Method to get the xpath based on a UID value.""" + """Method to get the xpath based on a UID value. + + :param uid: uID of xpath + :type uid: basestring + :param expected_tag: (optional) expected_tag + :type expected_tag: str + :return: xpath of element + :rtype: xpath + """ + el = self.get_element_of_uid(uid, expected_tag=None) return el.getroottree().getpath(el) def get_executable_blocks_uids(self): - """Method to get a list of all the executable block UIDs present in the file.""" + """Method to get a list of all the executable block UIDs present in the file. + + :return: executable blocks uIDs + :rtype: list + """ uid_list = [] # First collect the executable blocks from the main element el = self.root.xpath('/cmdows/executableBlocks') @@ -219,12 +288,18 @@ class CMDOWS(object): try: uid_list.append(arblock.attrib['uID']) except: - if arblock_type.tag in ['coordinators', 'optimizers', 'convergers', 'consistencyConstraintFunctions']: - raise AttributeError('Could not find the uID attribute for this element: {}.'.format(arblock)) + if arblock_type.tag in ['coordinators', 'optimizers', 'convergers', + 'consistencyConstraintFunctions']: + raise AttributeError('Could not find the uID attribute for this element: ' + '{}.'.format(arblock)) return uid_list def get_parameters_uids(self): - """Method to get a list of all the parameter UIDs present in the file.""" + """Method to get a list of all the parameter UIDs present in the file. + + :return: parameter uIDs + :rtype: list + """ uid_list = [] # First collect the parameters from the main element el = self.root.xpath('/cmdows/parameters') @@ -248,7 +323,11 @@ class CMDOWS(object): return uid_list def get_design_competences_uids(self): - """Method to get a list of all the design competences UIDs present in the file.""" + """Method to get a list of all the design competences UIDs present in the file. + + :return: design competence uIDs + :rtype: list + """ uid_list = [] el = self.root.xpath('/cmdows/executableBlocks/designCompetences') assert len(el) <= 1, '"/cmdows/executableBlocks/designCompetences" is not a unique XPath. ' \ @@ -262,7 +341,11 @@ class CMDOWS(object): return uid_list def get_mathematical_functions_uids(self): - """Method to get a list of all the mathematical functions UIDs present in the file.""" + """Method to get a list of all the mathematical functions UIDs present in the file. + + :return: mathematical functions uIDs + :rtype: list + """ uid_list = [] el = self.root.xpath('/cmdows/executableBlocks/mathematicalFunctions') assert len(el) <= 1, '"/cmdows/executableBlocks/mathematicalFunctions" is not a unique XPath. ' \ @@ -276,7 +359,11 @@ class CMDOWS(object): return uid_list def get_used_parameter_uids(self): - """Method to get a list of all the parameter UIDs used in the file.""" + """Method to get a list of all the parameter UIDs used in the file. + + :return: parameter uIDs + :rtype: list + """ uid_list = [] el = self.root.xpath('/cmdows/executableBlocks/mathematicalFunctions') assert len(el) <= 1, '"/cmdows/executableBlocks/mathematicalFunctions" is not a unique XPath. ' \ @@ -293,7 +380,21 @@ class CMDOWS(object): # Add / change file functions # # ----------------------------------------- # def add_header(self, creator, description, timestamp=None, fileVersion="0.0", cmdowsVersion="0.7"): - """Method to add a header to a CMDOWS file.""" + """Method to add a header to a CMDOWS file. + + :param creator: name of creator + :type creator: str + :param description: description of file content + :type description: str + :param timestamp: (optional) date and time of creation + :type timestamp: datetime + :param fileVersion: version of the file + :type fileVersion: str + :param cmdowsVersion: version of the xsd schema + :type cmdowsVersion: str + :return: XML with header + :rtype: XMLSchema + """ # Assert header element exists el = self.ensure_abs_xpath('/cmdows/header') @@ -306,8 +407,41 @@ class CMDOWS(object): el.add("cmdowsVersion", cmdowsVersion) return - def add_contact(self, name, email, uid, company=None, department=None, function=None, address=None, telephone=None, country=None, roles=None): - """Method to add a contact element to the organization branch.""" + def add_contact(self, name, email, uid, company=None, department=None, function=None, address=None, telephone=None, + country=None, roles=None): + """Method to add a contact element to the organization branch. + + :param name: contact name + :type name: str + :param email: contact email + :type email: str + :param uid: contact uID + :type uid: basestring + :param company: (optional) contact company + :type company: str + :param department: (optional) company department + :type department: str + :param function: (optional) contact function + :type function: str + :param address: (optional) contact address + :type address: str + :param telephone: (optional) contact telephone number + :type telephone: str + :param country: (optional) contact country + :type country: str + :param roles: contact roles in project + :type roles: list, str + :return: XML with contact + :rtype: XMLSchema + + .. note:: Role options are: + + * 'architect' + * 'integrator' + * 'collaborative_engineer' + * 'tool_specialist' + * 'customer' + """ # Assert that there is a path to the contacts element or add one parent_element = self.ensure_abs_xpath('/cmdows/header/organization/contacts') @@ -315,7 +449,8 @@ class CMDOWS(object): # Assert that there is no existing element with the uid try: self.get_element_of_uid(uid) - raise AssertionError('UID {} is already used in the CMDOWS file at {}'.format(uid, self.get_xpath_of_uid(uid))) + raise AssertionError('UID {} is already used in the CMDOWS file at {}'.format(uid, + self.get_xpath_of_uid(uid))) except: pass @@ -342,7 +477,23 @@ class CMDOWS(object): return def add_dc(self, uid, id, mode_id, instance_id, version, label): - """Method to add a designCompetence element to the designCompetences branch.""" + """Method to add a designCompetence element to the designCompetences branch. + + :param uid: designCompetence uID + :type uid: basestring + :param id: designCompetence ID + :type id: str + :param mode_id: designCompetence mode + :type mode_id: str + :param instance_id: designCompetence instance + :type instance_id: int + :param version: designCompetence instance + :type version: str + :param label: designCompetence label + :type label: str + :return: XML with designCompetence + :rtype: XMLSchema + """ # Assert that there is a path to the designCompetences element or add one parent_element = self.ensure_abs_xpath('/cmdows/executableBlocks/designCompetences') @@ -359,7 +510,7 @@ class CMDOWS(object): dc_element = Element('designCompetence', uID=uid) if instance_id > 1: dc_element.add('instanceID', instance_id) - dc_element.add('relatedInstanceUID', "x")#CHANGE: when instance+1? deploy() in __init__.py? how to relate + dc_element.add('relatedInstanceUID', "x") #CHANGE: when instance+1? deploy() in __init__.py? how to relate else: dc_element.add('ID', id) dc_element.add('modeID', mode_id) @@ -372,7 +523,19 @@ class CMDOWS(object): return def add_element_to_element_of_uid(self, uid, element_to_add, expected_tag_uid_el=None, expected_tag_new_el=None): - """Generic method to add a subelement to an element with a certain UID.""" + """Generic method to add a subelement to an element with a certain UID. + + :param uid: uID of element to be added to + :type uid: basestring + :param element_to_add: subelement to be added + :type element_to_add: str + :param expected_tag_uid_el: expected tag of element + :type expected_tag_uid_el: str + :param expected_tag_new_el: expected tag of subelement + :type expected_tag_new_el: str + :return: XML with subelement + :rtype: XMLSchema + """ # Assert that there is a UID element xpath = self.get_xpath_of_uid(uid, expected_tag=expected_tag_uid_el) @@ -389,18 +552,54 @@ class CMDOWS(object): return def add_dc_inputs_element(self, dc_uid, inputs_element): - """Method to add a inputs element to a DC element.""" + """Method to add a input element to a DC element. + + :param dc_uid: designCompetence uID + :type dc_uid: basestring + :param inputs_element: input element to be added + :type inputs_element: str + :return: XML with input element + :rtype: XMLSchema + """ self.add_element_to_element_of_uid(dc_uid, inputs_element, 'designCompetence', 'inputs') return def add_dc_outputs_element(self, dc_uid, outputs_element): - """Method to add a outputs element to a DC element.""" + """Method to add a output element to a DC element. + + :param dc_uid: designCompetence uID + :type dc_uid: basestring + :param outputs_element: output element to be added + :type outputs_element: str + :return: XML with output element + :rtype: XMLSchema + """ self.add_element_to_element_of_uid(dc_uid, outputs_element, 'designCompetence', 'outputs') return - def add_dc_general_info(self, dc_uid, description, status=None, creation_date=None, owner_uid=None, creator_uid=None, - operator_uid=None, model_definition=None): - """Method to add a general info element to a dc branch.""" + def add_dc_general_info(self, dc_uid, description, status=None, creation_date=None, owner_uid=None, + creator_uid=None, operator_uid=None, model_definition=None): + """Method to add a general info element to a DC branch. + + :param dc_uid: designCompetence uID + :type dc_uid: basestring + :param description: designCompetence description + :type description: str + :param status: (optional) designCompetence status + :type status: str + :param creation_date: (optional) designCompetence creation date + :type creation_date: datetime + :param owner_uid: (optional) designCompetence owner uID + :type owner_uid: basestring + :param creator_uid: (optional) designCompetence creator uID + :type creator_uid: basestring + :param operator_uid: (optional) designCompetence operator uID + :type operator_uid: basestring + :param model_definition: (optional) designCompetence model definition + :type model_definition: str + :return: XML with general info + :rtype: XMLSchema + """ # if instance is higher than 1 the metadata should not be added. # Assert that there is a DC element xpath = self.get_xpath_of_uid(dc_uid, expected_tag='designCompetence') @@ -467,7 +666,29 @@ class CMDOWS(object): return def add_dc_performance_info(self, dc_uid, precision=None, fidelity_level=None, run_time=None, verification=None): - """Method to add a performance info element to a DC branch.""" + """Method to add a performance info element to a DC branch. + + :param dc_uid: designCompetence uID + :type dc_uid: basestring + :param precision: (optional) designCompetence precision + :type precision: float + :param fidelity_level: (optional) designCompetence fidelity level + :type fidelity_level: int + :param run_time: (optional) designCompetence run time + :type run_time: float + :param verification: designCompetence verification method + :type verification: dict + :return: XML with performance info + :rtype: XMLSchema + + .. note:: the verification dict should contain the following keys: + + * 'method' (str) + * 'verifier' (uid) + * 'result' (str) + * 'date' (datetime) + * 'version' (str) + """ # if instance is higher than 1 the metadata should not be added. # Assert that there is a DC element @@ -502,7 +723,22 @@ class CMDOWS(object): return def add_dc_verification(self, dc_uid, method, verifier, result, date, version): - """Method to add a verification to a DC""" + """Method to add a verification to a DC branch. + + :param dc_uid: designCompetence uID + :type dc_uid: basestring + :param method: verification method + :type method: str + :param verifier: verifier uID + :type verifier: basestring + :param result: verification result + :type result: str + :param date: verification date + :type date: datetime + :param version: designCompetence uID that was verified + :return: XML with verification added to DC + :rtype: XMLSchema + """ # Assert that there is a DC element xpath = self.get_xpath_of_uid(dc_uid, expected_tag='designCompetence') @@ -516,7 +752,7 @@ class CMDOWS(object): # Find verifications element verification_element = Element('verification') verification_element.add('method', method) - verification_element.add('verifier', {'contactUID' : verifier}, camel_case_conversion=False) + verification_element.add('verifier', {'contactUID': verifier}, camel_case_conversion=False) verification_element.add('result', result) verification_element.add('date', date) verification_element.add('version', version) @@ -533,7 +769,9 @@ class CMDOWS(object): xpath = self.get_xpath_of_uid(dc_uid, expected_tag='designCompetence') # Assert the single/multi input - assert single_or_multi_execution in self.SINGLE_MULTI_OPTIONS, 'single_or_multi_execution should be either {}, now is {}'.format(self.SINGLE_MULTI_OPTIONS, single_or_multi_execution) + assert single_or_multi_execution in self.SINGLE_MULTI_OPTIONS, \ + 'single_or_multi_execution should be either {}, now is ' \ + '{}'.format(self.SINGLE_MULTI_OPTIONS, single_or_multi_execution) # Assert the remote_engineer is a contact self.get_element_of_uid(remote_engineer, expected_tag='contact') @@ -750,12 +988,14 @@ class CMDOWS(object): assert role in ['architect', 'integrator', 'collaborativeEngineer', 'toolSpecialist', 'customer'], 'Role {} does not exist.'.format(role) # Remove actor if found - self.remove_element_based_on_xpath('/cmdows/header/organization/organigram/' + role + 's/' + role + '/contactUID', expected_text=uid, higher_level_removal=1) + self.remove_element_based_on_xpath('/cmdows/header/organization/organigram/' + role + 's/' + role + + '/contactUID', expected_text=uid, higher_level_removal=1) # Remove parent element if empty els = self.root.xpath('/cmdows/header/organization/organigram/' + role + 's/' + role) if not els: - self.remove_element_based_on_xpath('/cmdows/header/organization/organigram/' + role + 's', expected_amount=1) + self.remove_element_based_on_xpath('/cmdows/header/organization/organigram/' + role + 's', + expected_amount=1) # ----------------------------------------- # # Export functions # diff --git a/kadmos/cmdows/schemas/0.8/cmdows.xsd b/kadmos/cmdows/schemas/0.8/cmdows.xsd index 0c76d6823b10e7d3786903e012346db49239df87..84271528da29140150e8df950ecec7f970ecc2bc 100644 --- a/kadmos/cmdows/schemas/0.8/cmdows.xsd +++ b/kadmos/cmdows/schemas/0.8/cmdows.xsd @@ -202,7 +202,7 @@ </xs:annotation> </xs:element> <xs:element name="instanceID" type="xs:string"/> - <xs:element name="relatedInstanceUID" type="xs:string"> + <xs:element name="relatedInstanceUID" type="xs:string" minOccurs="0"> <xs:annotation> <xs:documentation>Element used to refer to the first instance if a certain DC has instanceID>1. modeID, ID and metadata are not stored in this case.</xs:documentation> </xs:annotation> @@ -930,7 +930,7 @@ <xs:element name="optimizer" maxOccurs="unbounded"> <xs:complexType> <xs:complexContent> - <xs:extension base="simpleArchitectureElementsBlockType"> + <xs:extension base="optimizerType"> <xs:sequence> <xs:element name="designVariables" minOccurs="0"> <xs:complexType> @@ -982,7 +982,7 @@ <xs:element name="convergers" minOccurs="0"> <xs:complexType> <xs:sequence> - <xs:element name="converger" type="simpleArchitectureElementsBlockType" maxOccurs="unbounded"/> + <xs:element name="converger" type="convergerType" maxOccurs="unbounded"/> </xs:sequence> </xs:complexType> </xs:element> @@ -1019,9 +1019,9 @@ </xs:sequence> </xs:complexType> </xs:element> - <xs:element name="doeMethod" type="xs:string"/> - <xs:element name="doeRuns" type="xs:integer"/> - <xs:element name="doeSeed" type="xs:integer"/> + <xs:element name="doeMethod" type="xs:string" minOccurs="0"/> + <xs:element name="doeRuns" type="xs:integer" minOccurs="0"/> + <xs:element name="doeSeed" type="xs:integer" minOccurs="0"/> </xs:all> </xs:complexType> </xs:element> @@ -1228,30 +1228,52 @@ <xs:complexType name="simpleArchitectureElementsVariableType"> <xs:sequence> <xs:element name="relatedParameterUID" type="xs:string"/> - <xs:element name="relatedInstanceUID" type="xs:string"/> <xs:element name="label" type="xs:string"/> - <xs:element name="instanceID" type="xs:int"/> + <xs:choice> + <xs:element name="relatedInstanceUID" type="xs:string"/> + <xs:element name="instanceID" type="xs:int"/> + </xs:choice> + </xs:sequence> + <xs:attribute name="uID" type="xs:string"/> + </xs:complexType> + <xs:complexType name="convergerType"> + <xs:sequence> + <xs:element name="label" type="xs:string" minOccurs="0"/> + <xs:element name="settings" minOccurs="0"> + <xs:complexType> + <xs:sequence> + <xs:element name="lastIterationsToConsider" type="xs:float"/> + <xs:element name="maximumIterations" type="xs:float"/> + <xs:element name="convergenceToleranceRelative" type="xs:float"/> + <xs:element name="convergenceToleranceAbsolute" type="xs:float"/> + </xs:sequence> + </xs:complexType> + </xs:element> </xs:sequence> <xs:attribute name="uID" type="xs:string"/> </xs:complexType> - <xs:complexType name="simpleArchitectureElementsBlockType"> + <xs:complexType name="optimizerType"> <xs:sequence> - <xs:element name="label" type="xs:string" /> + <xs:element name="label" type="xs:string" minOccurs="0"/> <xs:element name="settings" minOccurs="0"> <xs:complexType> <xs:sequence> - <xs:element name="lastIterationsToConsider" type="xs:decimal"/> - <xs:element name="maximumIterations" type="xs:decimal"/> + <xs:element name="maximumIterations" type="xs:float"/> <xs:element name="algorithm" type="xs:string"/> <xs:element name="applyScaling" type="xs:boolean"/> - <xs:element name="maximumFunctionEvaluations" type="xs:decimal"/> - <xs:element name="constraintTolerance" type="xs:decimal"/> - <xs:element name="convergenceTolerance" type="xs:decimal"/> - <xs:element name="convergenceToleranceRelative" type="xs:decimal"/> - <xs:element name="convergenceToleranceAbsolute" type="xs:decimal"/> + <xs:element name="maximumFunctionEvaluations" type="xs:float"/> + <xs:element name="constraintTolerance" type="xs:float"/> + <xs:element name="convergenceTolerance" type="xs:float"/> </xs:sequence> </xs:complexType> - </xs:element> + </xs:element> + </xs:sequence> + <xs:attribute name="uID" type="xs:string"/> + </xs:complexType> + <xs:complexType name="simpleArchitectureElementsBlockType"> + <xs:sequence> + <xs:element name="label" type="xs:string"/> + <xs:element name="settings" type="xs:string" minOccurs="0"/> </xs:sequence> <xs:attribute name="uID" type="xs:string"/> </xs:complexType> diff --git a/kadmos/cmdows/schemas/cmdows.xsd b/kadmos/cmdows/schemas/cmdows.xsd deleted file mode 100644 index 5f1d2fcb1b99307345f0be65993912ac158cacc3..0000000000000000000000000000000000000000 --- a/kadmos/cmdows/schemas/cmdows.xsd +++ /dev/null @@ -1,1269 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified"> - <xs:element name="cmdows"> - <xs:complexType> - <xs:sequence> - <xs:element name="header"> - <xs:complexType> - <xs:sequence> - <xs:element name="creator" type="xs:string"> - <xs:annotation> - <xs:documentation>Creator of the initial CMDOWS dataset </xs:documentation> - </xs:annotation> - </xs:element> - <xs:element name="description" type="xs:string"> - <xs:annotation> - <xs:documentation>Description of the initial CMDOWS dataset</xs:documentation> - </xs:annotation> - </xs:element> - <xs:element name="timestamp" type="xs:dateTime"> - <xs:annotation> - <xs:documentation>Timestamp of the initial CMDOWS dataset creation </xs:documentation> - </xs:annotation> - </xs:element> - <xs:element name="fileVersion" type="xs:string"> - <xs:annotation> - <xs:documentation>Version of the initial CMDOWS dataset</xs:documentation> - </xs:annotation> - </xs:element> - <xs:element name="cmdowsVersion" type="xs:string"> - <xs:annotation> - <xs:documentation>Version of the CMDOWS schema that the initial CMDOWS dataset adheres to </xs:documentation> - </xs:annotation> - </xs:element> - <xs:element name="updates" minOccurs="0"> - <xs:complexType> - <xs:sequence> - <xs:element name="update" maxOccurs="unbounded"> - <xs:complexType> - <xs:sequence> - <xs:element name="modification" type="xs:string"> - <xs:annotation> - <xs:documentation>Description of the modification to the CMDOWS dataset</xs:documentation> - </xs:annotation> - </xs:element> - <xs:element name="creator" type="xs:string"> - <xs:annotation> - <xs:documentation>Creator of the modification to the CMDOWS dataset</xs:documentation> - </xs:annotation> - </xs:element> - <xs:element name="timestamp" type="xs:dateTime"> - <xs:annotation> - <xs:documentation>Timestamp of the modification to the CMDOWS dataset</xs:documentation> - </xs:annotation> - </xs:element> - <xs:element name="fileVersion" type="xs:string"> - <xs:annotation> - <xs:documentation>Version of the modification to the CMDOWS dataset</xs:documentation> - </xs:annotation> - </xs:element> - <xs:element name="cmdowsVersion" type="xs:string"> - <xs:annotation> - <xs:documentation>Version of the CMDOWS schema that the modification to the CMDOWS dataset adheres to </xs:documentation> - </xs:annotation> - </xs:element> - </xs:sequence> - </xs:complexType> - </xs:element> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="organization" minOccurs="0"> - <xs:complexType> - <xs:sequence> - <xs:element name="contacts"> - <xs:complexType> - <xs:sequence> - <xs:element name="contact" maxOccurs="unbounded"> - <xs:complexType> - <xs:all> - <xs:element name="name" type="xs:string"> - <xs:annotation> - <xs:documentation>Name of the contact person</xs:documentation> - </xs:annotation> - </xs:element> - <xs:element name="email" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:documentation>E-Mail address of the contact person</xs:documentation> - </xs:annotation> - </xs:element> - <xs:element name="company" minOccurs="0"/> - <xs:element name="department" minOccurs="0"/> - <xs:element name="function" type="xs:string" minOccurs="0"/> - <xs:element name="address" type="xs:string" minOccurs="0"/> - <xs:element name="telephone" type="xs:string" minOccurs="0"/> - <xs:element name="country" type="xs:string" minOccurs="0"/> - </xs:all> - <xs:attribute name="uID" type="xs:string" use="optional"> - <xs:annotation> - <xs:documentation>Unique ID of the contact which can be used as reference in order to avoid having the same contact twice in the document</xs:documentation> - </xs:annotation> - </xs:attribute> - </xs:complexType> - </xs:element> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="organigram" minOccurs="0"> - <xs:complexType> - <xs:all> - <xs:element name="architects" minOccurs="0"> - <xs:complexType> - <xs:sequence> - <xs:element name="architect" maxOccurs="unbounded"> - <xs:complexType> - <xs:sequence> - <xs:element name="contactUID"/> - </xs:sequence> - </xs:complexType> - </xs:element> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="integrators" minOccurs="0"> - <xs:complexType> - <xs:sequence> - <xs:element name="integrator" maxOccurs="unbounded"> - <xs:complexType> - <xs:sequence> - <xs:element name="contactUID"/> - </xs:sequence> - </xs:complexType> - </xs:element> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="collaborativeEngineers" minOccurs="0"> - <xs:complexType> - <xs:sequence> - <xs:element name="collaborativeEngineer" maxOccurs="unbounded"> - <xs:complexType> - <xs:sequence> - <xs:element name="contactUID"/> - </xs:sequence> - </xs:complexType> - </xs:element> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="toolSpecialists" minOccurs="0"> - <xs:complexType> - <xs:sequence> - <xs:element name="toolSpecialist" maxOccurs="unbounded"> - <xs:complexType> - <xs:sequence> - <xs:element name="contactUID"/> - </xs:sequence> - </xs:complexType> - </xs:element> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="customers" minOccurs="0"> - <xs:complexType> - <xs:sequence> - <xs:element name="customer" maxOccurs="unbounded"> - <xs:complexType> - <xs:sequence> - <xs:element name="contactUID" type="xs:string"/> - </xs:sequence> - </xs:complexType> - </xs:element> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="projectSpecific" type="xs:anyType" minOccurs="0"/> - </xs:all> - </xs:complexType> - </xs:element> - </xs:sequence> - </xs:complexType> - </xs:element> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="executableBlocks"> - <xs:complexType> - <xs:all> - <xs:element name="designCompetences" minOccurs="0"> - <xs:complexType> - <xs:sequence> - <xs:element name="designCompetence" maxOccurs="unbounded"> - <xs:complexType> - <xs:sequence> - <xs:element name="ID" type="xs:string"> - <xs:annotation> - <xs:documentation>Identifier of the tool to be executed</xs:documentation> - </xs:annotation> - </xs:element> - <xs:element name="modeID" type="xs:string"> - <xs:annotation> - <xs:documentation>Identifier of the tool mode to be executed (as a tool can usually be executed in different modes)</xs:documentation> - </xs:annotation> - </xs:element> - <xs:element name="instanceID" type="xs:string"/> - <xs:element name="relatedInstanceUID" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:documentation>Element used to refer to the first instance if a certain DC has instanceID>1. modeID, ID and metadata are not stored in this case.</xs:documentation> - </xs:annotation> - </xs:element> - <xs:element name="version" type="xs:string"/> - <xs:element name="label" type="xs:string"> - <xs:annotation> - <xs:documentation>Label of the design competence which can be used for clean printouts (e.g. 'F')</xs:documentation> - </xs:annotation> - </xs:element> - <xs:element name="inputs"> - <xs:complexType> - <xs:sequence> - <xs:element name="input" maxOccurs="unbounded"> - <xs:complexType> - <xs:complexContent> - <xs:extension base="inoutType"> - <xs:sequence> - <xs:element name="validRanges" type="rangeType" minOccurs="0"/> - </xs:sequence> - </xs:extension> - </xs:complexContent> - </xs:complexType> - </xs:element> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="outputs" type="outputsType"/> - <xs:element name="metadata" minOccurs="0"> - <xs:complexType> - <xs:sequence> - <xs:element name="generalInfo" minOccurs="0"> - <xs:complexType> - <xs:all> - <xs:element name="description" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:documentation>Description of the design competence</xs:documentation> - </xs:annotation> - </xs:element> - <xs:element name="status" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:documentation>Describing the state of the design competence, e.g. draft, final, for verification, ...</xs:documentation> - </xs:annotation> - </xs:element> - <xs:element name="creationDate" type="xs:date" minOccurs="0"/> - <xs:element name="owner" type="contactType" minOccurs="0"> - <xs:annotation> - <xs:documentation>Owner(s) of the design competence</xs:documentation> - </xs:annotation> - </xs:element> - <xs:element name="creator" type="contactType" minOccurs="0"> - <xs:annotation> - <xs:documentation>Creator(s) of the design competence</xs:documentation> - </xs:annotation> - </xs:element> - <xs:element name="operator" type="contactType" minOccurs="0"> - <xs:annotation> - <xs:documentation>Operator(s) of the design competence to be contacted in case of problems</xs:documentation> - </xs:annotation> - </xs:element> - <xs:element name="modelDefinition" minOccurs="0"> - <xs:annotation> - <xs:documentation>Optional element for 'surrogateModel' competence types</xs:documentation> - </xs:annotation> - <xs:complexType> - <xs:all> - <xs:element name="referenceDataSet" type="xs:string" minOccurs="0"/> - <xs:element name="analysisMethod" type="xs:string" minOccurs="0"/> - <xs:element name="fittingMethod" type="xs:string" minOccurs="0"/> - <xs:element name="relatedDesignCompetenceID" type="xs:string" minOccurs="0"/> - <xs:element name="relatedDesignCompetenceVersion" type="xs:string" minOccurs="0"/> - </xs:all> - </xs:complexType> - </xs:element> - </xs:all> - </xs:complexType> - </xs:element> - <xs:element name="performanceInfo" minOccurs="0"> - <xs:complexType> - <xs:all> - <xs:element name="precision" type="xs:decimal" minOccurs="0"/> - <xs:element name="fidelityLevel" type="xs:decimal" minOccurs="0"/> - <xs:element name="runTime" type="xs:decimal" minOccurs="0"/> - <xs:element name="standardDeviation" type="xs:decimal" minOccurs="0"/> - <xs:element name="verifications" minOccurs="0"> - <xs:complexType> - <xs:sequence> - <xs:element name="verification" maxOccurs="unbounded"> - <xs:complexType> - <xs:all> - <xs:element name="method" type="xs:string"/> - <xs:element name="verifier" type="contactType"/> - <xs:element name="result" type="xs:string"/> - <xs:element name="date" type="xs:date"/> - <xs:element name="version" type="xs:string"/> - </xs:all> - </xs:complexType> - </xs:element> - </xs:sequence> - </xs:complexType> - </xs:element> - </xs:all> - </xs:complexType> - </xs:element> - <xs:element name="executionInfo" minOccurs="0"> - <xs:complexType> - <xs:all> - <xs:element name="availabilityConstraints" minOccurs="0"> - <xs:complexType> - <xs:all> - <xs:element name="fromDate" type="xs:date" minOccurs="0"/> - <xs:element name="toDate" type="xs:date" minOccurs="0"/> - <xs:element name="fromOfficeHour" type="xs:time" minOccurs="0"/> - <xs:element name="toOfficeHour" type="xs:time" minOccurs="0"/> - <xs:element name="maximumTotalExecutions" type="xs:int" minOccurs="0"/> - <xs:element name="maximumParallelExecutions" type="xs:int" minOccurs="0"/> - </xs:all> - </xs:complexType> - </xs:element> - <xs:element name="authorizationConstraints" minOccurs="0"> - <xs:complexType> - <xs:all> - <xs:element name="authorizedUsers" minOccurs="0"> - <xs:complexType> - <xs:sequence> - <xs:element name="authorizedUser" type="contactType" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="unauthorizedUsers" minOccurs="0"> - <xs:complexType> - <xs:sequence> - <xs:element name="unauthorizedUser" type="contactType" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - </xs:all> - </xs:complexType> - </xs:element> - <xs:element name="remoteComponentInfo" minOccurs="0"> - <xs:complexType> - <xs:all> - <xs:element name="jobSettings" minOccurs="0"> - <xs:complexType> - <xs:all> - <xs:element name="singleOrMultiExecution" minOccurs="0"> - <xs:simpleType> - <xs:restriction base="xs:string"> - <xs:enumeration value="single"/> - <xs:enumeration value="multiple"/> - </xs:restriction> - </xs:simpleType> - </xs:element> - <xs:element name="jobName" type="xs:string" minOccurs="0"/> - <xs:element name="remoteEngineer" type="contactType" minOccurs="0"/> - <xs:element name="notificationMessage" type="xs:string" minOccurs="0"/> - </xs:all> - </xs:complexType> - </xs:element> - <xs:element name="dataExchangeSettings" minOccurs="0"> - <xs:complexType> - <xs:all> - <xs:element name="dataserver" type="xs:string" minOccurs="0"/> - <xs:element name="urlsite" type="xs:string" minOccurs="0"/> - <xs:element name="webAuthenticationProtocol" type="xs:string" minOccurs="0"/> - <xs:element name="context" type="xs:string" minOccurs="0"/> - <xs:element name="folder" type="xs:string" minOccurs="0"/> - <xs:element name="pollingTime" type="xs:float" minOccurs="0"/> - <xs:element name="maxIterations" type="xs:int" minOccurs="0"/> - <xs:element name="timeOut" type="xs:float" minOccurs="0"/> - <xs:element name="sharedFilePolicy" type="xs:string" minOccurs="0"/> - <xs:element name="servermutex" type="xs:string" minOccurs="0"/> - </xs:all> - </xs:complexType> - </xs:element> - </xs:all> - </xs:complexType> - </xs:element> - </xs:all> - </xs:complexType> - </xs:element> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="projectSpecific" type="xs:anyType" minOccurs="0"> - <xs:annotation> - <xs:documentation>Free element containing any project specific information (e.g. for RCE or Optimus).</xs:documentation> - </xs:annotation> - </xs:element> - </xs:sequence> - <xs:attribute name="uID" type="xs:string" use="required"> - <xs:annotation> - <xs:documentation>Unique ID of the design competence which can be used as reference in the problem definition etc. By convention this identifier should be of the following form ID[modeID][instanceID][version]</xs:documentation> - </xs:annotation> - </xs:attribute> - </xs:complexType> - </xs:element> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="mathematicalFunctions" minOccurs="0"> - <xs:complexType> - <xs:sequence> - <xs:element name="mathematicalFunction" maxOccurs="unbounded"> - <xs:complexType> - <xs:sequence> - <xs:element name="label" type="xs:string"> - <xs:annotation> - <xs:documentation>Name of the function which can be used for clean printouts (e.g. 'G')</xs:documentation> - </xs:annotation> - </xs:element> - <xs:element name="functionType"> - <xs:simpleType> - <xs:restriction base="xs:string"> - <xs:enumeration value="regular"/> - <xs:enumeration value="consistency"/> - </xs:restriction> - </xs:simpleType> - </xs:element> - <xs:element name="inputs"> - <xs:complexType> - <xs:sequence> - <xs:element name="input" maxOccurs="unbounded"> - <xs:complexType> - <xs:complexContent> - <xs:extension base="inoutType"> - <xs:sequence> - <xs:element name="equationLabel" minOccurs="0"> - <xs:simpleType> - <xs:list itemType="xs:string"/> - </xs:simpleType> - </xs:element> - <xs:element name="validRanges" type="rangeType" minOccurs="0"/> - </xs:sequence> - </xs:extension> - </xs:complexContent> - </xs:complexType> - </xs:element> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="outputs"> - <xs:complexType> - <xs:sequence> - <xs:element name="output" maxOccurs="unbounded"> - <xs:complexType> - <xs:complexContent> - <xs:extension base="inoutType"> - <xs:sequence> - <xs:choice> - <xs:element name="equations" type="equationsType"> - <xs:annotation> - <xs:documentation>A mathematical function output can be defined by mulitple equivalent equations in different languages</xs:documentation> - </xs:annotation> - </xs:element> - <xs:element name="equationsUID" type="xs:string"> - <xs:annotation> - <xs:documentation>A mathematical function output can also be defined by a reference to another group of equivalent equations in different languages</xs:documentation> - </xs:annotation> - </xs:element> - </xs:choice> - </xs:sequence> - </xs:extension> - </xs:complexContent> - </xs:complexType> - </xs:element> - </xs:sequence> - </xs:complexType> - </xs:element> - </xs:sequence> - <xs:attribute name="uID" type="xs:string" use="required"> - <xs:annotation> - <xs:documentation>Unique ID of the function which can be used as reference in the problem definition etc. (e.g. 'G')</xs:documentation> - </xs:annotation> - </xs:attribute> - </xs:complexType> - </xs:element> - </xs:sequence> - </xs:complexType> - </xs:element> - </xs:all> - </xs:complexType> - </xs:element> - <xs:element name="parameters"> - <xs:complexType> - <xs:sequence> - <xs:element name="parameter" maxOccurs="unbounded"> - <xs:complexType> - <xs:all> - <xs:element name="label" type="xs:string"> - <xs:annotation> - <xs:documentation>Label of the parameter which can be used for clean printouts (e.g. 'y1')</xs:documentation> - </xs:annotation> - </xs:element> - <xs:element name="description" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:documentation>Detailed description of the parameter</xs:documentation> - </xs:annotation> - </xs:element> - <xs:element name="schemaPath" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:documentation>The path of the parameter which is only saved when instanceID is 1.</xs:documentation> - </xs:annotation> - </xs:element> - <xs:element name="relatedInstanceUID" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:documentation>In case instanceID is higher than 1 the parameter is only referenced to the first instance of the parameter.</xs:documentation> - </xs:annotation> - </xs:element> - <xs:element name="InstanceID" type="xs:int" minOccurs="0"> - <xs:annotation> - <xs:documentation>The instance of the parameter determines way in which it is referenced and what information is saved.</xs:documentation> - </xs:annotation> - </xs:element> - <xs:element name="note" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:documentation>Any additional note for the parameter</xs:documentation> - </xs:annotation> - </xs:element> - <xs:element name="unit" type="xs:string" minOccurs="0"/> - <xs:element name="dataType" type="xs:string" minOccurs="0"/> - </xs:all> - <xs:attribute name="uID" type="xs:string" use="required"> - <xs:annotation> - <xs:documentation>Unique ID of the parameter which can be used as reference in the problem definition etc. (e.g. '/data_schema/analyses/y1')</xs:documentation> - </xs:annotation> - </xs:attribute> - </xs:complexType> - </xs:element> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="problemDefinition" minOccurs="0"> - <xs:complexType> - <xs:all> - <xs:element name="problemFormulation"> - <xs:complexType> - <xs:all> - <xs:element name="mdaoArchitecture" type="xs:string"/> - <xs:element name="convergerType" type="xs:string" minOccurs="0"/> - <xs:element name="executableBlocksOrder"> - <xs:complexType> - <xs:sequence> - <xs:element name="executableBlock" maxOccurs="unbounded"> - <xs:complexType> - <xs:simpleContent> - <xs:extension base="xs:string"> - <xs:attribute name="position" type="xs:int"/> - </xs:extension> - </xs:simpleContent> - </xs:complexType> - </xs:element> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="allowUnconvergedCouplings" type="xs:boolean"/> - <xs:element name="doeSettings" minOccurs="0"> - <xs:complexType> - <xs:all> - <xs:element name="doeMethod" type="xs:string"/> - <xs:element name="doeSeed" type="xs:decimal" minOccurs="0"/> - <xs:element name="doeRuns" type="xs:int" minOccurs="0"/> - </xs:all> - </xs:complexType> - </xs:element> - </xs:all> - </xs:complexType> - </xs:element> - <xs:element name="problemRoles"> - <xs:complexType> - <xs:sequence> - <xs:element name="parameters"> - <xs:complexType> - <xs:sequence> - <xs:element name="designVariables" minOccurs="0"> - <xs:complexType> - <xs:sequence> - <xs:element name="designVariable" maxOccurs="unbounded"> - <xs:complexType> - <xs:complexContent> - <xs:extension base="simpleVariableType"> - <xs:sequence> - <xs:element name="nominalValue" type="xs:decimal" minOccurs="0"/> - <xs:element name="validRanges" type="rangeType" minOccurs="0"/> - <xs:element name="variableType" minOccurs="0"> - <xs:simpleType> - <xs:restriction base="xs:string"> - <xs:enumeration value="int"/> - <xs:enumeration value="real"/> - </xs:restriction> - </xs:simpleType> - </xs:element> - <xs:element name="samples" minOccurs="0"> - <xs:complexType> - <xs:sequence> - <xs:element name="sample" maxOccurs="unbounded"> - <xs:complexType> - <xs:simpleContent> - <xs:extension base="xs:decimal"> - <xs:attribute name="position" type="xs:string"/> - </xs:extension> - </xs:simpleContent> - </xs:complexType> - </xs:element> - </xs:sequence> - </xs:complexType> - </xs:element> - </xs:sequence> - </xs:extension> - </xs:complexContent> - </xs:complexType> - </xs:element> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="objectiveVariables" minOccurs="0"> - <xs:complexType> - <xs:sequence> - <xs:element name="objectiveVariable" type="simpleVariableType" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="constraintVariables" minOccurs="0"> - <xs:complexType> - <xs:sequence> - <xs:element name="constraintVariable" maxOccurs="unbounded"> - <xs:complexType> - <xs:complexContent> - <xs:extension base="simpleVariableType"> - <xs:sequence> - <xs:element name="constraintType" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:documentation>Either 'inequality' or 'equality'</xs:documentation> - </xs:annotation> - </xs:element> - <xs:element name="constraintOperator" minOccurs="0"> - <xs:annotation> - <xs:documentation>Either '==', 'lt', 'gt', 'lt=', 'gt=' or combination of inequality constraints</xs:documentation> - </xs:annotation> - </xs:element> - <xs:element name="referenceValue" type="xs:anyType" minOccurs="0"/> - <xs:element name="requiredEqualityPrecision" type="xs:decimal" minOccurs="0"/> - </xs:sequence> - </xs:extension> - </xs:complexContent> - </xs:complexType> - </xs:element> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="stateVariables" minOccurs="0"> - <xs:complexType> - <xs:sequence> - <xs:element name="stateVariable" type="simpleVariableType" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="executableBlocks"> - <xs:complexType> - <xs:all> - <xs:element name="preCouplingBlocks" minOccurs="0"> - <xs:complexType> - <xs:sequence> - <xs:element name="preCouplingBlock" maxOccurs="unbounded"> - <xs:complexType> - <xs:simpleContent> - <xs:extension base="xs:string"/> - </xs:simpleContent> - </xs:complexType> - </xs:element> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="coupledBlocks" minOccurs="0"> - <xs:complexType> - <xs:sequence> - <xs:element name="coupledBlock" maxOccurs="unbounded"> - <xs:complexType> - <xs:simpleContent> - <xs:extension base="xs:string"/> - </xs:simpleContent> - </xs:complexType> - </xs:element> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="postCouplingBlocks" minOccurs="0"> - <xs:complexType> - <xs:sequence> - <xs:element name="postCouplingBlock" maxOccurs="unbounded"> - <xs:complexType> - <xs:simpleContent> - <xs:extension base="xs:string"/> - </xs:simpleContent> - </xs:complexType> - </xs:element> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="preDesvarsBlocks" minOccurs="0"> - <xs:complexType> - <xs:sequence> - <xs:element name="preDesvarsBlock" maxOccurs="unbounded"> - <xs:complexType> - <xs:simpleContent> - <xs:extension base="xs:string"/> - </xs:simpleContent> - </xs:complexType> - </xs:element> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="postDesvarsBlocks" minOccurs="0"> - <xs:complexType> - <xs:sequence> - <xs:element name="postDesvarBlock" maxOccurs="unbounded"> - <xs:complexType> - <xs:simpleContent> - <xs:extension base="xs:string"/> - </xs:simpleContent> - </xs:complexType> - </xs:element> - </xs:sequence> - </xs:complexType> - </xs:element> - </xs:all> - </xs:complexType> - </xs:element> - </xs:sequence> - </xs:complexType> - </xs:element> - </xs:all> - <xs:attribute name="uID" type="xs:string" use="required"/> - </xs:complexType> - </xs:element> - <xs:element name="workflow" minOccurs="0"> - <xs:complexType> - <xs:sequence> - <xs:element name="problemDefinitionUID" type="xs:string" minOccurs="0"/> - <xs:element name="dataGraph"> - <xs:complexType> - <xs:sequence> - <xs:element name="name" type="xs:string"/> - <xs:element name="edges"> - <xs:complexType> - <xs:sequence> - <xs:element name="edge" maxOccurs="unbounded"> - <xs:complexType> - <xs:sequence> - <xs:choice> - <xs:element name="fromParameterUID" type="xs:string"/> - <xs:element name="fromExecutableBlockUID" type="xs:string"/> - </xs:choice> - <xs:choice> - <xs:element name="toParameterUID"/> - <xs:element name="toExecutableBlockUID"/> - </xs:choice> - </xs:sequence> - </xs:complexType> - </xs:element> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="metadata" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="processGraph" minOccurs="0"> - <xs:complexType> - <xs:sequence> - <xs:element name="name" type="xs:string"/> - <xs:element name="edges"> - <xs:complexType> - <xs:sequence> - <xs:element name="edge" maxOccurs="unbounded"> - <xs:complexType> - <xs:sequence> - <xs:element name="fromExecutableBlockUID" type="xs:string"/> - <xs:element name="toExecutableBlockUID" type="xs:string"/> - <xs:element name="processStepNumber" type="xs:int"/> - </xs:sequence> - </xs:complexType> - </xs:element> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="nodes"> - <xs:complexType> - <xs:sequence> - <xs:element name="node" maxOccurs="unbounded"> - <xs:complexType> - <xs:sequence> - <xs:element name="referenceUID" type="xs:string"/> - <xs:element name="processStepNumber" type="xs:int"/> - <xs:element name="convergerStepNumber" type="xs:int" minOccurs="0"/> - <xs:element name="diagonalPosition" type="xs:int"/> - </xs:sequence> - </xs:complexType> - </xs:element> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="metadata" minOccurs="0"> - <xs:complexType> - <xs:sequence> - <xs:element name="loopNesting" type="loopElementType" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - </xs:sequence> - </xs:complexType> - </xs:element> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="architectureElements" minOccurs="0"> - <xs:complexType> - <xs:all> - <xs:element name="parameters"> - <xs:complexType> - <xs:all> - <xs:element name="initialGuessCouplingVariables" minOccurs="0"> - <xs:complexType> - <xs:sequence> - <xs:element name="initialGuessCouplingVariable" type="simpleArchitectureElementsVariableType" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="finalCouplingVariables" minOccurs="0"> - <xs:complexType> - <xs:sequence> - <xs:element name="finalCouplingVariable" type="simpleArchitectureElementsVariableType" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="couplingCopyVariables" minOccurs="0"> - <xs:complexType> - <xs:sequence> - <xs:element name="couplingCopyVariable" type="simpleArchitectureElementsVariableType" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="initialGuessDesignVariables" minOccurs="0"> - <xs:complexType> - <xs:sequence> - <xs:element name="initialGuessDesignVariable" type="simpleArchitectureElementsVariableType" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="finalDesignVariables" minOccurs="0"> - <xs:complexType> - <xs:sequence> - <xs:element name="finalDesignVariable" type="simpleArchitectureElementsVariableType" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="finalOutputVariables" minOccurs="0"> - <xs:complexType> - <xs:sequence> - <xs:element name="finalOutputVariable" type="simpleArchitectureElementsVariableType" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="copyDesignVariables" minOccurs="0"> - <xs:complexType> - <xs:sequence> - <xs:element name="copyDesignVariable" type="simpleArchitectureElementsVariableType" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="consistencyConstraintVariables" minOccurs="0"> - <xs:complexType> - <xs:sequence> - <xs:element name="consistencyConstraintVariable" type="simpleArchitectureElementsVariableType" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="doeInputSampleLists" minOccurs="0"> - <xs:complexType> - <xs:sequence> - <xs:element name="doeInputSampleList" type="simpleArchitectureElementsVariableType" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="doeOutputSampleLists" minOccurs="0"> - <xs:complexType> - <xs:sequence> - <xs:element name="doeOutputSampleList" type="simpleArchitectureElementsVariableType" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="surrogateModelApproximates" minOccurs="0"> - <xs:complexType> - <xs:sequence> - <xs:element name="surrogateModelApproximate" type="simpleArchitectureElementsVariableType" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="couplingWeights" minOccurs="0"> - <xs:complexType> - <xs:sequence> - <xs:element name="couplingWeight" type="simpleArchitectureElementsVariableType" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - </xs:all> - </xs:complexType> - </xs:element> - <xs:element name="executableBlocks"> - <xs:complexType> - <xs:all> - <xs:element name="coordinators" minOccurs="0"> - <xs:complexType> - <xs:sequence> - <xs:element name="coordinator" type="simpleArchitectureElementsBlockType" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="optimizers" minOccurs="0"> - <xs:complexType> - <xs:sequence> - <xs:element name="optimizer" maxOccurs="unbounded"> - <xs:complexType> - <xs:complexContent> - <xs:extension base="simpleArchitectureElementsBlockType"> - <xs:sequence> - <xs:element name="designVariables" minOccurs="0"> - <xs:complexType> - <xs:sequence> - <xs:element name="designVariable" maxOccurs="unbounded"> - <xs:complexType> - <xs:sequence> - <xs:element name="designVariableUID" type="xs:string"/> - </xs:sequence> - </xs:complexType> - </xs:element> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="objectiveVariables" minOccurs="0"> - <xs:complexType> - <xs:sequence> - <xs:element name="objectiveVariable" maxOccurs="unbounded"> - <xs:complexType> - <xs:sequence> - <xs:element name="objectiveVariableUID" type="xs:string"/> - </xs:sequence> - </xs:complexType> - </xs:element> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="constraintVariables" minOccurs="0"> - <xs:complexType> - <xs:sequence> - <xs:element name="constraintVariable" maxOccurs="unbounded"> - <xs:complexType> - <xs:sequence> - <xs:element name="constraintVariableUID" type="xs:string"/> - </xs:sequence> - </xs:complexType> - </xs:element> - </xs:sequence> - </xs:complexType> - </xs:element> - </xs:sequence> - </xs:extension> - </xs:complexContent> - </xs:complexType> - </xs:element> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="convergers" minOccurs="0"> - <xs:complexType> - <xs:sequence> - <xs:element name="converger" type="simpleArchitectureElementsBlockType" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="does" minOccurs="0"> - <xs:complexType> - <xs:sequence> - <xs:element name="doe" maxOccurs="unbounded"> - <xs:complexType> - <xs:complexContent> - <xs:extension base="simplerArchitectureElementsBlockType"> - <xs:sequence> - <xs:element name="settings"> - <xs:complexType> - <xs:all> - <xs:element name="doeTable" minOccurs="0"> - <xs:complexType> - <xs:sequence> - <xs:element name="tableRow" maxOccurs="unbounded"> - <xs:complexType> - <xs:sequence> - <xs:element name="tableElement" maxOccurs="unbounded"> - <xs:complexType> - <xs:simpleContent> - <xs:extension base="xs:decimal"> - <xs:attribute name="experimentID" type="xs:string"/> - </xs:extension> - </xs:simpleContent> - </xs:complexType> - </xs:element> - </xs:sequence> - <xs:attribute name="relatedParameterUID" type="xs:string"/> - </xs:complexType> - </xs:element> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="doeMethod" type="xs:string"/> - <xs:element name="doeRuns" type="xs:integer"/> - <xs:element name="doeSeed" type="xs:integer"/> - </xs:all> - </xs:complexType> - </xs:element> - <xs:element name="designVariables" minOccurs="0"> - <xs:complexType> - <xs:sequence> - <xs:element name="designVariable" maxOccurs="unbounded"> - <xs:complexType> - <xs:sequence> - <xs:element name="designVariableUID" type="xs:string"/> - </xs:sequence> - </xs:complexType> - </xs:element> - </xs:sequence> - </xs:complexType> - </xs:element> - </xs:sequence> - </xs:extension> - </xs:complexContent> - </xs:complexType> - </xs:element> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="surrogateModels" minOccurs="0"> - <xs:complexType> - <xs:sequence> - <xs:element name="surrogateModel" type="simpleArchitectureElementsRelatedBlockType" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="boundaryDeterminators" minOccurs="0"> - <xs:complexType> - <xs:sequence> - <xs:element name="boundaryDeterminator" type="simpleArchitectureElementsRelatedBlockType" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="surrogateModelBuilders" minOccurs="0"> - <xs:complexType> - <xs:sequence> - <xs:element name="surrogateModelBuilder" type="simpleArchitectureElementsRelatedBlockType" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="preCouplingAnalyses" minOccurs="0"> - <xs:complexType> - <xs:sequence> - <xs:element name="preCouplingAnalysis" type="simpleArchitectureElementsRelatedBlockType" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="preIteratorAnalyses" minOccurs="0"> - <xs:complexType> - <xs:sequence> - <xs:element name="preIteratorAnalysis" type="simpleArchitectureElementsRelatedBlockType" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="postIteratorAnalyses" minOccurs="0"> - <xs:complexType> - <xs:sequence> - <xs:element name="postIteratorAnalysis" type="simpleArchitectureElementsRelatedBlockType" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="coupledAnalyses" minOccurs="0"> - <xs:complexType> - <xs:sequence> - <xs:element name="coupledAnalysis" type="simpleArchitectureElementsRelatedBlockType" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="postCouplingAnalyses" minOccurs="0"> - <xs:complexType> - <xs:sequence> - <xs:element name="postCouplingAnalysis" type="simpleArchitectureElementsRelatedBlockType" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - </xs:all> - </xs:complexType> - </xs:element> - </xs:all> - </xs:complexType> - </xs:element> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:complexType name="rangeType"> - <xs:sequence> - <xs:element name="limitRange" minOccurs="0" maxOccurs="unbounded"> - <xs:annotation> - <xs:documentation>Range defined by two limits</xs:documentation> - </xs:annotation> - <xs:complexType> - <xs:all> - <xs:element name="minimum" type="xs:float"/> - <xs:element name="maximum" type="xs:float"/> - </xs:all> - </xs:complexType> - </xs:element> - <xs:element name="listRange" minOccurs="0" maxOccurs="unbounded"> - <xs:annotation> - <xs:documentation>Range defined by a list of items</xs:documentation> - </xs:annotation> - <xs:complexType> - <xs:sequence> - <xs:element name="listRangeItem" type="xs:string" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - </xs:sequence> - </xs:complexType> - <xs:complexType name="inoutType"> - <xs:sequence> - <xs:element name="parameterUID" type="xs:string"> - <xs:annotation> - <xs:documentation>ID of the parameter which serves as input or output (e.g. '/data_schema/analyses/y2')</xs:documentation> - </xs:annotation> - </xs:element> - </xs:sequence> - </xs:complexType> - <xs:complexType name="equationsType"> - <xs:sequence> - <xs:element name="equation" maxOccurs="unbounded"> - <xs:complexType> - <xs:simpleContent> - <xs:extension base="xs:string"> - <xs:attribute name="language" type="xs:string"> - <xs:annotation> - <xs:documentation>The language in which the equation is formulated (e.g. Python or MathML)</xs:documentation> - </xs:annotation> - </xs:attribute> - </xs:extension> - </xs:simpleContent> - </xs:complexType> - </xs:element> - </xs:sequence> - <xs:attribute name="uID" type="xs:string"/> - </xs:complexType> - <xs:complexType name="outputsType"> - <xs:sequence> - <xs:element name="output" type="inoutType" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - <xs:complexType name="contactType"> - <xs:choice> - <xs:element name="contact"> - <xs:complexType> - <xs:all> - <xs:element name="name" type="xs:string"> - <xs:annotation> - <xs:documentation>Name of the contact person</xs:documentation> - </xs:annotation> - </xs:element> - <xs:element name="email" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:documentation>E-Mail address of the contact person</xs:documentation> - </xs:annotation> - </xs:element> - <xs:element name="company" minOccurs="0"/> - <xs:element name="department" minOccurs="0"/> - <xs:element name="function" type="xs:string" minOccurs="0"/> - <xs:element name="address" type="xs:string" minOccurs="0"/> - <xs:element name="telephone" type="xs:string" minOccurs="0"/> - <xs:element name="country" type="xs:string" minOccurs="0"/> - </xs:all> - <xs:attribute name="uID" type="xs:string" use="optional"> - <xs:annotation> - <xs:documentation>Unique ID of the contact which can be used as reference in order to avoid having the same contact twice in the document</xs:documentation> - </xs:annotation> - </xs:attribute> - </xs:complexType> - </xs:element> - <xs:element name="contactUID" type="xs:string"/> - </xs:choice> - </xs:complexType> - <xs:complexType name="loopElementType"> - <xs:sequence> - <xs:element name="loopElements" minOccurs="0"> - <xs:complexType> - <xs:sequence> - <xs:element name="loopElement" type="loopElementType" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="functionElements" minOccurs="0"> - <xs:complexType> - <xs:sequence> - <xs:element name="functionElement" type="xs:string" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - </xs:sequence> - <xs:attribute name="relatedUID" type="xs:string"/> - </xs:complexType> - <xs:complexType name="simpleVariableType"> - <xs:sequence> - <xs:element name="parameterUID" type="xs:string"/> - </xs:sequence> - <xs:attribute name="uID" type="xs:string" use="required"/> - </xs:complexType> - <xs:complexType name="simpleArchitectureElementsVariableType"> - <xs:sequence> - <xs:element name="relatedParameterUID" type="xs:string"/> - <xs:element name="relatedInstanceUID" type="xs:string" minOccurs="0"/> - <xs:element name="label" type="xs:string"/> - <xs:element name="instanceID" type="xs:int"/> - </xs:sequence> - <xs:attribute name="uID" type="xs:string"/> - </xs:complexType> - <xs:complexType name="simpleArchitectureElementsBlockType"> - <xs:sequence> - <xs:element name="label" type="xs:string" /> - <xs:element name="settings" minOccurs="0"> - <xs:complexType> - <xs:sequence> - <xs:element name="lastIterationsToConsider" type="xs:decimal"/> - <xs:element name="maximumIterations" type="xs:decimal"/> - <xs:element name="algorithm" type="xs:string"/> - <xs:element name="applyScaling" type="xs:boolean"/> - <xs:element name="maximumFunctionEvaluations" type="xs:decimal"/> - <xs:element name="constraintTolerance" type="xs:decimal"/> - <xs:element name="convergenceTolerance" type="xs:decimal"/> - <xs:element name="convergenceToleranceRelative" type="xs:decimal"/> - <xs:element name="convergenceToleranceAbsolute" type="xs:decimal"/> - </xs:sequence> - </xs:complexType> - </xs:element> - </xs:sequence> - <xs:attribute name="uID" type="xs:string"/> - </xs:complexType> - <xs:complexType name="simplerArchitectureElementsBlockType"> - <xs:sequence> - <xs:element name="label" type="xs:string"/> - </xs:sequence> - <xs:attribute name="uID" type="xs:string"/> - </xs:complexType> - <xs:complexType name="simpleArchitectureElementsRelatedBlockType"> - <xs:sequence> - <xs:element name="relatedExecutableBlockUID" type="xs:string"/> - </xs:sequence> - </xs:complexType> -</xs:schema> diff --git a/kadmos/external/XDSM_writer/XDSM.py b/kadmos/external/XDSM_writer/XDSM.py index afd5c06fe2ff9d7af507ccff8a748affadaadafe..62a1e1d267cb0ed8d5c8e077ff5f18d5776fb38a 100644 --- a/kadmos/external/XDSM_writer/XDSM.py +++ b/kadmos/external/XDSM_writer/XDSM.py @@ -14,11 +14,15 @@ import os import shutil import subprocess import unicodedata +import logging import threading from kadmos.utilities.general import format_string_for_latex from distutils.spawn import find_executable +# Settings for the logger +logger = logging.getLogger(__name__) + class XDSM(object): @@ -245,8 +249,8 @@ class XDSM(object): thread.join(timeout) if thread.is_alive(): - print 'WARNING: Compiling PDF in create_dsm() function seems to be stuck. Check the compiling tex-file by' \ - ' setting keep_tex_file=True.' + logger.warning('Compiling PDF in create_dsm() function seems to be stuck. Check the compiling tex-file by ' + 'setting keep_tex_file=True.') thread.join() def create(self, file_path, keep_tex_file, compile_pdf): @@ -285,6 +289,7 @@ class XDSM(object): pass # In case latex not installed (properly) report error else: - print 'WARNING: Path does not contain latex. Please make sure latex is installed and include it in the path to enable create_dsm() function.' + logger.warning('Path does not contain latex. Please make sure latex is installed and include it in the path ' + 'to enable create_dsm() function.') # Delete the temporary directory shutil.rmtree(directory) diff --git a/kadmos/graph/graph_data.py b/kadmos/graph/graph_data.py index 7a4fba70fbf1f0035d195b81b66e81b92018e276..f9822028d1704e2253ba3975367c7820a599e10c 100644 --- a/kadmos/graph/graph_data.py +++ b/kadmos/graph/graph_data.py @@ -18,7 +18,7 @@ from types import NoneType from kadmos.utilities.strings import get_correctly_extended_latex_label from ..utilities import prompting from ..utilities import printing -from ..utilities.general import make_camel_case, unmake_camel_case, make_plural, get_list_entries, translate_dict_keys, \ +from ..utilities.general import make_camel_case, unmake_camel_case, make_plural, get_list_entries, translate_dict_keys,\ get_mdao_setup, get_group_vars from ..utilities.testing import check from ..utilities.plotting import AnnoteFinder @@ -92,12 +92,12 @@ class DataGraph(KadmosGraph): if cmdows_problem_role_attr == 'samples': # Create problemDefinition/problemRoles/parameters/designVariables/designVariable/samples cmdows_samples = cmdows_problem_role.add('samples') - if self.node[graph_problem_role].get(cmdows_problem_role_attr) is not None: - for idx, itm in enumerate(self.node[graph_problem_role].get(cmdows_problem_role_attr)): + if self.nodes[graph_problem_role].get(cmdows_problem_role_attr) is not None: + for idx, itm in enumerate(self.nodes[graph_problem_role].get(cmdows_problem_role_attr)): cmdows_samples.add('sample', format(itm, '.12f'), attrib={'position': str(idx + 1)}) else: cmdows_problem_role.add(self.CMDOWS_ATTRIBUTE_DICT[cmdows_problem_role_attr], - self.node[graph_problem_role].get(cmdows_problem_role_attr), + self.nodes[graph_problem_role].get(cmdows_problem_role_attr), camel_case_conversion=True) # Create problemDefinition/problemRoles/executableBlocks @@ -125,7 +125,8 @@ class DataGraph(KadmosGraph): if cmdows_problem_formulation is not None: graph_problem_form['mdao_architecture'] = cmdows_problem_formulation.findtext('mdaoArchitecture') graph_problem_form['convergence_type'] = cmdows_problem_formulation.findtext('convergerType') - cmdows_executable_blocks = cmdows_problem_formulation.find('executableBlocksOrder').findall('executableBlock') + cmdows_executable_blocks = \ + cmdows_problem_formulation.find('executableBlocksOrder').findall('executableBlock') cmdows_executable_blocks_order = [None] * len(list(cmdows_executable_blocks)) for cmdows_executable_block in cmdows_executable_blocks: cmdows_executable_blocks_order[int(cmdows_executable_block.get('position') @@ -151,10 +152,10 @@ class DataGraph(KadmosGraph): else: arr = list() for cmdows_block in list(cmdows_blocks): - if self.node.get(cmdows_block.text) is None: + if self.nodes.get(cmdows_block.text) is None: # Add node if it does not exist yet self.add_node(cmdows_block.text, category='function') - self.node[cmdows_block.text]['problem_role'] = role + self.nodes[cmdows_block.text]['problem_role'] = role arr.append(cmdows_block.text) graph_problem_form['function_ordering'][role] = arr @@ -167,18 +168,20 @@ class DataGraph(KadmosGraph): cmdows_suffix = '__' + re.findall(r'(?<=__).*?(?=__)', cmdows_variable.get('uID'))[0] + '__' # Add problem role try: - self.node[cmdows_parameter_uid]['problem_role'] = self.CMDOWS_ROLES_DICT_INV[cmdows_suffix] + self.nodes[cmdows_parameter_uid]['problem_role'] = self.CMDOWS_ROLES_DICT_INV[cmdows_suffix] # TODO: Find a more elegant way to handle samples and parameterUID for attribute in cmdows_variable.getchildren(): if attribute.tag == 'samples': cmdows_samples = attribute.findall('sample') cmdows_sample_data = [None] * len(list(cmdows_samples)) for cmdows_sample in cmdows_samples: - cmdows_sample_data[int(cmdows_sample.get('position')) - 1] = float(cmdows_sample.text) - self.node[cmdows_parameter_uid]['samples'] = cmdows_sample_data + cmdows_sample_data[int(cmdows_sample.get('position')) - 1] = \ + float(cmdows_sample.text) + self.nodes[cmdows_parameter_uid]['samples'] = cmdows_sample_data cmdows_variable.remove(attribute) - self.node[cmdows_parameter_uid].update(cmdows.finddict(cmdows_variable, camel_case_conversion=True)) - del self.node[cmdows_parameter_uid]['parameter_u_i_d'] + self.nodes[cmdows_parameter_uid].update(cmdows.finddict(cmdows_variable, + camel_case_conversion=True)) + del self.nodes[cmdows_parameter_uid]['parameter_u_i_d'] except KeyError: logger.error('Could not find the node "{}" for some reason when loading the CMDOWS' .format(cmdows_parameter_uid)) @@ -189,14 +192,23 @@ class DataGraph(KadmosGraph): # ---------------------------------------------------------------------------------------------------------------- # # GRAPH-SPECIFIC METHODS # # ---------------------------------------------------------------------------------------------------------------- # - def mark_as_design_variable(self, node, lower_bound=None, upper_bound=None, samples=None, nominal_value=0.0, ignore_outdegree=False): + def mark_as_design_variable(self, node, lower_bound=None, upper_bound=None, samples=None, nominal_value=0.0, + ignore_outdegree=False): """Method to mark a single node as a design variable and add the required metadata for its definition. - :param node: - :param lower_bound: - :param upper_bound: - :param samples: - :return: + :param node: node + :type node: str + :param lower_bound: lower bound of design variable + :type lower_bound: float + :param upper_bound: upper bound of design variable + :type upper_bound: float + :param samples: samples of design variable + :type samples: list + :param nominal_value: nominal value of design variable + :type nominal_value: float + :param ignore_outdegree: option to ignore the outdegree required + :type ignore_outdegree: bool + :returns: graph with enriched design variable node """ # Input assertions assert self.has_node(node), 'Node {} is not present in the graph.'.format(node) @@ -211,20 +223,20 @@ class DataGraph(KadmosGraph): assert isinstance(samples, (list, NoneType)), 'Samples should be a list.' # Mark nodes - self.node[node]['problem_role'] = self.PROBLEM_ROLES_VARS[0] + self.nodes[node]['problem_role'] = self.PROBLEM_ROLES_VARS[0] if lower_bound is not None: - self.node[node]['valid_ranges'] = {'limit_range':{'minimum': lower_bound}} + self.nodes[node]['valid_ranges'] = {'limit_range': {'minimum': lower_bound}} if upper_bound is not None: - if 'valid_ranges' in self.node[node]: - if 'limit_range' in self.node[node]['valid_ranges']: - self.node[node]['valid_ranges']['limit_range']['maximum'] = upper_bound + if 'valid_ranges' in self.nodes[node]: + if 'limit_range' in self.nodes[node]['valid_ranges']: + self.nodes[node]['valid_ranges']['limit_range']['maximum'] = upper_bound else: - self.node[node]['valid_ranges']['limit_range'] = {'maximum': upper_bound} + self.nodes[node]['valid_ranges']['limit_range'] = {'maximum': upper_bound} else: - self.node[node]['valid_ranges'] = {'limit_range': {'maximum': upper_bound}} + self.nodes[node]['valid_ranges'] = {'limit_range': {'maximum': upper_bound}} if samples is not None: - self.node[node]['samples'] = samples - self.node[node]['nominal_value'] = nominal_value + self.nodes[node]['samples'] = samples + self.nodes[node]['nominal_value'] = nominal_value return @@ -234,17 +246,19 @@ class DataGraph(KadmosGraph): :param nodes: list of nodes present in the graph :type nodes: list or str :param lower_bounds: list of lower bound values - :type lower_bounds: list or numbers.Number + :type lower_bounds: list, numbers.Number :param upper_bounds: list of upper bounds - :type upper_bounds: list or numbers.Number + :type upper_bounds: list, numbers.Number :param samples: nested list of kadmos values :type samples: list :param nominal_values: list of nominal values - :type nominal_values: list or numbers.Number + :type nominal_values: list, numbers.Number + :return: graph with enriched design variable nodes """ # Input assertions - assert isinstance(nodes, list), 'Input nodes should be a list of graph nodes. Use mark_as_design_variable for single node.' + assert isinstance(nodes, list), 'Input nodes should be a list of graph nodes. Use mark_as_design_variable for' \ + ' single node.' if isinstance(lower_bounds, numbers.Number) or lower_bounds is None: lower_bounds = [lower_bounds]*len(nodes) else: @@ -267,7 +281,7 @@ class DataGraph(KadmosGraph): assert len(samples) == len(nodes), 'Number of nominal values is not equal to the number of nodes.' # Mark nodes - for node,lb,ub,sm,nv in zip(nodes, lower_bounds, upper_bounds, samples, nominal_values): + for node, lb, ub, sm, nv in zip(nodes, lower_bounds, upper_bounds, samples, nominal_values): self.mark_as_design_variable(node, lower_bound=lb, upper_bound=ub, samples=sm, nominal_value=nv) return @@ -277,13 +291,16 @@ class DataGraph(KadmosGraph): :param node: variable node :type node: basestring + :param remove_unused_outputs: option to remove unused outputs + :type remove_unused_outputs: bool + :return: graph enriched with objective node """ # Input assertions assert self.has_node(node), 'Node %s is not present in the graph.' % node # Mark node - self.node[node]['problem_role'] = self.PROBLEM_ROLES_VARS[1] + self.nodes[node]['problem_role'] = self.PROBLEM_ROLES_VARS[1] if remove_unused_outputs: self.remove_unused_outputs() @@ -294,14 +311,18 @@ class DataGraph(KadmosGraph): """Method to mark a node as a constraint. :param node: node to be marked (on the left side of the operator - :type nodes: str + :type node: str :param operator: constraint operator or list of constraint operators :type operator: str or string list - :param reference_value: value on the right side of the operator or list of values corresponding to the list of operators + :param reference_value: value on the right side of the operator or list of values corresponding to the list of + operators :type reference_value: numbers.Number or list + :param remove_unused_outputs: option to remove unused outputs + :type remove_unused_outputs: bool + :returns: graph with enriched constraint node """ - #dict of inequality operators + # dict of inequality operators operators = {'>': oper.gt, '>=': oper.ge, '<': oper.lt, @@ -318,17 +339,19 @@ class DataGraph(KadmosGraph): 'provide equal sized lists.'.format(len(operator), len(reference_value)) for op in operator: - assert operators[op](1,0) or operators[op](0,1), 'Operator has to be one of the following: >, >=, < or <=' + assert operators[op](1, 0) or operators[op](0, 1), 'Operator has to be one of the following: >, >=, <' \ + ' or <=' else: raise AssertionError('operator input is of wrong type {}.'.format(type(operator))) assert isinstance(reference_value, (numbers.Number, list)), 'Reference value is not a number or list.' - #check if multiple bounds are used correctly. + # check if multiple bounds are used correctly. if isinstance(operator, list): - if (operators[operator[0]](0,1) and operators[operator[1]](1,0)) or ((operators[operator[0]](1,0) and operators[operator[1]](0,1))): + if (operators[operator[0]](0, 1) and operators[operator[1]](1, 0)) or ((operators[operator[0]](1, 0) and + operators[operator[1]](0, 1))): a = reference_value[0] b = reference_value[1] - if operators[operator[1]](a,b) and operators[operator[0]](b,a): + if operators[operator[1]](a, b) and operators[operator[0]](b, a): pass else: raise IOError("ERROR: x {} {} and x {} {} are not consistent as " @@ -338,17 +361,17 @@ class DataGraph(KadmosGraph): "Please correct the operators provided".format(operator[0], operator[1])) # Mark nodes - self.node[node]['problem_role'] = self.PROBLEM_ROLES_VARS[2] + self.nodes[node]['problem_role'] = self.PROBLEM_ROLES_VARS[2] if isinstance(operator, basestring): - self.node[node]['constraint_operator'] = operator - self.node[node]['reference_value'] = reference_value + self.nodes[node]['constraint_operator'] = operator + self.nodes[node]['reference_value'] = reference_value else: - self.node[node]['constraint_operator'] = ';'.join(operator) - self.node[node]['reference_value'] = ';'.join([str(item) for item in reference_value]) + self.nodes[node]['constraint_operator'] = ';'.join(operator) + self.nodes[node]['reference_value'] = ';'.join([str(item) for item in reference_value]) if operator == '==': - self.node[node]['constraint_type'] = 'equality' + self.nodes[node]['constraint_type'] = 'equality' else: - self.node[node]['constraint_type'] = 'inequality' + self.nodes[node]['constraint_type'] = 'inequality' if remove_unused_outputs: self.remove_unused_outputs() @@ -358,15 +381,23 @@ class DataGraph(KadmosGraph): def mark_as_constraints(self, nodes, operators, reference_values, remove_unused_outputs=False): """Method to mark multiple nodes as constraints. - :param nodes: list of nodes to be marked. + :param nodes: nodes to be marked. + :type nodes: list :param operators: operators to be implemented (as list per node or as single operator for all) + :type operators: str, list :param reference_values: reference values to be used (as list of values per node or as single value for all) + :type reference_values: float, list + :param remove_unused_outputs: option to remove unused outputs + :type remove_unused_outputs: bool :return: graph with enriched constraint nodes + + Operators: '==', '>', '<', '>=' and '<=' """ # Input assertions # poss_ops = ['==', '>', '<', '>=', '<='] - assert isinstance(nodes, list), 'Input nodes should be a list of graph nodes. Use mark_as_constraint for single node.' + assert isinstance(nodes, list), 'Input nodes should be a list of graph nodes. Use mark_as_constraint for ' \ + 'single node.' if isinstance(operators, str): operators = [operators]*len(nodes) else: @@ -376,9 +407,10 @@ class DataGraph(KadmosGraph): reference_values = [reference_values]*len(nodes) else: assert isinstance(reference_values, list), 'Reference values should be a list.' - assert len(reference_values) == len(nodes), 'Number of reference values is not equal to the number of nodes.' - for node,op,ref in zip(nodes,operators,reference_values): - self.mark_as_constraint(node,op,ref) + assert len(reference_values) == len(nodes), 'Number of reference values is not equal to the number of ' \ + 'nodes.' + for node, op, ref in zip(nodes, operators, reference_values): + self.mark_as_constraint(node, op, ref) if remove_unused_outputs: self.remove_unused_outputs() @@ -390,6 +422,8 @@ class DataGraph(KadmosGraph): :param nodes: list of nodes present in the graph :type nodes: list + :param remove_unused_outputs: option to remove unused outputs + :type remove_unused_outputs: bool """ # Input assertions @@ -399,7 +433,7 @@ class DataGraph(KadmosGraph): # Mark nodes for node in nodes: - self.node[node]['problem_role'] = self.PROBLEM_ROLES_VARS[3] + self.nodes[node]['problem_role'] = self.PROBLEM_ROLES_VARS[3] if remove_unused_outputs: self.remove_unused_outputs() @@ -411,32 +445,33 @@ class DataGraph(KadmosGraph): :param node: variable node to be unmarked :type node: basestring + :return: graph with unmarked node """ # Input assertions assert isinstance(node, basestring) assert self.has_node(node), 'Node {} is not present in the graph.'.format(node) - assert self.node[node]['category'] == 'variable', 'Node {} should be of category variable.'.format(node) + assert self.nodes[node]['category'] == 'variable', 'Node {} should be of category variable.'.format(node) # Unmark design variable - if 'problem_role' in self.node[node]: - pr = self.node[node]['problem_role'] + if 'problem_role' in self.nodes[node]: + pr = self.nodes[node]['problem_role'] if pr == self.PROBLEM_ROLES_VARS[0]: # design variable - del self.node[node]['problem_role'] - if 'valid_ranges' in self.node[node]: - del self.node[node]['valid_ranges'] - if 'samples' in self.node[node]: - del self.node[node]['samples'] - if 'nominal_value' in self.node[node]: - del self.node[node]['nominal_value'] + del self.nodes[node]['problem_role'] + if 'valid_ranges' in self.nodes[node]: + del self.nodes[node]['valid_ranges'] + if 'samples' in self.nodes[node]: + del self.nodes[node]['samples'] + if 'nominal_value' in self.nodes[node]: + del self.nodes[node]['nominal_value'] elif pr == self.PROBLEM_ROLES_VARS[1]: # objective - del self.node[node]['problem_role'] + del self.nodes[node]['problem_role'] elif pr == self.PROBLEM_ROLES_VARS[2]: # constraint - del self.node[node]['problem_role'] - del self.node[node]['constraint_operator'] - del self.node[node]['reference_value'] + del self.nodes[node]['problem_role'] + del self.nodes[node]['constraint_operator'] + del self.nodes[node]['reference_value'] elif pr == self.PROBLEM_ROLES_VARS[3]: # quantity of interest - del self.node[node]['problem_role'] + del self.nodes[node]['problem_role'] else: raise AssertionError('Invalid problem role {} found on variable node {}'.format(pr, node)) @@ -450,7 +485,7 @@ class DataGraph(KadmosGraph): output_nodes = self.find_all_nodes(subcategory='all outputs') removed_nodes = [] for output_node in output_nodes: - if 'problem_role' not in self.node[output_node]: + if 'problem_role' not in self.nodes[output_node]: self.remove_node(output_node) removed_nodes.append(output_node) return removed_nodes @@ -490,7 +525,8 @@ class DataGraph(KadmosGraph): if node_selection: function_order = node_selection else: - assert 'function_order' in graph.graph['problem_formulation'], 'function_order must be given as attribute.' + assert 'function_order' in graph.graph['problem_formulation'], 'function_order must be given as ' \ + 'attribute.' function_order = graph.graph['problem_formulation']['function_order'] elif function_order_method == 'random': function_order = graph.find_all_nodes(category='function') @@ -514,17 +550,18 @@ class DataGraph(KadmosGraph): return coupling_matrix def get_coupling_dictionary(self): - """ Function to get a coupling dictionary. For each function node, the dictionary indicates from which function - nodes it gets its input and the number of variables it gets. - - F2 ==> x1, x2 ==> F1 - F3 ==> x3 ==> F1 - - Will give: - {F1: {F2: 2, F3: 1}} + """ Function to get a coupling dictionary. :return: coupling dictionary :rtype: dict + + For each function node, the dictionary indicates from which function + nodes it gets its input and the number of variables it gets. + + * F2 ==> x1, x2 ==> F1 + * F3 ==> x3 ==> F1 + + Will give: {F1: {F2: 2, F3: 1}} """ coupling_dict = dict() @@ -551,8 +588,8 @@ class DataGraph(KadmosGraph): :type multi_start: int :param check_graph: check whether graph has problematic variables :type check_graph: bool - :return Possible function order - :rtype list + :return: Possible function order + :rtype: list """ # Input assertions @@ -641,10 +678,10 @@ class DataGraph(KadmosGraph): """ Method to get the highest instance of a node. - :param node: - :type node: - :return: - :rtype: + :param node: node + :type node: str + :return: highest instance of the node + :rtype: int """ assert 'instance' in self.nodes[node], 'node {} does not have the expected attribute "instance".'.format(node) highest_instance = self.nodes[node]['instance'] @@ -665,8 +702,8 @@ class DataGraph(KadmosGraph): :param nodes: function nodes to sort :type nodes: list - :return nodes in sorted order - :rtype list + :return: nodes in sorted order + :rtype: list """ # Input assertions @@ -711,10 +748,10 @@ class DataGraph(KadmosGraph): :type multi_start: int :param get_evaluations: option to give the number of evaluations as output :type get_evaluations: bool - :return function order - :rtype list - :return number of evaluations - :rtype int + :return: function order + :rtype: list + :return: number of evaluations + :rtype: list """ # TODO: check if input nodes > 1 @@ -796,8 +833,8 @@ class DataGraph(KadmosGraph): :param nodes: nodes that need to be ordered :type nodes: list - :return function order - :rtype list + :return: function order + :rtype: list """ # Calculate the number of runs that are needed and give a warning when it exceeds a threshold @@ -830,8 +867,8 @@ class DataGraph(KadmosGraph): :param nodes: nodes that need to be ordered :type nodes: list - :return function order - :rtype list + :return: function order + :rtype: list """ converged = False @@ -892,8 +929,8 @@ class DataGraph(KadmosGraph): :param nodes: nodes that need to be ordered :type nodes: list - :return function order - :rtype list + :return: function order + :rtype: list """ converged = False @@ -947,8 +984,8 @@ class DataGraph(KadmosGraph): :param nodes: nodes that need to be ordered :type nodes: list - :return function order - :rtype list + :return: function order + :rtype: list """ active_branches = [] @@ -1001,8 +1038,8 @@ class DataGraph(KadmosGraph): :type branch: list :param nodes: the nodes that are considered in the sequencing problem :type nodes: list - :return lower bound - :rtype int + :return: lower bound + :rtype: int """ # Get a random function order with the nodes of the branch at the start @@ -1050,7 +1087,7 @@ class DataGraph(KadmosGraph): toolbox.register('population', tools.initRepeat, list, toolbox.individual) toolbox.register('mate', tools.cxOrdered) toolbox.register('mutate', tools.mutShuffleIndexes, indpb=INDPB) - #toolbox.register('select', tools.selBest) + # toolbox.register('select', tools.selBest) toolbox.register('select', tools.selTournament, tournsize=3) toolbox.register('evaluate', self._get_fitness_individual, mapping=mapping, coupling_dict=coupling_dict) @@ -1083,15 +1120,17 @@ class DataGraph(KadmosGraph): function_order.append(mapping[idx]) feedback, size = self.get_feedback_info(function_order, coupling_dict) - return feedback, + return feedback def get_feedback_info(self, function_order, coupling_dict): """Function to determine the number of feedback loops for a given function order :param function_order: function order of the nodes :type function_order: list - :return number of feedback loops - :rtype int + :param coupling_dict: function couplings + :type coupling_dict: dict + :return: number of feedback loops + :rtype: int """ # Determine number of feedback loops @@ -1135,12 +1174,19 @@ class RepositoryConnectivityGraph(DataGraph): Complexity Problem', Mathematical Problems in Engineering, 2017. :param n_disciplines: Number of disciplines + :type n_disciplines: int :param coupling_strength: percentage of couplings, 0 no couplings, 1 all possible couplings + :type coupling_strength: int :param n_global_var: Number of global design variables + :type n_global_var: int :param n_local_var: Number of local design variables for each discipline + :type n_local_var: int :param n_coupling_var: Number of output variables for each discipline + :type n_coupling_var: int :param n_local_constraints: Number of local constraints + :type n_local_constraints: int :param n_global_constraints: Number of global constraints + :type n_global_constraints: int :param B: relation between the coupling variables :param C: relation between the global design variables and coupling variables :param D: relation between the local design variables and coupling variables @@ -1151,10 +1197,14 @@ class RepositoryConnectivityGraph(DataGraph): :param I: relation between the local design variables and global constraints :param J: relation between the coupling variables and global constraints :param r: positive scalars to be used for the local constraints + :type r: float :param s: positive scalars to be used for the global constraints + :type s: float :param write_problem_to_textfile: option to write generated problem to a textfile + :type write_problem_to_textfile: bool """ + # TODO Imco add type of B-J in docstring # Input assertions assert not B if coupling_strength else B is not None, 'Either the coupling strength or the B-matrix must be ' \ 'given' @@ -1602,22 +1652,25 @@ class RepositoryConnectivityGraph(DataGraph): """This function takes an arbitrary amount of objective nodes as graph sinks and returns all path combinations of tools. + :param args: arbitrary amount of objective nodes + :type args: list, str + :param kwargs: filter options to limit possible path combinations + :type kwargs: bool, str + :return: all possible FPG path combinations for the provided objective nodes + If no arguments are given, user is prompted to select objectives from the graph. - The tool combinations are found using the function itertools.product() and can lead to significant computation - times for large graphs. If this is the case, the user is prompted whether to continue or not. + .. hint:: The tool combinations are found using the function itertools.product() and can lead to significant + computation times for large graphs. If this is the case, the user is prompted whether to continue or not. A variety of filters can be applied to the search of possible tools combinations, some of which reduce the computation time. - kwargs: - obj_vars_covered - ensures that all objective variables are used in tool configurations - ignore_funcs - ignores functions for the config - source - source node; if provided, must be in config + .. note:: kwargs: - :param args: arbitrary amount of objective nodes - :param kwargs: filter options to limit possible path combinations - :return: all possible FPG path combinations for the provided objective nodes + * obj_vars_covered - ensures that all objective variables are used in tool configurations + * ignore_funcs - ignores functions for the config + * source - source node; if provided, must be in config """ # TODO: Add filters @@ -1723,17 +1776,20 @@ class RepositoryConnectivityGraph(DataGraph): def get_path_combinations(self, *args, **kwargs): """This function takes lists of subsets and generates all possible combinations between them. + :param args: lists of subsets that will be used to find configurations + :type args: list + :param kwargs: see optional arguments + :type kwargs: int + :return: set of all unique path combinations + This is done by using the itertools.product() function. If the amount of expected evaluations exceeds a pre-set minimum, the user will be asked if to continue or not; because the process can take a long time and use up many resources. - Optional arguments: - min_func: minimum amount of functions in each configuration - max_func: maximum amount of functions in each configuration + .. note:: Optional arguments: - :param args: lists of subsets that will be used to find configurations - :type args: list - :return: set of all unique path combinations + * min_func: minimum amount of functions in each configuration + * max_func: maximum amount of functions in each configuration """ # get list of subsets @@ -1917,10 +1973,27 @@ class RepositoryConnectivityGraph(DataGraph): def select_function_combination_from(self, *args, **kwargs): """This function takes all provided workflow configurations and lists them according to their characteristics. - The user can then choose the workflow configuration from the list. + :param args: workflow configurations + :type args: list + :param kwargs: see optional arguments + :type kwargs: bool, str, int + :return: sorted list of workflow configurations + :rtype: list + + .. note:: Optional arguments: + + * 'print_combos' - option to print the combinations in a table + * 'n_limit' - amount of combinations that will be printed in the table + * 'sort_by' - characteristic to sort workflow configurations by + * 'sort_by ascending' - option to sort workflow configurations by ascension + * 'plot_combos' - option to plot the combinations in a graph + + The user can choose the workflow configuration from the list. + A warning is given to the user if the amount of total configurations exceeds n = 1e4. Print limit is set to [0-20] by default. - sort_by must be one of ["couplings", "system_inputs", "edges", "nodes"]. + + .. note:: sort_by must be one of ["couplings", "system_inputs", "edges", "nodes"]. """ # make sure arguments provided @@ -2030,6 +2103,8 @@ class RepositoryConnectivityGraph(DataGraph): def get_fpg_by_function_nodes(self, *args): """This function creates a new (FPG)-graph based on the selected function nodes. + :param args: arbitrary amount of graph nodes + :type args: list, str :return: new fpg graph :rtype: FundamentalProblemGraph """ @@ -2166,7 +2241,7 @@ class FundamentalProblemGraph(DataGraph, KeChainMixin): category='A', i=i) for out_node in out_nodes: - category_check, i_not = check('problem_role' not in self.node[out_node], + category_check, i_not = check('problem_role' not in self.nodes[out_node], 'The attribute problem_role is missing on the output node %s.' % str(out_node), status=category_check, @@ -2174,7 +2249,7 @@ class FundamentalProblemGraph(DataGraph, KeChainMixin): i=i) i += 1 for func_node in func_nodes: - category_check, i_not = check('problem_role' not in self.node[func_node], + category_check, i_not = check('problem_role' not in self.nodes[func_node], 'The attribute problem_role is missing on the function node %s.' % str(func_node), status=category_check, @@ -2535,14 +2610,14 @@ class FundamentalProblemGraph(DataGraph, KeChainMixin): if self.graph['problem_formulation']['doe_settings']['doe_method'] == self.OPTIONS_DOE_METHODS[3]: all_samples = [] for des_var_node in des_var_nodes: - category_check, i_not = check('samples' not in self.node[des_var_node], + category_check, i_not = check('samples' not in self.nodes[des_var_node], 'The samples attributes is missing for design variable node' ' %s.' % des_var_node, status=category_check, category='C', i=i) if category_check: - all_samples.append(self.node[des_var_node]['samples']) + all_samples.append(self.nodes[des_var_node]['samples']) i += 1 sample_lengths = [len(item) for item in all_samples] # Check whether all samples have the same length @@ -2555,17 +2630,21 @@ class FundamentalProblemGraph(DataGraph, KeChainMixin): # Return return category_check, i - # ---------------------------------------------------------------------------------------------------------------- # # GRAPH SPECIFIC METHODS # # ---------------------------------------------------------------------------------------------------------------- # def add_function_problem_roles(self, function_order_method='manual'): - """ - Method to add the function problem roles (pre-coupled, coupled, post-coupled functions). + """Method to add the function problem roles (pre-coupled, coupled, post-coupled functions). :param function_order_method: algorithm to be used for the order in which the functions are executed. :type function_order_method: basestring + :return: graph with problem roles added to functions + :rtype: FundamentalProblemGraph + + Algorithm options: + + * 'manual' - function order attributed to the problem formulation of the graph is used """ logger.info('Adding function problem roles...') @@ -2613,19 +2692,19 @@ class FundamentalProblemGraph(DataGraph, KeChainMixin): function_ordering[self.FUNCTION_ROLES[2]] = list() if left_ind is not None: for i in range(0, left_ind): - self.node[function_order[i]]['problem_role'] = self.FUNCTION_ROLES[0] + self.nodes[function_order[i]]['problem_role'] = self.FUNCTION_ROLES[0] function_ordering[self.FUNCTION_ROLES[0]].append(function_order[i]) for i in range(left_ind, low_ind+1): - self.node[function_order[i]]['problem_role'] = self.FUNCTION_ROLES[1] + self.nodes[function_order[i]]['problem_role'] = self.FUNCTION_ROLES[1] function_ordering[self.FUNCTION_ROLES[1]].append(function_order[i]) if low_ind < len(function_order)-1: for i in range(low_ind+1, len(function_order)): - self.node[function_order[i]]['problem_role'] = self.FUNCTION_ROLES[2] + self.nodes[function_order[i]]['problem_role'] = self.FUNCTION_ROLES[2] function_ordering[self.FUNCTION_ROLES[2]].append(function_order[i]) else: # noinspection PyUnboundLocalVariable for function in function_order: - self.node[function]['problem_role'] = self.FUNCTION_ROLES[0] + self.nodes[function]['problem_role'] = self.FUNCTION_ROLES[0] function_ordering[self.FUNCTION_ROLES[0]].append(function) # Add function ordering to the graph as well @@ -2636,6 +2715,17 @@ class FundamentalProblemGraph(DataGraph, KeChainMixin): return def add_problem_formulation(self, mdao_definition, function_order, doe_settings=None): + """Method to add the problem formulation. + + :param mdao_definition: MDF-GS, MDF-J, IDF, CO, BLIS-2000 + :type mdao_definition: str + :param function_order: order or functions to be included in graph + :type function_order: list + :param doe_settings: doe settings of the graph + :type doe_settings: dict + :return: graph enriched with problem formulation + :rtype: Fundamental ProblemGraph + """ # Impose the MDAO architecture mdao_architecture, convergence_type, allow_unconverged_couplings = get_mdao_setup(mdao_definition) @@ -2659,9 +2749,6 @@ class FundamentalProblemGraph(DataGraph, KeChainMixin): def partition_graph(self, n_parts, include_run_time=False, tpwgts=None, recursive=True, contig=False): """Partition a graph using the Metis algorithm (http://glaros.dtc.umn.edu/gkhome/metis/metis/overview). - Note that partitioning can only be performed on undirected graphs. Therefore every graph input is translated - into an undirected graph. - :param n_parts: number of partitions requested (algorithm might provide less) :type n_parts: int :param include_run_time: @@ -2672,6 +2759,9 @@ class FundamentalProblemGraph(DataGraph, KeChainMixin): :type recursive: bool :param contig: Metis option :type contig: bool + + .. note:: partitioning can only be performed on undirected graphs. Therefore every graph input is translated + into an undirected graph. """ import metis @@ -2794,10 +2884,10 @@ class FundamentalProblemGraph(DataGraph, KeChainMixin): :type partitions: dict :param include_run_time: :type include_run_time: bool - :return partition_variables: - :rtype partition_variables: list of sets - :return system_variables: - :rtype system_variables: set + :return: partition_variables: + :rtype: partition_variables: list of sets + :return: system_variables: + :rtype: system_variables: set """ # Get complete function order of nodes in the partitions @@ -2929,7 +3019,7 @@ class FundamentalProblemGraph(DataGraph, KeChainMixin): def select_distributed_architecture(self): """ Function for easy selection of a distributed architecture for a partitioned graph. - :return Extended problem formulation + :return: Extended problem formulation """ # Check if graph is partitioned @@ -3028,11 +3118,12 @@ class FundamentalProblemGraph(DataGraph, KeChainMixin): def get_mg_function_ordering(self): """Method to determine the function ordering for MDAO graphs (FPG and MDG) based on an FPG. - Function ordering has to be adjusted when design variables are used. In that case, the pre-coupling functions - have to be divided in two parts: the first part does not use the design variables yet, while the second does. - :return: function ordering dictionary :rtype: dict + + .. note:: Function ordering has to be adjusted when design variables are used. In that case, the pre-coupling + functions have to be divided in two parts: the first part does not use the design variables yet, while the + second does. """ mdao_arch = self.graph['problem_formulation']['mdao_architecture'] @@ -3041,7 +3132,8 @@ class FundamentalProblemGraph(DataGraph, KeChainMixin): if mdao_arch == self.OPTIONS_ARCHITECTURES[7]: # Distributed-conv mdao_arch = self.graph['problem_formulation']['system_architecture'] - if mdao_arch in self.OPTIONS_ARCHITECTURES[2:7]+self.OPTIONS_ARCHITECTURES[8:10]: # IDF, MDF, unc-OPT, unc-DOE, con-DOE, CO, BLISS-2000 + # OPTIONS_ARCHITECTURE: IDF, MDF, unc-OPT, unc-DOE, con-DOE, CO, BLISS-2000 + if mdao_arch in self.OPTIONS_ARCHITECTURES[2:7]+self.OPTIONS_ARCHITECTURES[8:10]: del mg_function_ordering[self.FUNCTION_ROLES[0]] if pre_functions: target_set = set() @@ -3105,15 +3197,17 @@ class FundamentalProblemGraph(DataGraph, KeChainMixin): return mdg - def determine_scope_design_variables(self, des_vars=None, coupled_functions_groups=None, pre_coupling_functions=None): - """ - Method to determine the scope (global, local) of the design variables and to determine to which coupled function - groups the design variable belongs. + def determine_scope_design_variables(self, des_vars=None, coupled_functions_groups=None, + pre_coupling_functions=None): + """Method to determine the scope (global, local) of the design variables and to determine to which coupled + function groups the design variable belongs. :param des_vars: list of design variables (if not given, it is taken from the graph) :type des_vars: list :param coupled_functions_groups: list with list of coupled function groups :type coupled_functions_groups: list + :param pre_coupling_functions: list with list of pre-coupled function groups + :type pre_coupling_functions: list :return: list of global design variables, list of local design variables, dictionary with dependencies :rtype: tuple """ @@ -3127,10 +3221,12 @@ class FundamentalProblemGraph(DataGraph, KeChainMixin): des_vars = self.check_and_get_design_variables(des_vars=des_vars) # Get and check coupled function groups - coupled_functions_groups = self.check_and_get_coupled_functions_groups(coupled_functions_groups=coupled_functions_groups) + coupled_functions_groups = \ + self.check_and_get_coupled_functions_groups(coupled_functions_groups=coupled_functions_groups) # Get and check pre-coupling functions - pre_coupling_functions = self.check_and_get_pre_coupling_functions(pre_coupling_functions=pre_coupling_functions) + pre_coupling_functions = \ + self.check_and_get_pre_coupling_functions(pre_coupling_functions=pre_coupling_functions) # Determine the scope of the design variables for des_var in des_vars: @@ -3156,18 +3252,17 @@ class FundamentalProblemGraph(DataGraph, KeChainMixin): def determine_scope_constraint_functions(self, cnstrnt_vars=None, coupled_functions_groups=None, post_coupling_functions=None): - """ - Method to determine the scope (global, local) of the contraint functions based on the constraint variables and - to determine on which coupled function groups the constraint function depends. + """Method to determine the scope (global, local) of the constraint functions based on the constraint variables + and to determine on which coupled function groups the constraint function depends. :param cnstrnt_vars: (optional) constraint variables to be determined :type cnstrnt_vars: list :param coupled_functions_groups: (optional) list of lists with coupled functions groups :type coupled_functions_groups: list - :param post_coupling_functions: (optional) list with post-coupling functionss + :param post_coupling_functions: (optional) list with post-coupling functions :type post_coupling_functions: list - :return: global constraint variables and functions, local constraint variables and functions, groups indices per - constraint function + :return: global constraint variables and functions, local constraint variables and functions, groups indices + per constraint function :rtype: tuple """ @@ -3180,10 +3275,12 @@ class FundamentalProblemGraph(DataGraph, KeChainMixin): cnstrnt_funcs_group_idxs = dict() # Get and check coupled function groups - coupled_functions_groups = self.check_and_get_coupled_functions_groups(coupled_functions_groups=coupled_functions_groups) + coupled_functions_groups = \ + self.check_and_get_coupled_functions_groups(coupled_functions_groups=coupled_functions_groups) # Get and check post-coupling functions - post_coupling_functions = self.check_and_get_post_coupling_functions(post_coupling_functions=post_coupling_functions) + post_coupling_functions = \ + self.check_and_get_post_coupling_functions(post_coupling_functions=post_coupling_functions) # Associate constraint variables with the constraint functions cnstrnt_funcs = dict() @@ -3204,8 +3301,8 @@ class FundamentalProblemGraph(DataGraph, KeChainMixin): linked_groups.append(idx) break if len(linked_groups) == 0: - raise AssertionError( - "Constraint function {} could not be associated with a coupled function group.".format(cnstrnt_func)) + raise AssertionError("Constraint function {} could not be associated with a coupled function " + "group.".format(cnstrnt_func)) elif len(linked_groups) == 1: local_cnstrnt_funcs.append(cnstrnt_func) local_cnstrnt_vars.extend(cnstrnt_funcs[cnstrnt_func]) @@ -3216,13 +3313,24 @@ class FundamentalProblemGraph(DataGraph, KeChainMixin): cnstrnt_vars_group_idxs[cnstrnt_var] = linked_groups cnstrnt_funcs_group_idxs[cnstrnt_func] = linked_groups - return global_cnstrnt_vars, global_cnstrnt_funcs, local_cnstrnt_vars, local_cnstrnt_funcs, cnstrnt_vars_group_idxs, cnstrnt_funcs_group_idxs + return global_cnstrnt_vars, global_cnstrnt_funcs, local_cnstrnt_vars, local_cnstrnt_funcs, \ + cnstrnt_vars_group_idxs, cnstrnt_funcs_group_idxs def get_group_couplings(self, coupled_functions_groups=None): - # TODO: Add docstring + """Method to obtain group couplings and their indices. + + :param coupled_functions_groups: (optional) list of coupled function groups + :type coupled_functions_groups: list + :returns: group couplings present + :rtype: list + :returns: index of coupled groups + :rtype: dict + """ + # TODO: Imco check docstring # Get and check coupled function groups - coupled_functions_groups = self.check_and_get_coupled_functions_groups(coupled_functions_groups=coupled_functions_groups) + coupled_functions_groups = \ + self.check_and_get_coupled_functions_groups(coupled_functions_groups=coupled_functions_groups) all_coupled_functions = [item for sublist in coupled_functions_groups for item in sublist] # Create subgraph of just the coupled functions @@ -3246,7 +3354,18 @@ class FundamentalProblemGraph(DataGraph, KeChainMixin): return group_couplings, group_couplings_groups_idx def get_sys_post_couplings(self, sys_level_post_coupled, coupled_functions_groups=None): - # TODO: Add docstring + """Method to obtain the system-level post-couplings functions. + + :param sys_level_post_coupled: nodes with attributed problem role 'post-coupling' + :type sys_level_post_coupled: list + :param coupled_functions_groups: (optional) list of coupled function groups + :type coupled_functions_groups: list + :returns: system-level post-coupling functions + :rtype: list + :returns: indices ot system-level post-coupling functions + :rtype: dict + """ + # TODO: Imco check docstring # Check system-level post-coupling functions for fun in sys_level_post_coupled: @@ -3256,7 +3375,8 @@ class FundamentalProblemGraph(DataGraph, KeChainMixin): 'Node {} is does not have problem_role {}.'.format(fun, self.FUNCTION_ROLES[2]) # Get and check coupled function groups - coupled_functions_groups = self.check_and_get_coupled_functions_groups(coupled_functions_groups=coupled_functions_groups) + coupled_functions_groups = \ + self.check_and_get_coupled_functions_groups(coupled_functions_groups=coupled_functions_groups) all_coupled_functions = [item for sublist in coupled_functions_groups for item in sublist] # Create subgraph of just the coupled and system-level post-coupling functions @@ -3281,8 +3401,20 @@ class FundamentalProblemGraph(DataGraph, KeChainMixin): return sys_post_couplings, sys_post_couplings_groups_idx - def get_system_level_functions(self, global_objective_function, global_cnstrnt_functions, mg_function_ordering=None): - # TODO: Add docstring + def get_system_level_functions(self, global_objective_function, global_cnstrnt_functions, + mg_function_ordering=None): + """Method to obtain system level functions + + :param global_objective_function: global objective function + :type global_objective_function: str + :param global_cnstrnt_functions: global constraint function(s) + :type global_cnstrnt_functions: list + :param mg_function_ordering: MdaoGraph function ordering + :type mg_function_ordering: dict + :return: system level functions + :rtype: dict + """ + # TODO: Imco check docstring # Initiate dictionary global_functions = [global_objective_function] + global_cnstrnt_functions @@ -3322,8 +3454,22 @@ class FundamentalProblemGraph(DataGraph, KeChainMixin): global_functions+additional_post_couplings] return system_level_function_dict - def get_sub_level_functions(self, local_objective_function, local_cnstrnt_funcs, coupled_functions_group, mg_function_ordering=None): - # TODO: Add docstring + def get_sub_level_functions(self, local_objective_function, local_cnstrnt_funcs, coupled_functions_group, + mg_function_ordering=None): + """Method to obtain subsystem level functions. + + :param local_objective_function: local objective function + :type local_objective_function: str + :param local_cnstrnt_funcs: local constraint function(s) + :type local_cnstrnt_funcs: list + :param coupled_functions_group: coupled functions + :type coupled_functions_group: list + :param mg_function_ordering: (optional) MdaoGraph function ordering + :type mg_function_ordering: dict + :return: subsystem level functions + :rtype: dict + """ + # TODO: Imco check docstring # Initiate dictionary local_objective_function_list = [] if local_objective_function is None else [local_objective_function] @@ -3361,19 +3507,41 @@ class FundamentalProblemGraph(DataGraph, KeChainMixin): return sub_level_function_dict def check_and_get_pre_coupling_functions(self, pre_coupling_functions=None): + """Method to obtain the pre-coupled functions and check them if provided + + :param pre_coupling_functions: (optional) pre-coupled function nodes + :type pre_coupling_functions: list + :return: pre-coupled function nodes + :rtype: list + + Checks whether the function is a node of the graph with the problem role 'pre-coupled' + """ + if not pre_coupling_functions: pre_coupling_functions = self.graph['problem_formulation']['function_ordering']['pre-coupling'] assert isinstance(pre_coupling_functions, list), \ 'The pre_coupling_functions input should be a list.' for pre_coupling_function in pre_coupling_functions: - assert self.has_node(pre_coupling_function), 'Function {} is not a node in the graph.'.format(pre_coupling_function) - assert 'problem_role' in self.node[pre_coupling_function], \ + assert self.has_node(pre_coupling_function), \ + 'Function {} is not a node in the graph.'.format(pre_coupling_function) + assert 'problem_role' in self.nodes[pre_coupling_function], \ 'Function {} does not have a problem role.'.format(pre_coupling_function) - assert self.node[pre_coupling_function]['problem_role'] == self.FUNCTION_ROLES[0], \ - 'Pre-coupled function {} lacks the problem role "{}".'.format(pre_coupling_function, self.FUNCTION_ROLES[0]) + assert self.nodes[pre_coupling_function]['problem_role'] == self.FUNCTION_ROLES[0], \ + 'Pre-coupled function {} lacks the problem ' \ + 'role "{}".'.format(pre_coupling_function, self.FUNCTION_ROLES[0]) return pre_coupling_functions def check_and_get_coupled_functions_groups(self, coupled_functions_groups=None): + """Method to obtain the coupled functions and check them if provided + + :param coupling_functions_groups: (optional) coupled function groups + :type coupling_functions_groups: list + :return: coupled function groups + :rtype: list + + Checks whether the function is a node of the graph with the problem role 'coupled' + """ + if not coupled_functions_groups: coupled_functions_groups = self.graph['problem_formulation']['coupled_functions_groups'] functions_found = [] @@ -3383,9 +3551,9 @@ class FundamentalProblemGraph(DataGraph, KeChainMixin): 'The elements of the coupled_functions_groups should be lists.' for func in coupled_functions_group: assert self.has_node(func), 'Function {} is not a node in the graph.'.format(func) - assert 'problem_role' in self.node[func], \ + assert 'problem_role' in self.nodes[func], \ 'Function {} does not have a problem role.'.format(func) - assert self.node[func]['problem_role'] == self.FUNCTION_ROLES[1], \ + assert self.nodes[func]['problem_role'] == self.FUNCTION_ROLES[1], \ 'Coupled function {} lacks the problem role "{}".'.format(func, self.FUNCTION_ROLES[1]) assert func not in functions_found, \ 'Coupled function {} is present multiple times in the coupled_functions_group.'.format(func) @@ -3393,25 +3561,46 @@ class FundamentalProblemGraph(DataGraph, KeChainMixin): return coupled_functions_groups def check_and_get_post_coupling_functions(self, post_coupling_functions=None): + """Method to obtain the post-coupled functions and check them if provided + + :param post_coupling_functions: (optional) post-coupled function nodes + :type post_coupling_functions: list + :return: post-coupled function nodes + :rtype: list + + Checks whether the function is a node of the graph with the problem role 'post-coupled' + """ + if not post_coupling_functions: post_coupling_functions = self.graph['problem_formulation']['function_ordering']['post-coupling'] assert isinstance(post_coupling_functions, list), \ 'The post_coupling_functions input should be a list.' for post_coupling_function in post_coupling_functions: - assert self.has_node(post_coupling_function), 'Function {} is not a node in the graph.'.format(post_coupling_function) - assert 'problem_role' in self.node[post_coupling_function], \ + assert self.has_node(post_coupling_function), \ + 'Function {} is not a node in the graph.'.format(post_coupling_function) + assert 'problem_role' in self.nodes[post_coupling_function], \ 'Function {} does not have a problem role.'.format(post_coupling_function) - assert self.node[post_coupling_function]['problem_role'] == self.FUNCTION_ROLES[2], \ - 'Post-coupled function {} lacks the problem role "{}".'.format(post_coupling_function, self.FUNCTION_ROLES[2]) + assert self.nodes[post_coupling_function]['problem_role'] == self.FUNCTION_ROLES[2], \ + 'Post-coupled function {} lacks the problem ' \ + 'role "{}".'.format(post_coupling_function, self.FUNCTION_ROLES[2]) return post_coupling_functions def check_and_get_design_variables(self, des_vars=None): + """Method to obtain the design variable nodes and check them if provided + + :param des_vars: (optional) design variable nodes + :type des_vars: list + :return: design variable nodes + :rtype: list + + Checks whether the function is a node of the graph with the problem role 'design variable' + """ if des_vars: for des_var in des_vars: assert self.has_node(des_var), 'Design variable {} is not a node in the graph.'.format(des_var) - assert 'problem_role' in self.node[des_var], \ + assert 'problem_role' in self.nodes[des_var], \ 'Design variable {} does not have a problem role.'.format(des_var) - assert self.node[des_var]['problem_role'] == self.PROBLEM_ROLES_VARS[0], \ + assert self.nodes[des_var]['problem_role'] == self.PROBLEM_ROLES_VARS[0], \ 'Design variable {} lacks the problem role "{}".'.format(des_var, self.PROBLEM_ROLES_VARS[0]) else: des_vars = self.find_all_nodes(category='variable', @@ -3420,8 +3609,7 @@ class FundamentalProblemGraph(DataGraph, KeChainMixin): return des_vars def _analyze_distributed_system(self, des_var_nodes, objective_node, constraint_nodes, mg_function_ordering): - """ - Method to analyze an FPG as a distributed system to asses local and global functions and variables. + """Method to analyze an FPG as a distributed system to asses local and global functions and variables. :param des_var_nodes: design variable nodes in the graph :type des_var_nodes: list @@ -3447,26 +3635,21 @@ class FundamentalProblemGraph(DataGraph, KeChainMixin): # TODO: Assert that objective function only has one output # Determine local and global design variables - global_des_vars, \ - local_des_vars, \ - des_vars_group_idxs = self.determine_scope_design_variables(des_vars=des_var_nodes) + global_des_vars, local_des_vars, des_vars_group_idxs = \ + self.determine_scope_design_variables(des_vars=des_var_nodes) # TODO: assess that each discipline group is dependent on at least one design variable (?) # Get global and local constraints and their functions - global_cnstrnt_vars, \ - global_cnstrnt_funcs, \ - local_cnstrnt_vars, \ - local_cnstrnt_funcs, \ - cnstrnt_vars_group_idxs, \ + global_cnstrnt_vars, global_cnstrnt_funcs, local_cnstrnt_vars, local_cnstrnt_funcs, cnstrnt_vars_group_idxs, \ cnstrnt_funcs_group_idxs = self.determine_scope_constraint_functions(cnstrnt_vars=constraint_nodes) # Create dictionary of pre-desvar, post-desvar, and post-coupling functions for the system optimizer sys_functions_dict = self.get_system_level_functions(global_objective_function, global_cnstrnt_funcs, - mg_function_ordering=mg_function_ordering) + mg_function_ordering=mg_function_ordering) # Determine couplings between coupled groups and system-level post-coupling functions - add_group_couplings, \ - add_group_couplings_groups_idx = self.get_sys_post_couplings(sys_functions_dict[self.FUNCTION_ROLES[2]]) + add_group_couplings, add_group_couplings_groups_idx = \ + self.get_sys_post_couplings(sys_functions_dict[self.FUNCTION_ROLES[2]]) # Add additional couplings to the group_couplings for add_group_coupling in add_group_couplings: @@ -3483,8 +3666,8 @@ class FundamentalProblemGraph(DataGraph, KeChainMixin): if idx in groups: local_cnstrnt_funcs_group.append(cnstrnt_func) subsys_functions_dict = self.get_sub_level_functions(None, local_cnstrnt_funcs_group, - coupled_functions_group, - mg_function_ordering=mg_function_ordering) + coupled_functions_group, + mg_function_ordering=mg_function_ordering) # Create dict collecting the subsystem functions dictionary subsys_functions_dicts.append(subsys_functions_dict) @@ -3498,8 +3681,7 @@ class FundamentalProblemGraph(DataGraph, KeChainMixin): 'functions_dicts': [sys_functions_dict, subsys_functions_dicts]} def get_objective_node(self): - """ - Method to get the single (or non-existent) objective node from a graph. + """Method to get the single (or non-existent) objective node from a graph. :return: objective node or None if no objective node is present :rtype: str, None @@ -3512,8 +3694,7 @@ class FundamentalProblemGraph(DataGraph, KeChainMixin): return None def get_mdg(self, name='MDG'): - """ - Create the MDAO data graph for a given FPG. + """Create the MDAO data graph for a given FPG. :param name: name of the new graph :type name: basestring @@ -3748,7 +3929,7 @@ class FundamentalProblemGraph(DataGraph, KeChainMixin): function_order.extend([self.OPTIMIZER_STRING]) function_order.extend([target for target in targets if target not in function_order]) mdg.split_variables(var, function_order=function_order) - elif mdao_arch == graph.OPTIONS_ARCHITECTURES[8]: # CO + elif mdao_arch == graph.OPTIONS_ARCHITECTURES[8]: # CO coupled_functions_groups = graph.graph['problem_formulation']['coupled_functions_groups'] n_groups = len(coupled_functions_groups) sys_opt, sub_opts = self.get_architecture_node_ids('CO', number_of_groups=n_groups) @@ -3757,7 +3938,7 @@ class FundamentalProblemGraph(DataGraph, KeChainMixin): sa = self._analyze_distributed_system(des_var_nodes, objective_node, constraint_nodes, mg_function_ordering) # TODO: Assert that function instances are not required (future functionality) - # TODO: Determine the functions that require instances, add them, and adjust subsys_functions_dict accordingly + # TODO: Determine the functions requiring instances, add them and adjust subsys_functions_dict accordingly # sys_functions_dict, subsys_functions_dicts = graph.create_function_instances(sys_functions_dict, # subsys_functions_dicts) @@ -3770,8 +3951,7 @@ class FundamentalProblemGraph(DataGraph, KeChainMixin): for idx, subsys_functions_dict in enumerate(sa['functions_dicts'][1]): # Get global and local design nodes and local constraint nodes involved in the group subsys_functions = [item for sublist in subsys_functions_dict.values() for item in sublist] - global_des_vars_group, local_des_vars_group, \ - local_cnstrnt_vars_group, local_group_couplings_group, \ + global_des_vars_group, local_des_vars_group, local_cnstrnt_vars_group, local_group_couplings_group, \ external_group_couplings_group = get_group_vars(sa, idx) # Make the groups local by introducing the right copies @@ -3779,8 +3959,7 @@ class FundamentalProblemGraph(DataGraph, KeChainMixin): mdg.localize_design_variables(subsys_functions, global_des_vars_group, local_des_vars_group) sys_lev_des_vars.update(global_des_vars_copies_group) - external_group_couplings_copies_group, \ - local_group_couplings_copies_group, \ + external_group_couplings_copies_group, local_group_couplings_copies_group, \ mapping_locals= mdg.localize_group_couplings(subsys_functions, external_group_couplings_group, local_group_couplings_group) @@ -3828,15 +4007,15 @@ class FundamentalProblemGraph(DataGraph, KeChainMixin): elif mdao_arch == graph.OPTIONS_ARCHITECTURES[9]: # BLISS-2000 coupled_functions_groups = graph.graph['problem_formulation']['coupled_functions_groups'] n_groups = len(coupled_functions_groups) - sys_opt, sys_conv, sys_sms, sub_smbds, sub_does, \ - sub_opts, sub_smbs = self.get_architecture_node_ids(mdao_arch, number_of_groups=n_groups) + sys_opt, sys_conv, sys_sms, sub_smbds, sub_does, sub_opts, sub_smbs = \ + self.get_architecture_node_ids(mdao_arch, number_of_groups=n_groups) sys_opt_label, sys_conv_label, sys_sms_labels, sub_smbds_labels, sub_does_labels, sub_opts_labels, \ sub_smbs_labels = self.get_architecture_node_labels(mdao_arch, number_of_groups=n_groups) sa = self._analyze_distributed_system(des_var_nodes, objective_node, constraint_nodes, mg_function_ordering) # TODO: Assert that function instances are not required (future functionality) - # TODO: Determine the functions that require instances, add them, and adjust subsys_functions_dict accordingly + # TODO: Determine the functions requiring instances, add them, and adjust subsys_functions_dict accordingly # sys_functions_dict, subsys_functions_dicts = graph.create_function_instances(sys_functions_dict, # subsys_functions_dicts) @@ -3855,33 +4034,32 @@ class FundamentalProblemGraph(DataGraph, KeChainMixin): for idx, subsys_functions_dict in enumerate(sa['functions_dicts'][1]): # Get global and local design nodes and local constraint nodes involved in the group subsys_functions = [item for sublist in subsys_functions_dict.values() for item in sublist] - global_des_vars_group, local_des_vars_group, \ - local_cnstrnt_vars_group, local_group_couplings_group, \ + global_des_vars_group, local_des_vars_group, local_cnstrnt_vars_group, local_group_couplings_group, \ external_group_couplings_group = get_group_vars(sa, idx) # Make the groups local by introducing the right copies local_des_vars_copies_group, global_des_vars_copies_group, mapping_des_vars = \ mdg.localize_design_variables(subsys_functions, global_des_vars_group, local_des_vars_group) - external_group_couplings_copies_group, \ - local_group_couplings_copies_group, \ - mapping_locals = mdg.localize_group_couplings(subsys_functions, external_group_couplings_group+ + external_group_couplings_copies_group, local_group_couplings_copies_group, \ + mapping_locals = mdg.localize_group_couplings(subsys_functions, external_group_couplings_group + prev_local_group_couplings_copies, local_group_couplings_group, instances_for_externals=True) # Add the weighted couplings objective function according to BLISS-2000 - group_wcf_node, group_wcf_obj_node, weight_nodes = mdg.connect_weighted_couplings_objective_function(idx, local_group_couplings_group) + group_wcf_node, group_wcf_obj_node, weight_nodes = \ + mdg.connect_weighted_couplings_objective_function(idx, local_group_couplings_group) sa['functions_dicts'][1][idx][mdg.FUNCTION_ROLES[2]].append(group_wcf_node) # Add and connect the sub-level optimizer fin_des_vars, _, _, _ = mdg.connect_optimizer(sub_opts[idx], local_des_vars_group, group_wcf_obj_node, - local_cnstrnt_vars_group, label=sub_opts_labels[idx]) + local_cnstrnt_vars_group, label=sub_opts_labels[idx]) # Add local coupling nodes as final output in the graph lgcg_finals = [] for node in local_group_couplings_group: lgcg_final = mdg.copy_node_as(node, - mdg.ARCHITECTURE_ROLES_VARS[5], # final output variables + mdg.ARCHITECTURE_ROLES_VARS[5], # final output variables add_instance_if_exists=True) lgcg_finals.append(lgcg_final) source = mdg.get_sources(node)[0] @@ -3889,7 +4067,7 @@ class FundamentalProblemGraph(DataGraph, KeChainMixin): # Add and connect the sub-level DOE doe_inps, doe_outs = mdg.connect_doe_block(sub_does[idx], - external_group_couplings_copies_group+ + external_group_couplings_copies_group + local_des_vars_copies_group+weight_nodes, lgcg_finals+fin_des_vars) @@ -3919,7 +4097,8 @@ class FundamentalProblemGraph(DataGraph, KeChainMixin): mdg.mark_as_design_variable(node2, ignore_outdegree=True) sm_inps.extend(global_des_vars_group) sm_out_originals = [mdg.nodes[node]['related_to_schema_node'] for node in lgcg_finals+fin_des_vars] - sm_outs = mdg.connect_surrogate_model(sys_sms[idx], sm_def_node, sm_inps, sm_out_originals, label=sys_sms_labels[idx]) + sm_outs = mdg.connect_surrogate_model(sys_sms[idx], sm_def_node, sm_inps, sm_out_originals, + label=sys_sms_labels[idx]) sm_inps_lists.append(sm_inps) sms_ins.extend(sm_inps) sms_outs.extend(sm_outs) @@ -3942,10 +4121,12 @@ class FundamentalProblemGraph(DataGraph, KeChainMixin): mdg.add_edge(sm_node, func) # Create and connect the consistency constraint function - sms_outs_couplings = [node for node in sms_outs if mdg.nodes[node]['related_to_schema_node'] in sa['couplings']['basic']] + sms_outs_couplings = [node for node in sms_outs if mdg.nodes[node]['related_to_schema_node'] in + sa['couplings']['basic']] sms_outs_couplings_related = [mdg.nodes[node]['related_to_schema_node'] for node in sms_outs_couplings] sms_ins2 = [node for node in sms_ins if 'related_to_schema_node' in mdg.nodes[node]] - sms_ins_couplings = [node for node in sms_ins2 if mdg.nodes[node]['related_to_schema_node'] in sa['couplings']['basic']] + sms_ins_couplings = [node for node in sms_ins2 if mdg.nodes[node]['related_to_schema_node'] in + sa['couplings']['basic']] sms_ins_couplings_related = [mdg.nodes[node]['related_to_schema_node'] for node in sms_ins_couplings] ccf_mapping = dict() for sms_out, sms_out_related in zip(sms_outs_couplings, sms_outs_couplings_related): @@ -3959,7 +4140,7 @@ class FundamentalProblemGraph(DataGraph, KeChainMixin): # Connect the system-level optimizer fin_des_vars, _, _, ini_guess_nodes = mdg.connect_optimizer(sys_opt, - list(sys_lev_des_vars)+weight_nodes2+ + list(sys_lev_des_vars)+weight_nodes2 + ccf_mapping.values(), objective_node, list(sys_lev_cnstrnts)+cc_nodes, label=sys_opt_label) @@ -3980,7 +4161,8 @@ class FundamentalProblemGraph(DataGraph, KeChainMixin): # First the initial guesses if 'related_to_schema_node' in mdg.nodes[smbo_source]: if mdg.nodes[smbo_source]['related_to_schema_node'] in ini_guess_nodes_related: - ini_inp = ini_guess_nodes[ini_guess_nodes_related.index(mdg.nodes[smbo_source]['related_to_schema_node'])] + ini_inp = ini_guess_nodes[ini_guess_nodes_related.index(mdg.nodes[smbo_source] + ['related_to_schema_node'])] else: raise NotImplementedError('Could not find related node.') else: @@ -3991,7 +4173,8 @@ class FundamentalProblemGraph(DataGraph, KeChainMixin): # Then the final values if 'related_to_schema_node' in mdg.nodes[smbo_source]: if mdg.nodes[smbo_source]['related_to_schema_node'] in fin_val_nodes_related: - fin_inp = fin_des_vars[fin_val_nodes_related.index(mdg.nodes[smbo_source]['related_to_schema_node'])] + fin_inp = fin_des_vars[fin_val_nodes_related.index(mdg.nodes[smbo_source] + ['related_to_schema_node'])] else: raise NotImplementedError('Could not find related node.') else: @@ -4015,8 +4198,7 @@ class FundamentalProblemGraph(DataGraph, KeChainMixin): return mdg def impose_mdao_architecture(self): - """ - Method to directly get both the MDG and MPG of an FPG. + """Method to directly get both the MDG and MPG of an FPG. :return: MdaoDataGraph and MdaoProcessGraph :rtype: tuple @@ -4082,7 +4264,7 @@ class MdaoDataGraph(DataGraph, MdaoMixin): category='A', i=i) for node in func_nodes: - category_check, i_not = check('architecture_role' not in self.node[node], + category_check, i_not = check('architecture_role' not in self.nodes[node], 'The architecture_role attribute is missing on the node %s.' % node, status=category_check, category='A', @@ -4140,23 +4322,23 @@ class MdaoDataGraph(DataGraph, MdaoMixin): cmdows_executable_block_elem = cmdows_executable_block.add(make_camel_case(architecture_roles_fun)) cmdows_executable_block_elem.set('uID', graph_node) - cmdows_executable_block_elem.add('label', self.node[graph_node].get('label')) + cmdows_executable_block_elem.add('label', self.nodes[graph_node].get('label')) if architecture_roles_fun == 'optimizer': - cmdows_executable_block_elem.add('settings', self.node[graph_node].get('settings'), + cmdows_executable_block_elem.add('settings', self.nodes[graph_node].get('settings'), camel_case_conversion=True) - graph_des_vars = [{'designVariableUID': self.PROBLEM_ROLES_VAR_SUFFIXES[0]+var} for var in - self.node[graph_node].get('design_variables')] + graph_des_vars = [{'designVariableUID': self.PROBLEM_ROLES_VAR_SUFFIXES[0] + var} for var in + self.nodes[graph_node].get('design_variables')] cmdows_executable_block_elem.add('designVariables', graph_des_vars) graph_obj_vars = [{'objectiveVariableUID': self.PROBLEM_ROLES_VAR_SUFFIXES[1] + var} for var in - self.node[graph_node].get('objective_variable')] + self.nodes[graph_node].get('objective_variable')] cmdows_executable_block_elem.add('objectiveVariables', graph_obj_vars) graph_con_vars = [{'constraintVariableUID': self.PROBLEM_ROLES_VAR_SUFFIXES[2] + var} for var in - self.node[graph_node].get('constraint_variables')] + self.nodes[graph_node].get('constraint_variables')] cmdows_executable_block_elem.add('constraintVariables', graph_con_vars) elif architecture_roles_fun == 'doe': - graph_settings = self.node[graph_node].get('settings') + graph_settings = self.nodes[graph_node].get('settings') if graph_settings is not None: cmdows_settings = cmdows_executable_block_elem.add('settings') cmdows_settings.add('doeMethod', graph_settings.get('doe_method')) @@ -4164,18 +4346,20 @@ class MdaoDataGraph(DataGraph, MdaoMixin): cmdows_settings.add('doeRuns', graph_settings.get('doe_runs')) if graph_settings.get('doe_seed') is not None: cmdows_settings.add('doeSeed', graph_settings.get('doe_seed')) - if graph_settings.get('doe_table') is not None: # TODO: Temp fix, doe should always have settings + if graph_settings.get('doe_table') is not None: # TODO: Temp fix, doe should have settings cmdows_table = cmdows_settings.add('doeTable') for graph_row_index, graph_row in enumerate(graph_settings.get('doe_table_order')): - cmdows_row = cmdows_table.add('tableRow', attrib={'relatedParameterUID': str(graph_row)}) + cmdows_row = cmdows_table.add('tableRow', + attrib={'relatedParameterUID': str(graph_row)}) for graph_element_index, graph_element in enumerate(graph_settings.get('doe_table')): - cmdows_row.add('tableElement', str(format(float(graph_element[graph_row_index]),'.12f')), + cmdows_row.add('tableElement', str(format(float(graph_element[graph_row_index]), + '.12f')), attrib={'experimentID': str(graph_element_index)}) graph_des_vars = [{'designVariableUID': self.PROBLEM_ROLES_VAR_SUFFIXES[0] + var} for var in - self.node[graph_node].get('design_variables')] + self.nodes[graph_node].get('design_variables')] cmdows_executable_block_elem.add('designVariables', graph_des_vars) else: - cmdows_executable_block_elem.add('settings', self.node[graph_node].get('settings'), + cmdows_executable_block_elem.add('settings', self.nodes[graph_node].get('settings'), camel_case_conversion=True) # Create architectureElements/executableBlocks/...Analyses/... @@ -4226,37 +4410,42 @@ class MdaoDataGraph(DataGraph, MdaoMixin): if role == 'optimizer' or role == 'doe': cmdows_des_vars = cmdows_single_architecture_exe_block.findall('designVariables/designVariable') graph_des_vars = [var.findtext('designVariableUID')[10:] for var in list(cmdows_des_vars)] - self.node[cmdows_uid]['design_variables'] = graph_des_vars + self.nodes[cmdows_uid]['design_variables'] = graph_des_vars if role == 'converger' or role == 'optimizer': - if 'settings' not in self.node[cmdows_uid] or self.node[cmdows_uid]['settings'] is None: - self.node[cmdows_uid]['settings'] = {} + if 'settings' not in self.nodes[cmdows_uid] or self.nodes[cmdows_uid]['settings'] is None: + self.nodes[cmdows_uid]['settings'] = {} if role == 'converger': - setting_options = {'last_iterations_to_consider':'lastIterationsToConsider', - 'maximum_iterations':'maximumIterations', - 'convergence_tolerance_relative':'convergenceToleranceRelative', - 'convergence_tolerance_absolute':'convergenceToleranceAbsolute'} + setting_options = {'last_iterations_to_consider': 'lastIterationsToConsider', + 'maximum_iterations': 'maximumIterations', + 'convergence_tolerance_relative': 'convergenceToleranceRelative', + 'convergence_tolerance_absolute': 'convergenceToleranceAbsolute'} else: - setting_options = {'maximum_iterations':'maximumIterations', - 'algorithm':'algorithm', - 'apply_scaling':'applyScaling', - 'maximum_function_evaluations':'maximumFunctionEvaluations', - 'constraint_tolerance':'constraintTolerance', - 'convergence_tolerance':'convergenceTolerance'} + setting_options = {'maximum_iterations': 'maximumIterations', + 'algorithm': 'algorithm', + 'apply_scaling': 'applyScaling', + 'maximum_function_evaluations': 'maximumFunctionEvaluations', + 'constraint_tolerance': 'constraintTolerance', + 'convergence_tolerance': 'convergenceTolerance'} for setting_option in setting_options: if setting_option == 'apply_scaling': - bool_options = {'true':True,'false':False} - self.node[cmdows_uid]['settings'][setting_option] = \ - bool_options[cmdows_single_architecture_exe_block.findtext('settings/'+setting_options[setting_option])] + bool_options = {'true': True, 'false': False} + self.nodes[cmdows_uid]['settings'][setting_option] = \ + bool_options[cmdows_single_architecture_exe_block.findtext('settings/' + + setting_options + [setting_option])] else: - self.node[cmdows_uid]['settings'][setting_option] = \ - cmdows_single_architecture_exe_block.findtext('settings/'+setting_options[setting_option]) + self.nodes[cmdows_uid]['settings'][setting_option] = \ + cmdows_single_architecture_exe_block.findtext('settings/' + + setting_options[setting_option]) if role == 'optimizer': - cmdows_des_vars = cmdows_single_architecture_exe_block.findall('objectiveVariables/objectiveVariable') + cmdows_des_vars = \ + cmdows_single_architecture_exe_block.findall('objectiveVariables/objectiveVariable') graph_des_vars = [var.findtext('objectiveVariableUID')[10:] for var in list(cmdows_des_vars)] - self.node[cmdows_uid]['objective_variable'] = graph_des_vars - cmdows_des_vars = cmdows_single_architecture_exe_block.findall('constraintVariables/constraintVariable') + self.nodes[cmdows_uid]['objective_variable'] = graph_des_vars + cmdows_des_vars = \ + cmdows_single_architecture_exe_block.findall('constraintVariables/constraintVariable') graph_des_vars = [var.findtext('constraintVariableUID')[10:] for var in list(cmdows_des_vars)] - self.node[cmdows_uid]['constraint_variables'] = graph_des_vars + self.nodes[cmdows_uid]['constraint_variables'] = graph_des_vars elif role == 'doe': cmdows_rows = list(cmdows_single_architecture_exe_block.findall('settings/doeTable/tableRow')) graph_rows = [cmdows_row.get('relatedParameterUID') for cmdows_row in cmdows_rows] @@ -4267,23 +4456,26 @@ class MdaoDataGraph(DataGraph, MdaoMixin): elements = sorted(cmdows_row, key=get_experiment_id) entry = [] for element in elements: - entry.append(format(element.findasttext(),'.12f')) + entry.append(format(element.findasttext(), '.12f')) graph_table.append(entry) graph_table = map(list, zip(*graph_table)) - if 'settings' not in self.node[cmdows_uid] or self.node[cmdows_uid]['settings'] is None: - self.node[cmdows_uid]['settings'] = {} - self.node[cmdows_uid]['settings']['doe_table_order'] = graph_rows - self.node[cmdows_uid]['settings']['doe_table'] = graph_table - self.node[cmdows_uid]['settings']['doe_method'] = cmdows_single_architecture_exe_block.findtext('settings/doeMethod') - self.node[cmdows_uid]['settings']['doe_runs'] = cmdows_single_architecture_exe_block.findtext('settings/doeRuns') - self.node[cmdows_uid]['settings']['doe_seed'] = cmdows_single_architecture_exe_block.findtext('settings/doeSeed') + if 'settings' not in self.nodes[cmdows_uid] or self.nodes[cmdows_uid]['settings'] is None: + self.nodes[cmdows_uid]['settings'] = {} + self.nodes[cmdows_uid]['settings']['doe_table_order'] = graph_rows + self.nodes[cmdows_uid]['settings']['doe_table'] = graph_table + self.nodes[cmdows_uid]['settings']['doe_method'] = \ + cmdows_single_architecture_exe_block.findtext('settings/doeMethod') + self.nodes[cmdows_uid]['settings']['doe_runs'] = \ + cmdows_single_architecture_exe_block.findtext('settings/doeRuns') + self.nodes[cmdows_uid]['settings']['doe_seed'] = \ + cmdows_single_architecture_exe_block.findtext('settings/doeSeed') else: for role in self.ARCHITECTURE_ROLES_FUNS: cmdows_role_name = make_camel_case(role) if cmdows_single_architecture_exe_block.tag == cmdows_role_name: cmdows_uid = cmdows_single_architecture_exe_block.find('relatedExecutableBlockUID').text - self.node[cmdows_uid]['architecture_role'] = role + self.nodes[cmdows_uid]['architecture_role'] = role # ---------------------------------------------------------------------------------------------------------------- # # GRAPH SPECIFIC METHODS # @@ -4316,14 +4508,14 @@ class MdaoDataGraph(DataGraph, MdaoMixin): if self.FUNCTION_ROLES[0] in mg_function_ordering: functions = mg_function_ordering[self.FUNCTION_ROLES[0]] for func in functions: - self.node[func]['architecture_role'] = self.ARCHITECTURE_ROLES_FUNS[4] + self.nodes[func]['architecture_role'] = self.ARCHITECTURE_ROLES_FUNS[4] # Optimizer / DOE present if self.FUNCTION_ROLES[3] in mg_function_ordering: # Add pre-optimizer functions functions = mg_function_ordering[self.FUNCTION_ROLES[3]] for func in functions: - self.node[func]['architecture_role'] = 'pre-iterator analysis' + self.nodes[func]['architecture_role'] = 'pre-iterator analysis' # Add optimizer / DOE if mdao_arch in self.OPTIONS_ARCHITECTURES[2:5]: # IDF, MDF, unc-OPT assert not self.has_node(self.OPTIMIZER_STRING), 'Optimizer name already in use in FPG.' @@ -4349,7 +4541,7 @@ class MdaoDataGraph(DataGraph, MdaoMixin): # Add architecture role to post-iterator functions functions = mg_function_ordering[self.FUNCTION_ROLES[4]] for func in functions: - self.node[func]['architecture_role'] = self.ARCHITECTURE_ROLES_FUNS[6] + self.nodes[func]['architecture_role'] = self.ARCHITECTURE_ROLES_FUNS[6] # Converger required if mdao_arch in [self.OPTIONS_ARCHITECTURES[1]] + [self.OPTIONS_ARCHITECTURES[3]] + \ @@ -4378,12 +4570,12 @@ class MdaoDataGraph(DataGraph, MdaoMixin): # Add architecture role to coupled functions for func in mg_function_ordering[self.FUNCTION_ROLES[1]]: - self.node[func]['architecture_role'] = self.ARCHITECTURE_ROLES_FUNS[7] + self.nodes[func]['architecture_role'] = self.ARCHITECTURE_ROLES_FUNS[7] # Add post-coupling functions for func in mg_function_ordering[self.FUNCTION_ROLES[2]]: if func != self.CONSCONS_STRING: - self.node[func]['architecture_role'] = self.ARCHITECTURE_ROLES_FUNS[8] + self.nodes[func]['architecture_role'] = self.ARCHITECTURE_ROLES_FUNS[8] else: assert not self.has_node(self.CONSCONS_STRING), 'Consistency constraint name already in use in FPG.' self.add_node(self.CONSCONS_STRING, @@ -4452,7 +4644,7 @@ class MdaoDataGraph(DataGraph, MdaoMixin): else: raise IOError('Label extension could not be found.') - node_data_dict = dict(self.node[node]) + node_data_dict = dict(self.nodes[node]) # Determine the related schema node if 'related_to_schema_node' in node_data_dict: @@ -4496,8 +4688,8 @@ class MdaoDataGraph(DataGraph, MdaoMixin): schema_related_nodes = self.find_all_nodes(category='variable', attr_cond=['related_to_schema_node', '==', node]) for schema_related_node in schema_related_nodes: - if 'architecture_role' in self.node[schema_related_node]: - if self.node[schema_related_node]['architecture_role'] in \ + if 'architecture_role' in self.nodes[schema_related_node]: + if self.nodes[schema_related_node]['architecture_role'] in \ get_list_entries(self.ARCHITECTURE_ROLES_VARS, 1, 4, 5): node = schema_related_node self.add_edge(node, function) @@ -4676,7 +4868,7 @@ class MdaoDataGraph(DataGraph, MdaoMixin): # Create a local copy of the design variable local_des_var_copy = self.copy_node_as(global_des_var, - self.ARCHITECTURE_ROLES_VARS[9], # copy design variable + self.ARCHITECTURE_ROLES_VARS[9], # copy design variable add_instance_if_exists=True) local_des_var_copies.append(local_des_var_copy) mapping[global_des_var] = local_des_var_copy @@ -4710,7 +4902,8 @@ class MdaoDataGraph(DataGraph, MdaoMixin): return local_des_var_copies, global_des_var_copies, mapping - def localize_group_couplings(self, group_functions, external_couplings, local_couplings, instances_for_externals=False): + def localize_group_couplings(self, group_functions, external_couplings, local_couplings, + instances_for_externals=False): """Method for distributed architecture to create instances of local and global coupling variables with respect to the subgroup. @@ -4851,7 +5044,6 @@ class MdaoDataGraph(DataGraph, MdaoMixin): return conv_check_node - def connect_converger(self, converger, conv_type, coupling_functions, include_couplings_as_final_output, system_converger=False, label='CONV'): """Method to automatically connect a converger around a collection of coupled functions. @@ -4864,6 +5056,10 @@ class MdaoDataGraph(DataGraph, MdaoMixin): :type coupling_functions: list :param include_couplings_as_final_output: setting on whether coupling variables should always be added as output :type include_couplings_as_final_output: bool + :param system_converger: converger is a system converger + :type system_converger: bool + :param label: converger label + :type label: str """ # Input assertions @@ -4911,6 +5107,8 @@ class MdaoDataGraph(DataGraph, MdaoMixin): :type objective_node: basestring :param constraint_nodes: list of constraint nodes :type constraint_nodes: list + :param label: optimizer label + :type label: str :return: enriched MDAO data graph with connected optimizer :rtype: MdaoDataGraph """ @@ -4923,12 +5121,12 @@ class MdaoDataGraph(DataGraph, MdaoMixin): architecture_role=self.ARCHITECTURE_ROLES_FUNS[1], label=label, instance=1, - settings = {'algorithm': 'Dakota Quasi-Newton method', - 'maximum_iterations': 1000, - 'maximum_function_evaluations': 1000, - 'constraint_tolerance': 1e-4, - 'convergence_tolerance': 1e-4, - 'apply_scaling': True}) + settings={'algorithm': 'Dakota Quasi-Newton method', + 'maximum_iterations': 1000, + 'maximum_function_evaluations': 1000, + 'constraint_tolerance': 1e-4, + 'convergence_tolerance': 1e-4, + 'apply_scaling': True}) assert isinstance(design_variable_nodes, list) for des_var in design_variable_nodes: assert self.has_node(des_var), 'Design variable %s is missing in the graph.' % des_var @@ -4939,33 +5137,36 @@ class MdaoDataGraph(DataGraph, MdaoMixin): assert self.has_node(con_var), 'Constraint variable %s is missing in the graph.' % con_var # Add attributes to the optimizer block - self.node[optimizer]['design_variables'] = dict() + self.nodes[optimizer]['design_variables'] = dict() for des_var in design_variable_nodes: - self.node[optimizer]['design_variables'][des_var] = dict() - if 'upper_bound' in self.node[des_var]: - self.node[optimizer]['design_variables'][des_var]['upper_bound'] = self.node[des_var]['upper_bound'] + self.nodes[optimizer]['design_variables'][des_var] = dict() + if 'upper_bound' in self.nodes[des_var]: + self.nodes[optimizer]['design_variables'][des_var]['upper_bound'] = self.nodes[des_var]['upper_bound'] else: - self.node[optimizer]['design_variables'][des_var]['upper_bound'] = None - if 'lower_bound' in self.node[des_var]: - self.node[optimizer]['design_variables'][des_var]['lower_bound'] = self.node[des_var]['lower_bound'] + self.nodes[optimizer]['design_variables'][des_var]['upper_bound'] = None + if 'lower_bound' in self.nodes[des_var]: + self.nodes[optimizer]['design_variables'][des_var]['lower_bound'] = self.nodes[des_var]['lower_bound'] else: - self.node[optimizer]['design_variables'][des_var]['lower_bound'] = None - if 'nominal_value' in self.node[des_var]: - self.node[optimizer]['design_variables'][des_var]['nominal_value'] = self.node[des_var]['nominal_value'] + self.nodes[optimizer]['design_variables'][des_var]['lower_bound'] = None + if 'nominal_value' in self.nodes[des_var]: + self.nodes[optimizer]['design_variables'][des_var]['nominal_value'] = \ + self.nodes[des_var]['nominal_value'] else: - self.node[optimizer]['design_variables'][des_var]['nominal_value'] = None - self.node[optimizer]['objective_variable'] = [objective_node] - self.node[optimizer]['constraint_variables'] = dict() + self.nodes[optimizer]['design_variables'][des_var]['nominal_value'] = None + self.nodes[optimizer]['objective_variable'] = [objective_node] + self.nodes[optimizer]['constraint_variables'] = dict() for con_var in constraint_nodes: - self.node[optimizer]['constraint_variables'][con_var] = dict() - if 'upper_bound' in self.node[con_var]: - self.node[optimizer]['constraint_variables'][con_var]['upper_bound'] = self.node[con_var]['upper_bound'] + self.nodes[optimizer]['constraint_variables'][con_var] = dict() + if 'upper_bound' in self.nodes[con_var]: + self.nodes[optimizer]['constraint_variables'][con_var]['upper_bound'] = \ + self.nodes[con_var]['upper_bound'] else: - self.node[optimizer]['constraint_variables'][con_var]['upper_bound'] = None - if 'lower_bound' in self.node[con_var]: - self.node[optimizer]['constraint_variables'][con_var]['lower_bound'] = self.node[con_var]['lower_bound'] + self.nodes[optimizer]['constraint_variables'][con_var]['upper_bound'] = None + if 'lower_bound' in self.nodes[con_var]: + self.nodes[optimizer]['constraint_variables'][con_var]['lower_bound'] = \ + self.nodes[con_var]['lower_bound'] else: - self.node[optimizer]['constraint_variables'][con_var]['lower_bound'] = None + self.nodes[optimizer]['constraint_variables'][con_var]['lower_bound'] = None # Manipulate the graph based on the architecture # Connect design variables to the optimizer @@ -5003,23 +5204,23 @@ class MdaoDataGraph(DataGraph, MdaoMixin): if fin_obj is not None: fin_cnstrnts.append(fin_value_node) fin_obj = fin_value_node - self.copy_edge([self.get_sources(var)[0], var],[self.get_sources(var)[0], fin_value_node]) + self.copy_edge([self.get_sources(var)[0], var], [self.get_sources(var)[0], fin_value_node]) # If the graph contains consistency constraint variables, then connect these to the optimizer as well consconcs_nodes = self.find_all_nodes(category='variable', attr_cond=['architecture_role', '==', self.ARCHITECTURE_ROLES_VARS[6]]) # Add consistency constraints as constraints in the graph for node in consconcs_nodes: - rel_node = self.node[node]['related_to_schema_node'] + rel_node = self.nodes[node]['related_to_schema_node'] # Add design variables to optimizer attributes - self.node[optimizer]['design_variables'][rel_node] = dict() - if 'upper_bound' in self.node[rel_node]: - self.node[optimizer]['design_variables'][rel_node]['upper_bound'] = self.node[rel_node]['upper_bound'] + self.nodes[optimizer]['design_variables'][rel_node] = dict() + if 'upper_bound' in self.nodes[rel_node]: + self.nodes[optimizer]['design_variables'][rel_node]['upper_bound'] = self.nodes[rel_node]['upper_bound'] else: - self.node[optimizer]['design_variables'][rel_node]['upper_bound'] = None - if 'lower_bound' in self.node[rel_node]: - self.node[optimizer]['design_variables'][rel_node]['lower_bound'] = self.node[rel_node]['lower_bound'] + self.nodes[optimizer]['design_variables'][rel_node]['upper_bound'] = None + if 'lower_bound' in self.nodes[rel_node]: + self.nodes[optimizer]['design_variables'][rel_node]['lower_bound'] = self.nodes[rel_node]['lower_bound'] else: - self.node[optimizer]['design_variables'][rel_node]['lower_bound'] = None + self.nodes[optimizer]['design_variables'][rel_node]['lower_bound'] = None self.add_edge(node, optimizer) return fin_des_vars, fin_obj, fin_cnstrnts, ini_guess_nodes @@ -5054,38 +5255,38 @@ class MdaoDataGraph(DataGraph, MdaoMixin): assert self.has_node(qoi_var), 'Q.O.I. variable %s is missing in the graph.' % qoi_var # Add attributes to the doe block - self.node[doe_block]['design_variables'] = dict() + self.nodes[doe_block]['design_variables'] = dict() for des_var in design_variable_nodes: - self.node[doe_block]['design_variables'][des_var] = dict() - if 'upper_bound' in self.node[des_var]: - self.node[doe_block]['design_variables'][des_var]['upper_bound'] = self.node[des_var]['upper_bound'] + self.nodes[doe_block]['design_variables'][des_var] = dict() + if 'upper_bound' in self.nodes[des_var]: + self.nodes[doe_block]['design_variables'][des_var]['upper_bound'] = self.nodes[des_var]['upper_bound'] else: - self.node[doe_block]['design_variables'][des_var]['upper_bound'] = None - if 'lower_bound' in self.node[des_var]: - self.node[doe_block]['design_variables'][des_var]['lower_bound'] = self.node[des_var]['lower_bound'] + self.nodes[doe_block]['design_variables'][des_var]['upper_bound'] = None + if 'lower_bound' in self.nodes[des_var]: + self.nodes[doe_block]['design_variables'][des_var]['lower_bound'] = self.nodes[des_var]['lower_bound'] else: - self.node[doe_block]['design_variables'][des_var]['lower_bound'] = None - if 'nominal_value' in self.node[des_var]: - self.node[doe_block]['design_variables'][des_var]['nominal_value'] = self.node[des_var][ + self.nodes[doe_block]['design_variables'][des_var]['lower_bound'] = None + if 'nominal_value' in self.nodes[des_var]: + self.nodes[doe_block]['design_variables'][des_var]['nominal_value'] = self.nodes[des_var][ 'nominal_value'] else: - self.node[doe_block]['design_variables'][des_var]['nominal_value'] = None - if 'samples' in self.node[des_var]: - self.node[doe_block]['design_variables'][des_var]['samples'] = self.node[des_var]['samples'] + self.nodes[doe_block]['design_variables'][des_var]['nominal_value'] = None + if 'samples' in self.nodes[des_var]: + self.nodes[doe_block]['design_variables'][des_var]['samples'] = self.nodes[des_var]['samples'] else: - self.node[doe_block]['design_variables'][des_var]['samples'] = None - self.node[doe_block]['quantities_of_interest'] = qoi_nodes + self.nodes[doe_block]['design_variables'][des_var]['samples'] = None + self.nodes[doe_block]['quantities_of_interest'] = qoi_nodes # For the custom design table, add the table with values to the settings if 'doe_settings' in self.graph['problem_formulation']: if 'doe_method' in self.graph['problem_formulation']['doe_settings']: if self.graph['problem_formulation']['doe_settings']['doe_method'] == 'Custom design table': - n_samples = len(self.node[doe_block]['design_variables'][design_variable_nodes[-1]]['samples']) + n_samples = len(self.nodes[doe_block]['design_variables'][design_variable_nodes[-1]]['samples']) doe_table = [] for idj in range(n_samples): doe_table.append([]) for des_var in design_variable_nodes: - doe_table[idj].append(self.node[des_var]['samples'][idj]) + doe_table[idj].append(self.nodes[des_var]['samples'][idj]) self.graph['problem_formulation']['doe_settings']['doe_table'] = doe_table self.graph['problem_formulation']['doe_settings']['doe_table_order'] = design_variable_nodes @@ -5165,9 +5366,9 @@ class MdaoDataGraph(DataGraph, MdaoMixin): # Add the surrogate model definition as output of the block output_node = '/{}/surrogateModels/{}/definition'.format(self.get_schema_root_name(input_x_entry[0]), - label.replace('-','')) + label.replace('-', '')) assert not self.has_node(output_node), 'The node {} already exists.'.format(output_node) - self.add_node(output_node, category='variable', instance=1, label='def{}'.format(label.replace('-',''))) + self.add_node(output_node, category='variable', instance=1, label='def{}'.format(label.replace('-', ''))) self.add_edge(sm_builder, output_node) return output_node @@ -5275,6 +5476,8 @@ class MdaoDataGraph(DataGraph, MdaoMixin): :type converger: basestring or None :param include_couplings_as_final_output: setting on whether coupling variables should always be added as output :type include_couplings_as_final_output: bool + :param system_converger: converger is a system converger + :type system_converger: bool """ # Get all the relevant couplings @@ -5319,7 +5522,7 @@ class MdaoDataGraph(DataGraph, MdaoMixin): coupling_copy_node = self.copy_node_as(coupling[2], self.ARCHITECTURE_ROLES_VARS[2]) if not self.has_edge(converger, coupling_copy_node): self.add_edge(converger, coupling_copy_node) - self.copy_edge((coupling[2], coupling[1]) ,(coupling_copy_node, coupling[1])) + self.copy_edge((coupling[2], coupling[1]), (coupling_copy_node, coupling[1])) # Connect original coupling node to the converger self.add_edge(coupling[2], converger) # If the converger node is an optimizer (IDF), then connect it accordingly @@ -5342,18 +5545,18 @@ class MdaoDataGraph(DataGraph, MdaoMixin): self.mark_as_constraint(consistency_node, '==', 0.0) self.add_edge(self.CONSCONS_STRING, consistency_node) self.add_equation((self.CONSCONS_STRING, consistency_node), 'y{}-y{}c'.format(idx, idx), 'Python') - if 'consistency_nodes' in self.node[self.CONSCONS_STRING]: - self.node[self.CONSCONS_STRING]['consistency_nodes'].append(consistency_node) + if 'consistency_nodes' in self.nodes[self.CONSCONS_STRING]: + self.nodes[self.CONSCONS_STRING]['consistency_nodes'].append(consistency_node) else: - self.node[self.CONSCONS_STRING]['consistency_nodes'] = [consistency_node] + self.nodes[self.CONSCONS_STRING]['consistency_nodes'] = [consistency_node] # Remove coupling edge between coupling variable -> function self.remove_edge(coupling[2], coupling[1]) # If required, create final coupling variable node and let it come from the coupled function - if converger and ('problem_role' in self.node[coupling[2]] or include_couplings_as_final_output): + if converger and ('problem_role' in self.nodes[coupling[2]] or include_couplings_as_final_output): final_node = self.copy_node_as(coupling[2], self.ARCHITECTURE_ROLES_VARS[1]) self.copy_edge([coupling[0], coupling[2]], [coupling[0], final_node]) keep_original_coupling_node = False - elif not converger and ('problem_role' in self.node[coupling[2]] or include_couplings_as_final_output): + elif not converger and ('problem_role' in self.nodes[coupling[2]] or include_couplings_as_final_output): keep_original_coupling_node = True else: keep_original_coupling_node = False @@ -5375,12 +5578,13 @@ class MdaoDataGraph(DataGraph, MdaoMixin): mpg = MdaoProcessGraph(self, name=name) node_list = list(mpg.nodes) for node in node_list: - if 'category' not in mpg.node[node]: + if 'category' not in mpg.nodes[node]: raise AssertionError('category attribute missing for node: {}.'.format(node)) - elif mpg.node[node]['category'] == 'variable': + elif mpg.nodes[node]['category'] == 'variable': mpg.remove_node(node) - elif mpg.node[node]['category'] not in ['variable', 'function']: - raise AssertionError('Node {} has invalid category attribute: {}.'.format(node, mpg.node[node]['category'])) + elif mpg.nodes[node]['category'] not in ['variable', 'function']: + raise AssertionError('Node {} has invalid category attribute: {}.'.format(node, + mpg.nodes[node]['category'])) mpg._add_diagonal_positions() return mpg @@ -5419,7 +5623,7 @@ class MdaoDataGraph(DataGraph, MdaoMixin): mpg = mdg.create_mpg(name=name) # Make process step of the coordinator equal to zero - mpg.node[coor]['process_step'] = 0 + mpg.nodes[coor]['process_step'] = 0 # Add process edges for each architecture if mdao_arch == mdg.OPTIONS_ARCHITECTURES[0]: # unconverged-MDA @@ -5430,10 +5634,10 @@ class MdaoDataGraph(DataGraph, MdaoMixin): sequence = [coor] + pre_functions + [conv] mpg.add_process(sequence, 0, mdg) sequence2 = [conv] + coup_functions - mpg.add_process(sequence2, mpg.node[sequence[-1]]['process_step'], mdg, end_in_iterative_node=conv) + mpg.add_process(sequence2, mpg.nodes[sequence[-1]]['process_step'], mdg, end_in_iterative_node=conv) if post_functions: sequence3 = [conv] + post_functions - mpg.add_process(sequence3, mpg.node[conv]['converger_step'], mdg, end_in_iterative_node=coor) + mpg.add_process(sequence3, mpg.nodes[conv]['converger_step'], mdg, end_in_iterative_node=coor) else: mpg.connect_nested_iterators(coor, conv) elif mdao_arch == mdg.OPTIONS_ARCHITECTURES[2]: # IDF @@ -5441,7 +5645,7 @@ class MdaoDataGraph(DataGraph, MdaoMixin): sequence1 = [coor] + pre_desvars_funcs + [opt] mpg.add_process(sequence1, 0, mdg) sequence2 = [opt] + post_desvars_funcs + coup_functions + post_functions - mpg.add_process(sequence2, mpg.node[sequence1[-1]]['process_step'], mdg, end_in_iterative_node=opt) + mpg.add_process(sequence2, mpg.nodes[sequence1[-1]]['process_step'], mdg, end_in_iterative_node=opt) mpg.connect_nested_iterators(coor, opt) elif mdao_arch == mdg.OPTIONS_ARCHITECTURES[3]: # MDF opt = mdg.OPTIMIZER_STRING @@ -5449,25 +5653,25 @@ class MdaoDataGraph(DataGraph, MdaoMixin): sequence1 = [coor] + pre_desvars_funcs + [opt] mpg.add_process(sequence1, 0, mdg) sequence2 = [opt] + post_desvars_funcs + [conv] - mpg.add_process(sequence2, mpg.node[sequence1[-1]]['process_step'], mdg) + mpg.add_process(sequence2, mpg.nodes[sequence1[-1]]['process_step'], mdg) sequence3 = [conv] + coup_functions - mpg.add_process(sequence3, mpg.node[sequence2[-1]]['process_step'], mdg, end_in_iterative_node=conv) + mpg.add_process(sequence3, mpg.nodes[sequence2[-1]]['process_step'], mdg, end_in_iterative_node=conv) sequence4 = [conv] + post_functions - mpg.add_process(sequence4, mpg.node[conv]['converger_step'], mdg, end_in_iterative_node=opt) + mpg.add_process(sequence4, mpg.nodes[conv]['converger_step'], mdg, end_in_iterative_node=opt) mpg.connect_nested_iterators(coor, opt) elif mdao_arch == mdg.OPTIONS_ARCHITECTURES[4]: # unconverged-OPT opt = mdg.OPTIMIZER_STRING sequence1 = [coor] + pre_desvars_funcs + [opt] mpg.add_process(sequence1, 0, mdg) sequence2 = [opt] + post_desvars_funcs + coup_functions + post_functions - mpg.add_process(sequence2, mpg.node[sequence1[-1]]['process_step'], mdg, end_in_iterative_node=opt) + mpg.add_process(sequence2, mpg.nodes[sequence1[-1]]['process_step'], mdg, end_in_iterative_node=opt) mpg.connect_nested_iterators(coor, opt) elif mdao_arch == mdg.OPTIONS_ARCHITECTURES[5]: # unconverged-DOE doe = mdg.DOE_STRING sequence1 = [coor] + pre_desvars_funcs + [doe] mpg.add_process(sequence1, 0, mdg) sequence2 = [doe] + post_desvars_funcs + coup_functions + post_functions - mpg.add_process(sequence2, mpg.node[sequence1[-1]]['process_step'], mdg, end_in_iterative_node=doe) + mpg.add_process(sequence2, mpg.nodes[sequence1[-1]]['process_step'], mdg, end_in_iterative_node=doe) mpg.connect_nested_iterators(coor, doe) elif mdao_arch == mdg.OPTIONS_ARCHITECTURES[6]: # converged-DOE doe = mdg.DOE_STRING @@ -5475,12 +5679,12 @@ class MdaoDataGraph(DataGraph, MdaoMixin): sequence1 = [coor] + pre_desvars_funcs + [doe] mpg.add_process(sequence1, 0, mdg) sequence2 = [doe] + post_desvars_funcs + [conv] - mpg.add_process(sequence2, mpg.node[sequence1[-1]]['process_step'], mdg) + mpg.add_process(sequence2, mpg.nodes[sequence1[-1]]['process_step'], mdg) sequence3 = [conv] + coup_functions - mpg.add_process(sequence3, mpg.node[sequence2[-1]]['process_step'], mdg, end_in_iterative_node=conv) + mpg.add_process(sequence3, mpg.nodes[sequence2[-1]]['process_step'], mdg, end_in_iterative_node=conv) if post_functions: sequence4 = [conv] + post_functions - mpg.add_process(sequence4, mpg.node[conv]['converger_step'], mdg, end_in_iterative_node=doe) + mpg.add_process(sequence4, mpg.nodes[conv]['converger_step'], mdg, end_in_iterative_node=doe) else: mpg.connect_nested_iterators(doe, conv) mpg.connect_nested_iterators(coor, doe) @@ -5544,34 +5748,37 @@ class MdaoDataGraph(DataGraph, MdaoMixin): sequence1 = [coor] + distr_function_ordering[0][self.FUNCTION_ROLES[3]] + [sys_opt] mpg.add_process(sequence1, 0, mdg) sequence2 = [sys_opt] + distr_function_ordering[0][self.FUNCTION_ROLES[2]] - mpg.add_process(sequence2, mpg.node[sequence1[-1]]['process_step'], mdg, end_in_iterative_node=sys_opt) + mpg.add_process(sequence2, mpg.nodes[sequence1[-1]]['process_step'], mdg, end_in_iterative_node=sys_opt) for idx, subgroup in enumerate(distr_function_ordering[1]): sequence3 = [sys_opt, sub_opts[idx]] mpg.connect_nested_iterators(sys_opt, sub_opts[idx], direction='master->slave') sequence4 = [sub_opts[idx]] + subgroup[self.FUNCTION_ROLES[4]] + subgroup[self.FUNCTION_ROLES[1]] + \ - subgroup[self.FUNCTION_ROLES[2]] - mpg.add_process(sequence4, mpg.node[sequence3[-1]]['process_step'], mdg, end_in_iterative_node=sub_opts[idx]) + subgroup[self.FUNCTION_ROLES[2]] + mpg.add_process(sequence4, mpg.nodes[sequence3[-1]]['process_step'], mdg, + end_in_iterative_node=sub_opts[idx]) mpg.connect_nested_iterators(sys_opt, sub_opts[idx]) mpg.connect_nested_iterators(coor, sys_opt) elif mdao_arch == mdg.OPTIONS_ARCHITECTURES[9]: # BLISS-2000 distr_function_ordering = mdg.graph['distr_function_ordering'] n_groups = len(distr_function_ordering[1]) - sys_opt, sys_conv, _, sub_smbds, \ - sub_does, sub_opts, sub_smbs = self.get_architecture_node_ids(mdao_arch, number_of_groups=n_groups) + sys_opt, sys_conv, _, sub_smbds, sub_does, sub_opts, sub_smbs = \ + self.get_architecture_node_ids(mdao_arch, number_of_groups=n_groups) sequence1 = [coor] + distr_function_ordering[0][self.FUNCTION_ROLES[3]] + [sys_conv] mpg.add_process(sequence1, 0, mdg) for idx, subgroup in enumerate(distr_function_ordering[1]): sequence2 = [sys_conv] + subgroup[self.FUNCTION_ROLES[3]] + [sub_smbds[idx]] + [sub_does[idx]] + \ - [sub_opts[idx]] + subgroup[self.FUNCTION_ROLES[4]] + subgroup[self.FUNCTION_ROLES[1]] + \ + [sub_opts[idx]] + subgroup[self.FUNCTION_ROLES[4]] + subgroup[self.FUNCTION_ROLES[1]] + \ subgroup[self.FUNCTION_ROLES[2]] - mpg.add_process(sequence2, mpg.node[sequence1[-1]]['process_step'], mdg, end_in_iterative_node=sub_opts[idx]) + mpg.add_process(sequence2, mpg.nodes[sequence1[-1]]['process_step'], mdg, + end_in_iterative_node=sub_opts[idx]) mpg.connect_nested_iterators(sub_does[idx], sub_opts[idx]) sequence3 = [sub_does[idx]] + [sub_smbs[idx]] + [sys_opt] - mpg.add_process(sequence3, mpg.node[sub_does[idx]]['converger_step'], mdg) + mpg.add_process(sequence3, mpg.nodes[sub_does[idx]]['converger_step'], mdg) sequence4 = [sys_opt] + distr_function_ordering[0][self.FUNCTION_ROLES[4]] + \ distr_function_ordering[0][self.FUNCTION_ROLES[1]] + \ distr_function_ordering[0][self.FUNCTION_ROLES[2]] - mpg.add_process(sequence4, mpg.node[sequence3[-1]]['process_step'], mdg, end_in_iterative_node=sequence4[0]) + mpg.add_process(sequence4, mpg.nodes[sequence3[-1]]['process_step'], mdg, + end_in_iterative_node=sequence4[0]) mpg.connect_nested_iterators(sys_conv, sys_opt) mpg.connect_nested_iterators(coor, sys_conv) diff --git a/kadmos/graph/graph_kadmos.py b/kadmos/graph/graph_kadmos.py index 8c76ddced27370cc50898dc8de9ed3f5ee6dab58..a1cf47f817858c1b40f849fbea0821f65ad80ddc 100644 --- a/kadmos/graph/graph_kadmos.py +++ b/kadmos/graph/graph_kadmos.py @@ -50,16 +50,16 @@ file_extensions = ['xml', 'kdms', 'graphml'] class KadmosGraph(nx.DiGraph, EquationMixin, VistomsMixin): # Hardcoded values and naming convention - OPTIONS_ARCHITECTURES = ['unconverged-MDA', # 0 - 'converged-MDA', # 1 - 'IDF', # 2 - 'MDF', # 3 - 'unconverged-OPT', # 4 - 'unconverged-DOE', # 5 - 'converged-DOE', # 6 - 'distributed-convergence', # 7 - 'CO', # 8 - 'BLISS-2000'] # 9 + OPTIONS_ARCHITECTURES = ['unconverged-MDA', # 0 + 'converged-MDA', # 1 + 'IDF', # 2 + 'MDF', # 3 + 'unconverged-OPT', # 4 + 'unconverged-DOE', # 5 + 'converged-DOE', # 6 + 'distributed-convergence', # 7 + 'CO', # 8 + 'BLISS-2000'] # 9 OPTIONS_DOE_METHODS = ['Full factorial design', # 0 'Latin hypercube design', # 1 'Monte Carlo design', # 2 @@ -154,12 +154,11 @@ class KadmosGraph(nx.DiGraph, EquationMixin, VistomsMixin): SMB_LABEL = 'SMB' INSTANCE_SUFFIX = '__i' NODE_GROUP_SUBCATS = {'all variables': - ['hole', 'supplied input', 'supplied shared input', 'output', 'collision', - 'coupling', 'shared coupling', 'collided coupling', 'collided shared coupling', - 'pure circular coupling', 'shared circular coupling', - 'collided circular coupling', 'collided shared circular coupling', - 'initial guess design variable', 'final design variable', - 'MDA coupling variable', 'initial guess MDA coupling variable', + ['hole', 'supplied input', 'supplied shared input', 'output', 'collision', 'coupling', + 'shared coupling', 'collided coupling', 'collided shared coupling', + 'pure circular coupling', 'shared circular coupling', 'collided circular coupling', + 'collided shared circular coupling', 'initial guess design variable', + 'final design variable', 'MDA coupling variable', 'initial guess MDA coupling variable', 'final MDA coupling variable', 'final output variable', 'consistency constraint variable'], 'all inputs': @@ -378,7 +377,11 @@ class KadmosGraph(nx.DiGraph, EquationMixin, VistomsMixin): return copied_graph def change_graph_class(self, graph_class): - """Method to adjust the class of a graph.""" + """Method to adjust the class of a graph. + + :return: newly classed graph. + :rtype: graph_class + """ self = graph_class(self) return self @@ -390,17 +393,17 @@ class KadmosGraph(nx.DiGraph, EquationMixin, VistomsMixin): def check(self, raise_error=False): """Method to check the graph for validity and completeness. - Several checks are performed. However the method does not guarantee the validity of the graph. - - The checks are split into several categories and the methods _check_category_a, _check_category_b and - _check_category_c are used to determine the overall validity and completeness. These sub methods are generally - defined below and are then further refined in child classes. - :param raise_error: determines if an error should be raised in case of an invalid graph :type raise_error: bool :return: result of the check :rtype: bool + + .. note:: Several checks are performed. However the method does not guarantee the validity of the graph. + + The checks are split into several categories and the methods _check_category_a, _check_category_b and + _check_category_c are used to determine the overall validity and completeness. These sub methods are generally + defined below and are then further refined in child classes. """ # Logging @@ -557,10 +560,6 @@ class KadmosGraph(nx.DiGraph, EquationMixin, VistomsMixin): def check_cmdows_integrity(self, convention=True, mpg=None): """Method to check the integrity of the CMDOWS file that can be created with the save method. - The integrity check is graph specific and thus needs to be executed for every graph before saving as CMDOWS if - one wants to be sure that the CMDOWS file is integer. Due to its relative long runtime this check is however not - performed automatically when using the save method. - :param convention: option for applying a UID convention :type convention: bool :param mpg: MPG to be saved together with graph @@ -568,6 +567,10 @@ class KadmosGraph(nx.DiGraph, EquationMixin, VistomsMixin): :return: check result :rtype: bool + + The integrity check is graph specific and thus needs to be executed for every graph before saving as CMDOWS if + one wants to be sure that the CMDOWS file is integer. Due to its relative long runtime this check is however not + performed automatically when using the save method. """ logger.info('Performing CMDOWS integrity check...') @@ -765,25 +768,26 @@ class KadmosGraph(nx.DiGraph, EquationMixin, VistomsMixin): if isinstance(graph, FundamentalProblemGraph): if colors_based_on == 'partitions' and 'part_id' in graph.nodes[node]: node_style = 'EvenPartitions' if int(graph.nodes[node]['part_id']) % 2 == 0 else 'OddPartitions' - elif 'problem_role' in graph.node[node]: - if graph.node[node]['problem_role'] == graph.FUNCTION_ROLES[0]: + elif 'problem_role' in graph.nodes[node]: + if graph.nodes[node]['problem_role'] == graph.FUNCTION_ROLES[0]: node_style = 'PreAnalysis' - elif graph.node[node]['problem_role'] == graph.FUNCTION_ROLES[1]: + elif graph.nodes[node]['problem_role'] == graph.FUNCTION_ROLES[1]: node_style = 'CoupledAnalysis' - elif graph.node[node]['problem_role'] == graph.FUNCTION_ROLES[2]: + elif graph.nodes[node]['problem_role'] == graph.FUNCTION_ROLES[2]: node_style = 'PostAnalysis' else: logger.warning('An invalid FPG has been provided: problem_role missing for: %s.' % node) node_style = 'RcgAnalysis' elif isinstance(graph, MdaoDataGraph): - if 'architecture_role' in graph.node[node]: + if 'architecture_role' in graph.nodes[node]: try: - role_index = self.ARCHITECTURE_ROLES_FUNS.index(graph.node[node]['architecture_role']) + role_index = self.ARCHITECTURE_ROLES_FUNS.index(graph.nodes[node]['architecture_role']) except ValueError: raise AssertionError('Architecture role %s is not supported for creation of XDSMs.' - % graph.node[node]['architecture_role']) + % graph.nodes[node]['architecture_role']) if colors_based_on == 'partitions' and 'part_id' in graph.nodes[node]: - node_style = 'EvenPartitions' if int(graph.nodes[node]['part_id']) % 2 == 0 else 'OddPartitions' + node_style = 'EvenPartitions' if int(graph.nodes[node]['part_id']) % 2 == 0 \ + else 'OddPartitions' else: node_style = self.ARCHITECTURE_ROLES_NODESTYLES[role_index] else: @@ -792,7 +796,7 @@ class KadmosGraph(nx.DiGraph, EquationMixin, VistomsMixin): else: node_style = 'RcgAnalysis' - node_text = graph.node[node].get('label', str(node)) + node_text = graph.nodes[node].get('label', str(node)) assert node_text if node != pseudo_node else True, 'Node label is empty for node: %s' % node dsm.addComp(node, node_style, node_text) @@ -805,10 +809,10 @@ class KadmosGraph(nx.DiGraph, EquationMixin, VistomsMixin): ' data graph.' % idx node = node_list[0] try: - role_index = self.ARCHITECTURE_ROLES_FUNS.index(graph_mpg.node[node]['architecture_role']) + role_index = self.ARCHITECTURE_ROLES_FUNS.index(graph_mpg.nodes[node]['architecture_role']) except ValueError: raise AssertionError('Architecture role %s is not supported for creation of XDSMs.' - % graph_mpg.node[node]['architecture_role']) + % graph_mpg.nodes[node]['architecture_role']) if colors_based_on == 'partitions' and 'part_id' in graph.nodes[node]: node_style = 'EvenPartitions' if int(graph.nodes[node]['part_id']) % 2 == 0 else 'OddPartitions' else: @@ -887,25 +891,25 @@ class KadmosGraph(nx.DiGraph, EquationMixin, VistomsMixin): else: if node_set_upp: str_upp = r'\\[1pt] '.join( - map(str, map((lambda x: '$' + graph.node[x]['label'] + '$'), node_set_upp))) + map(str, map((lambda x: '$' + graph.nodes[x]['label'] + '$'), node_set_upp))) if node_set_low: str_low = r'\\[1pt] '.join( - map(str, map((lambda x: '$' + graph.node[x]['label'] + '$'), node_set_low))) + map(str, map((lambda x: '$' + graph.nodes[x]['label'] + '$'), node_set_low))) # Additional strings for XDSMs str_num_up = '' str_num_low = '' if node_set_upp and mpg is not None: - if 'process_step' in graph_mpg.node[node2]: - str_num_up = str(graph_mpg.node[node2]['process_step']) + ': ' + if 'process_step' in graph_mpg.nodes[node2]: + str_num_up = str(graph_mpg.nodes[node2]['process_step']) + ': ' else: str_num_up = '' if node_set_low and mpg is not None: # Check existence of process edge and add edge number if it exists - if 'converger_step' in graph_mpg.node[node1]: - str_num_low = (str(graph_mpg.node[node1]['converger_step']) + ': ') - elif 'process_step' in graph_mpg.node[node1]: - str_num_low = (str(graph_mpg.node[node1]['process_step']) + ': ') + if 'converger_step' in graph_mpg.nodes[node1]: + str_num_low = (str(graph_mpg.nodes[node1]['converger_step']) + ': ') + elif 'process_step' in graph_mpg.nodes[node1]: + str_num_low = (str(graph_mpg.nodes[node1]['process_step']) + ': ') else: str_num_low = '' @@ -984,7 +988,7 @@ class KadmosGraph(nx.DiGraph, EquationMixin, VistomsMixin): for graph_design_competence in graph_design_competences: # Create designCompetences/designCompetence - graph_design_competence_data = self.node[graph_design_competence] + graph_design_competence_data = self.nodes[graph_design_competence] cmdows_design_competence = cmdows_design_competences.add('designCompetence') cmdows_design_competence.set('uID', graph_design_competence) cmdows_design_competence.add('ID', graph_design_competence_data.get('name')) @@ -1035,11 +1039,11 @@ class KadmosGraph(nx.DiGraph, EquationMixin, VistomsMixin): # Create parameters/parameter cmdows_parameter = cmdows_parameters.add('parameter') cmdows_parameter.set('uID', graph_parameter) - cmdows_parameter.add('label', self.node[graph_parameter].get('label')) - cmdows_parameter.add('description', self.node[graph_parameter].get('description')) - cmdows_parameter.add('note', self.node[graph_parameter].get('note')) - cmdows_parameter.add('unit', self.node[graph_parameter].get('unit')) - cmdows_parameter.add('dataType', self.node[graph_parameter].get('data_type')) + cmdows_parameter.add('label', self.nodes[graph_parameter].get('label')) + cmdows_parameter.add('description', self.nodes[graph_parameter].get('description')) + cmdows_parameter.add('note', self.nodes[graph_parameter].get('note')) + cmdows_parameter.add('unit', self.nodes[graph_parameter].get('unit')) + cmdows_parameter.add('dataType', self.nodes[graph_parameter].get('data_type')) return cmdows_parameters @@ -1062,8 +1066,8 @@ class KadmosGraph(nx.DiGraph, EquationMixin, VistomsMixin): for u, v, w in self.edges(data=True): # Create workflow/dataGraph/edges/edge cmdows_edge = cmdows_edges.add('edge') - from_name = 'fromExecutableBlockUID' if self.node[u].get('category') == 'function' else 'fromParameterUID' - to_name = 'toExecutableBlockUID' if self.node[v].get('category') == 'function' else 'toParameterUID' + from_name = 'fromExecutableBlockUID' if self.nodes[u].get('category') == 'function' else 'fromParameterUID' + to_name = 'toExecutableBlockUID' if self.nodes[v].get('category') == 'function' else 'toParameterUID' cmdows_edge.add(from_name, u) cmdows_edge.add(to_name, v) cmdows_data_graph.add('metadata') @@ -1094,11 +1098,11 @@ class KadmosGraph(nx.DiGraph, EquationMixin, VistomsMixin): :return: mpg :rtype: MdaoProcessGraph - Check_list options: + .. note:: check_list options: - * 'consistent_root': check if all in-/output files have the same root element - * 'invalid_leaf_elements': check for leaf elements that still have child elements in other in-/output files - * 'schemas': check if the in-/output files are consistent with the schema. + * 'consistent_root': check if all in-/output files have the same root element + * 'invalid_leaf_elements': check for leaf elements that still have child elements in other in-/output files + * 'schemas': check if the in-/output files are consistent with the schema. To perform all of the checks without stopping if an error is found by the checks: @@ -1243,8 +1247,10 @@ class KadmosGraph(nx.DiGraph, EquationMixin, VistomsMixin): cmdows_edges = cmdows_data_graph.find('edges') if cmdows_edges is not None: for edge in list(cmdows_edges): - from_id = edge.findtext('fromExecutableBlockUID', default=edge.findtext('fromParameterUID')).replace("'", '"') - to_id = edge.findtext('toExecutableBlockUID', default=edge.findtext('toParameterUID')).replace("'", '"') + from_id = edge.findtext('fromExecutableBlockUID', + default=edge.findtext('fromParameterUID')).replace("'", '"') + to_id = edge.findtext('toExecutableBlockUID', + default=edge.findtext('toParameterUID')).replace("'", '"') self.assert_node_exists(from_id) self.assert_node_exists(to_id) self.add_edge(from_id, to_id) @@ -1270,12 +1276,6 @@ class KadmosGraph(nx.DiGraph, EquationMixin, VistomsMixin): pretty_print=False, convention=True, integrity=False): """Method to save the graph. - Different output file types are implemented for saving graphs. They are listed below: - - * kdms: the most simple file type which makes use of pickling - * cmdows: the most versatile file type especially suited for file exchange with other tools - * graphml: another file type especially suited for file exchange with other tools based on graphs - :param file_name: name of the file to be saved :type file_name: str :param file_type: file_type @@ -1293,7 +1293,7 @@ class KadmosGraph(nx.DiGraph, EquationMixin, VistomsMixin): :param creator: name of the creator of the file (only applicable for the cmdows file type) :type creator: str :param version: version of the file (only applicable for the cmdows file type) - :type version: str | float | int + :type version: str, float, int :param timestamp: timestamp to be saved in the file (only applicable for the cmdows file type) :type timestamp: datetime :param keep_empty_elements: option for keeping empty XML elements (only applicable for the cmdows file type) @@ -1304,6 +1304,12 @@ class KadmosGraph(nx.DiGraph, EquationMixin, VistomsMixin): :type convention: bool :param integrity: option for doing an integrity file check (only applicable for the cmdows file type) :type integrity: bool + + .. note:: Different output file types are implemented for saving graphs. They are listed below: + + * kdms: the most simple file type which makes use of pickling + * cmdows: the most versatile file type especially suited for file exchange with other tools + * graphml: another file type especially suited for file exchange with other tools based on graphs """ # Check if the file type is valid @@ -1498,7 +1504,11 @@ class KadmosGraph(nx.DiGraph, EquationMixin, VistomsMixin): # ---------------------------------------------------------------------------------------------------------------- # def inspect(self): - """Method to print an overview of the graph.""" + """Method to print an overview of the graph. + + :return: printed overview of the graph + :rtype: str + """ print '\n- - - - - - - - - -' print ' GRAPH INSPECTION ' @@ -1517,6 +1527,8 @@ class KadmosGraph(nx.DiGraph, EquationMixin, VistomsMixin): :param node: node :type node: str + :return: printed node details + :rtype: str """ pp = pprint.PrettyPrinter(indent=2) @@ -1534,7 +1546,7 @@ class KadmosGraph(nx.DiGraph, EquationMixin, VistomsMixin): print '\nnode targets:' pp.pprint(self.get_targets(node)) print '\nnode attributes:' - pp.pprint(self.node[node]) + pp.pprint(self.nodes[node]) print '- - - - - - - - - - - - -\n' def inspect_nodes(self, list_of_nodes): @@ -1542,6 +1554,8 @@ class KadmosGraph(nx.DiGraph, EquationMixin, VistomsMixin): :param list_of_nodes: node list :type list_of_nodes: list + :return: printed details of nodes + :rtype: str """ assert isinstance(list_of_nodes, list) @@ -1596,19 +1610,19 @@ class KadmosGraph(nx.DiGraph, EquationMixin, VistomsMixin): >>> roles = ['integrator', 'architect'] >>> add_contact('Maaike de Wit', 'M.D.deWit@student.tudelft.nl', 'mddewit', company='TU Delft', roles=roles) - In case the contact uid already exists the old contact attributes are conserved and only new roles are added to - the roles already present for that contact. To change old contact information, this has to be adjusted in the - XML-file from which the old contact information is loaded. + .. note:: In case the contact uid already exists the old contact attributes are conserved and only new roles + are added to the roles already present for that contact. To change old contact information, this has to be + adjusted in the XML-file from which the old contact information is loaded. - To add (more) roles to the existing contact, it is recommended to use the method: add_contact_roles() + .. hint:: To add (more) roles to the existing contact, it is recommended to use the method: add_contact_roles() """ already = False contacts = [] organigram = {} - contact = OrderedDict([('attrib', {'uID': uid}), ('name', name), ('email', email),('company', company), - ('department', department),('function', function),('address', address), - ('telephone', telephone),('country', country)]) + contact = OrderedDict([('attrib', {'uID': uid}), ('name', name), ('email', email), ('company', company), + ('department', department), ('function', function), ('address', address), + ('telephone', telephone), ('country', country)]) role_options = ['architect', 'integrator', 'collaborativeEngineer', 'toolSpecialist', 'customer'] architects = [] @@ -1617,8 +1631,8 @@ class KadmosGraph(nx.DiGraph, EquationMixin, VistomsMixin): tool_specialists = [] customers = [] - dict = {'architect':architects, 'integrator':integrators,'collaborativeEngineer':collaborative_engineers, - 'toolSpecialist':tool_specialists,'customer':customers} + dict = {'architect': architects, 'integrator': integrators,'collaborativeEngineer': collaborative_engineers, + 'toolSpecialist': tool_specialists,'customer': customers} if isinstance(roles, list): for role in roles: @@ -1626,14 +1640,14 @@ class KadmosGraph(nx.DiGraph, EquationMixin, VistomsMixin): logger.warning('Invalid role {} was provided for {}. Appropriate roles are: ' '{}'.format(role, name, role_options)) else: - dict[role].append({'contactUID':uid}) + dict[role].append({'contactUID': uid}) elif isinstance(roles, basestring): role = roles if role not in role_options: logger.warning('Invalid role {} was provided for {}. Appropriate roles are: {}'.format(role, name, role_options)) else: - dict[role].append({'contactUID':uid}) + dict[role].append({'contactUID': uid}) # Check for existing organigram for role in role_options: @@ -1643,8 +1657,8 @@ class KadmosGraph(nx.DiGraph, EquationMixin, VistomsMixin): dict[role].append(contact_uid) else: already = True - if len(dict[role]) > 0: - organigram[role+'s'] = dict[role] + if len(dict[role]) > 0: + organigram[role+'s'] = dict[role] if self.graph_has_nested_attributes(['organization', 'contacts']): if isinstance(self.graph['organization']['contacts'], list): @@ -1661,7 +1675,7 @@ class KadmosGraph(nx.DiGraph, EquationMixin, VistomsMixin): contacts.append(contact) else: logger.debug("{} is already defined in CMDOWS. Please use add_contact_roles() to add new roles to this" - " existing contact.".format(contact['attrib'])) + " existing contact.".format(contact['attrib'])) self.graph['organization']['contacts'] = contacts self.graph['organization']['organigram'] = organigram else: @@ -1686,14 +1700,14 @@ class KadmosGraph(nx.DiGraph, EquationMixin, VistomsMixin): Adding an organizational role to an existing contact: - >>> add_contact('mddewit', roles='integrator') + >>> graph.add_contact('mddewit', roles='integrator') Adding two (or more) organizational roles to an existing contact: >>> roles = ['integrator', 'architect'] - >>> add_contact('mddewit', company='TU Delft', roles=roles) + >>> graph.add_contact('mddewit', company='TU Delft', roles=roles) - This method only works for existing contacts. To add a contact use the method: add_contact() + .. hint:: This method only works for existing contacts. To add a contact use the method: add_contact() """ assert 'organization' in self.graph, 'There are no contacts present to add a role to.' @@ -1767,17 +1781,17 @@ class KadmosGraph(nx.DiGraph, EquationMixin, VistomsMixin): :type model_definition: str """ - self.node[dc_uid]['general_info'] = {'description': description} + self.nodes[dc_uid]['general_info'] = {'description': description} options = ['status', 'creation_date', 'owner', 'creator', 'operator', 'model_definition'] - uid_options = ['owner','creator','operator'] - dict = {'status':status,'creation_date': creation_date, 'owner': owner_uid, 'creator': creator_uid, + uid_options = ['owner', 'creator', 'operator'] + dict = {'status':status, 'creation_date': creation_date, 'owner': owner_uid, 'creator': creator_uid, 'operator': operator_uid, 'model_definition': model_definition} for option in options: if option in uid_options and dict[option]: - self.node[dc_uid]['general_info'].update({option : {'contactUID': dict[option]}}) + self.nodes[dc_uid]['general_info'].update({option: {'contactUID': dict[option]}}) elif dict[option]: - self.node[dc_uid]['general_info'].update({option : dict[option]}) + self.nodes[dc_uid]['general_info'].update({option: dict[option]}) return def add_dc_performance_info(self, dc_uid, precision=None, fidelity_level=None, run_time=None, verification=None): @@ -1792,12 +1806,18 @@ class KadmosGraph(nx.DiGraph, EquationMixin, VistomsMixin): :param run_time: the run time of the design competence, optional :type run_time: float :param verification: verification method of the design competence, optional - :type verification: str + :type verification: dict At least one of the optional elements for the performance information has to be defined. + + Adding performance info with a verification: + + >>> verification = {'method': 'dummy_method', 'verifier': contact_uid, 'result': 'dummy_result', + >>> 'date': dateTime, 'version': dummy_version} + >>> graph.add_dc_performance_info(dc_uid, verification=verification) """ - options = ['precision','fidelity_level','run_time','verification'] - dict = {'precision': precision, 'fidelity_level':fidelity_level, 'run_time': run_time, + options = ['precision', 'fidelity_level', 'run_time', 'verification'] + dict = {'precision': precision, 'fidelity_level': fidelity_level, 'run_time': run_time, 'verification': verification} if not precision and not fidelity_level and not run_time and not verification: logger.warning("At least one element of the performance info of {} must have a value".format(dc_uid)) @@ -1806,10 +1826,10 @@ class KadmosGraph(nx.DiGraph, EquationMixin, VistomsMixin): for option in options: if dict[option]: if first: - self.node[dc_uid].update({'performance_info':{option : dict[option]}}) + self.nodes[dc_uid].update({'performance_info': {option: dict[option]}}) first = False else: - self.node[dc_uid]['performance_info'].update({option: dict[option]}) + self.nodes[dc_uid]['performance_info'].update({option: dict[option]}) return def add_dc_remote_component_info(self, dc_uid, single_or_multi_execution, job_name, remote_engineer, @@ -1818,8 +1838,8 @@ class KadmosGraph(nx.DiGraph, EquationMixin, VistomsMixin): :param dc_uid: uid of the design competence :type dc_uid: str - :param single_or_multi_execution: execution type - :type single_or_multi_execution: 'single' or 'multiple' + :param single_or_multi_execution: execution type. Choose from 'single' or 'multiple'. + :type single_or_multi_execution: str :param job_name: job name of the design competence :type job_name: str :param remote_engineer: contact uid of remote engineering of the design competence @@ -1832,22 +1852,22 @@ class KadmosGraph(nx.DiGraph, EquationMixin, VistomsMixin): Example use: >>> single_or_multi = "single" - >>> job_name = 'job_{}'.format(fpg.node[node]['label'].replace(' ', '')) - >>> notification_message = 'Hi, could you please run this tool {} for me for my {} AGILE workflow ' \ - 'execution. Thanks.'.format(fpg.node[node]['label'].replace(' ', ''), architecture) + >>> job_name = 'job_{}'.format(fpg.nodes[node]['label'].replace(' ', '')) + >>> notification_message = 'Hi, could you please run this tool {} for me for my {} AGILE workflow ' + >>> 'execution. Thanks.'.format(fpg.nodes[node]['label'].replace(' ', ''), architecture) >>> fpg.add_dc_remote_component_info(node, single_or_multi, job_name, 'ivangent', notification_message, >>> data_exchange_dict={'urlsite': 'some_url', >>> 'folder': 'some_folder'}) """ - self.node[dc_uid].update({'execution_info' - :{'remote_component_info' - :{'job_settings':{'single_or_multi_execution': single_or_multi_execution, - 'remote_engineer': {'contact_u_i_d': remote_engineer}, - 'job_name': job_name, - 'notification_message': notification_message}}}}) + self.nodes[dc_uid].update({'execution_info': + {'remote_component_info': + {'job_settings': {'single_or_multi_execution': single_or_multi_execution, + 'remote_engineer': {'contact_u_i_d': remote_engineer}, + 'job_name': job_name, + 'notification_message': notification_message}}}}) if data_exchange_dict: - self.node[dc_uid]['execution_info']['remote_component_info'].update({'data_exchange_settings' : - data_exchange_dict}) + self.nodes[dc_uid]['execution_info']['remote_component_info'].update({'data_exchange_settings': + data_exchange_dict}) return def add_node(self, n, attr_dict=None, **attr): @@ -1857,8 +1877,8 @@ class KadmosGraph(nx.DiGraph, EquationMixin, VistomsMixin): :type n: A node can be any hashable Python object except None. :param attr_dict: dictionary of attribute keyword arguments. :type attr_dict: dict - :param attr: keyword arguments, optional - :type attr: Set or change node attributes using attr_dict. + :param attr: Set or change node attributes using attr_dict. + :type attr: str, dict Examples: @@ -1874,15 +1894,15 @@ class KadmosGraph(nx.DiGraph, EquationMixin, VistomsMixin): >>> G.add_node(1, size=10) >>> G.add_node(3, weight=0.4, UTM=('13S', 382871, 3972649)) - Notes: + .. note:: + A hashable object is one that can be used as a key in a Python + dictionary. This includes strings, numbers, tuples of strings + and numbers, etc. - A hashable object is one that can be used as a key in a Python - dictionary. This includes strings, numbers, tuples of strings - and numbers, etc. - - On many platforms hashable items also include mutables such as - NetworkX Graphs, though one should be careful that the hash - doesn't change on mutables. + .. note:: + On many platforms hashable items also include mutables such as + NetworkX Graphs, though one should be careful that the hash + doesn't change on mutables. """ # Execute base function @@ -1892,14 +1912,23 @@ class KadmosGraph(nx.DiGraph, EquationMixin, VistomsMixin): self.nodes[n][key] = attr_dict[key] # Set some default attributes - if 'name' not in self.node[n]: - self.node[n]['name'] = n - if 'label' not in self.node[n]: - self.node[n]['label'] = n + if 'name' not in self.nodes[n]: + self.nodes[n]['name'] = n + if 'label' not in self.nodes[n]: + self.nodes[n]['label'] = n def add_edge(self, u, v, attr_dict=None, **attr): """Add an edge between u and v. + :param u: node + :type u: can be, for example, strings or numbers. Nodes must be hashable (and not None) Python objects. + :param v: node + :type v: see u + :param attr_dict: keyword arguments + :type attr_dict: str + :param attr: edge data (or labels or objects) can be assigned using keyword arguments. + :type attr: str + The nodes u and v will be automatically added if they are not already in the graph. Adding an existing edge results in an update of the edge data. @@ -1907,11 +1936,6 @@ class KadmosGraph(nx.DiGraph, EquationMixin, VistomsMixin): Edge attributes can be specified with keywords or by directly accessing the edge's attribute dictionary. See examples below. - :param u, v: nodes - :type u, v: can be, for example, strings or numbers. Nodes must be hashable (and not None) Python objects. - :param attr: keyword arguments, optional - :type attr: Edge data (or labels or objects) can be assigned using keyword arguments. - The following examples both add the edge e=(1,2) to graph G: >>> G = nx.Graph() # or DiGraph, MultiGraph, MultiDiGraph, etc @@ -1963,7 +1987,7 @@ class KadmosGraph(nx.DiGraph, EquationMixin, VistomsMixin): :rtype: bool """ - return self.node[node]["category"] == "function" + return self.nodes[node]["category"] == "function" def node_is_variable(self, node): """Function that checks whether a node is a variable node or not. @@ -1974,7 +1998,7 @@ class KadmosGraph(nx.DiGraph, EquationMixin, VistomsMixin): :rtype: bool """ - return self.node[node]["category"] == "variable" + return self.nodes[node]["category"] == "variable" def node_is_output(self, node): """Function that checks whether a node is a system output. @@ -2045,20 +2069,17 @@ class KadmosGraph(nx.DiGraph, EquationMixin, VistomsMixin): def get_function_graph(self, keep_objective_variables=False): """Method for replacing variable nodes by function connections. - This function removes all variable nodes from the graph and replaces the variable connections of each function - with function connections, such that: - - F(1) => N(1) => F(2) => N(2) => F(3) - - becomes: - - F(1) => F(2) => F(3) - - Note: N(i) is a variable node, and F(i) a function node. - :param: keep_objective_variables: if given the objective variables will remain in graph :type: keep_objective_variables: bool :return: new graph without variable nodes + + .. note:: + This function removes all variable nodes from the graph and replaces the variable connections of each function + with function connections, such that if N(i) is a variable node, and F(i) a function node: + + F(1) => N(1) => F(2) => N(2) => F(3) + + becomes: F(1) => F(2) => F(3) """ # TODO: create separate function to get coupling strength between two nodes: get_coupling_strength @@ -2078,14 +2099,14 @@ class KadmosGraph(nx.DiGraph, EquationMixin, VistomsMixin): is_obj_var = False # Only consider variable nodes - node_cat = function_graph.node[node]['category'] + node_cat = function_graph.nodes[node]['category'] if node_cat == 'variable' or node_cat == 'variable group': # Loop in/out edges and get all function nodes connected to variable for edge in function_graph.out_edges(node): - if function_graph.node[edge[1]]['category'] == 'function': + if function_graph.nodes[edge[1]]['category'] == 'function': if keep_objective_variables: - if function_graph.node[edge[1]]["name"] == "Objective": + if function_graph.nodes[edge[1]]["name"] == "Objective": is_obj_var = True else: out_funcs.append(edge[1]) @@ -2093,7 +2114,7 @@ class KadmosGraph(nx.DiGraph, EquationMixin, VistomsMixin): else: out_funcs.append(edge[1]) for edge in function_graph.in_edges(node): - if function_graph.node[edge[0]]['category'] == 'function': + if function_graph.nodes[edge[0]]['category'] == 'function': in_funcs.append(edge[0]) # Add all variable nodes to remove list @@ -2124,12 +2145,16 @@ class KadmosGraph(nx.DiGraph, EquationMixin, VistomsMixin): def get_system_inputs(self, *args, **kwargs): """This method checks whether there are system inputs in the graph using the function nodes provided. - The function nodes should be provided in the args. If system inputs exist they are returned. - :param args: function nodes + :type args: + :param kwargs: + :type kwargs: :return: system input nodes dictionary :rtype: dict + + .. note:: The function nodes should be provided in the args. If system inputs exist they are returned. """ + # TODO: Imco add type of args and doc of kwargs assert all(self.node_is_function(arg) for arg in args), "At least one node in args is not a function node." @@ -2152,12 +2177,12 @@ class KadmosGraph(nx.DiGraph, EquationMixin, VistomsMixin): def get_graph_properties(self, *args): """This function retrieves the properties of a graph. - If no argument is given, the standard list of properties GRAPH_PROPERTIES is analyzed and their values are - returned in a dict. If arguments are given, only this list will be used as standard list of properties. - :param: args: specific properties to be retrieved (optional) :return: dictionary containing the properties of the graph :rtype: dict + + If no argument is given, the standard list of properties GRAPH_PROPERTIES is analyzed and their values are + returned in a dict. If arguments are given, only this list will be used as standard list of properties. """ # Make sure that arguments are valid @@ -2205,7 +2230,7 @@ class KadmosGraph(nx.DiGraph, EquationMixin, VistomsMixin): :param node: input node :return: number of couplings for the input node - :type: int + :rtype: int """ assert node in self, "The specified node is not present in graph." @@ -2221,6 +2246,15 @@ class KadmosGraph(nx.DiGraph, EquationMixin, VistomsMixin): def get_direct_coupling_nodes(self, *args, **kwargs): """This method returns the direct couplings between two nodes in a graph. + :param args: nodes to be checked for couplings; at least two must be provided + :type args: str, list + :param kwargs: print_couplings: option for printing all couplings with coupling direction and node (optional) + :type kwargs: print_couplings: bool + :param kwargs: direction: set only coupling in certain direction (optional) + :type kwargs: direction: str + :return: couplings: list of tuples containing the coupled nodes and the coupling node + :rtype: list + This method is specifically written (and tested) with function nodes in mind. Direct coupling is defined as coupling with between two nodes through a third node. @@ -2231,23 +2265,8 @@ class KadmosGraph(nx.DiGraph, EquationMixin, VistomsMixin): Example: - The connection: - - F1 => N1 => F2 - - leads to: - - [(F1, F2, N1)] - - - :param args: nodes to be checked for couplings; at least two must be provided - :type args: str, list - :param kwargs: print_couplings: option for printing all couplings with coupling direction and node (optional) - :type kwargs: print_couplings: bool - :param kwargs: direction: set only coupling in certain direction (optional) - :type kwargs: direction: str - :return: couplings: list of tuples containing the coupled nodes and the coupling node - :rtype: list + * The connection: F1 => N1 => F2 + * Leads to: [(F1, F2, N1)] """ # Assert that every argument is string, and node in graph @@ -2344,14 +2363,14 @@ class KadmosGraph(nx.DiGraph, EquationMixin, VistomsMixin): def get_nodes_based_on_strings(self, *args, **kwargs): """This function enables the user to search graph nodes for specific strings. - Each provided string will be searched for, and if multiple node are found for each string, the user will be able - to select the ones desired. The other matched nodes are disregarded. - :param args: strings that graph nodes being searched for :type args: str :param kwargs: include_all: If include_all is set to True, all matching nodes are added to returned list :type kwargs: include_all: bool :return: matching nodes that user selected (all if include_all is True) + + Each provided string will be searched for, and if multiple node are found for each string, the user will be able + to select the ones desired. The other matched nodes are disregarded. """ # Check if all found nodes should be included or not @@ -2431,13 +2450,13 @@ class KadmosGraph(nx.DiGraph, EquationMixin, VistomsMixin): def get_subgraph_by_function_nodes(self, *args, **kwargs): """This function retrieves a subgraph from the original graph only containing the argument nodes. - All arguments must be found in the graph. - :param args: arbitrary amount of graph nodes :type args: list, str :param kwargs: copy_type: type of copy (clean or deep) :type kwargs: copy_type: str :return: sub-graph only containing nodes provided as arguments, and their edges + + .. note:: All arguments must be found in the graph. """ # handle the fact that the *args could also be a list or tuple directly @@ -2501,6 +2520,10 @@ class KadmosGraph(nx.DiGraph, EquationMixin, VistomsMixin): def get_contracted_graph(self, contraction_level): """This function contracts the nodes of a graph to the provided contraction level. + :param contraction_level: from 0 (highest level) to X (lowest level existing in XML schema) + :type contraction_level: int + :return: contracted_graph: graph with contracted nodes + The contraction level refers to the xpath-level, which represents the position of the descendant with respect to its predecessors. The example below represents a level 3 node, with "cpacs" being at level zero. @@ -2514,14 +2537,10 @@ class KadmosGraph(nx.DiGraph, EquationMixin, VistomsMixin): ------------wing - - All nodes above the contraction level are removed from the graph and replaced by a "variable group" node, which - groups the removed nodes in a node at contraction level. This allows for a "de-cluttering" of the graph, with - the graph connections still being represented. - - :param contraction_level: from 0 (highest level) to X (lowest level existing in XML schema) - :type contraction_level: int - :return: contracted_graph: graph with contracted nodes + .. note:: + All nodes above the contraction level are removed from the graph and replaced by a "variable group" node, which + groups the removed nodes in a node at contraction level. This allows for a "de-cluttering" of the graph, with + the graph connections still being represented. """ # check input @@ -2632,6 +2651,11 @@ class KadmosGraph(nx.DiGraph, EquationMixin, VistomsMixin): def get_node_subcategory(self, node): """Method to analyse a node and to update the subcategory attribute of the node. + :param node: node in the graph + :type node: basestring + :return: subcategory of the node + :rtype: basestring + The following table illustrates how the subcategory is determined based on the category, indegree and outdegree: +-------------------+-----------------------------------+----------+-----------+ @@ -2671,11 +2695,6 @@ class KadmosGraph(nx.DiGraph, EquationMixin, VistomsMixin): | +-----------------------------------+----------+-----------+ | | complete | >0 | >0 | +-------------------+-----------------------------------+----------+-----------+ - - :param node: node in the graph - :type node: basestring - :return: subcategory of the node - :rtype: basestring """ # Check node @@ -2825,17 +2844,17 @@ class KadmosGraph(nx.DiGraph, EquationMixin, VistomsMixin): attr_list = [attr_list] if attr_list == 'all': - node_attr = self.node[node] + node_attr = self.nodes[node] if print_in_log: - for key in self.node[node]: - print ' ' + key + ': ' + str(self.node[node][key]) + for key in self.nodes[node]: + print ' ' + key + ': ' + str(self.nodes[node][key]) elif isinstance(attr_list, list): for key in attr_list: # check if key is part of the attributes - if key in self.node[node]: - node_attr[key] = self.node[node][key] + if key in self.nodes[node]: + node_attr[key] = self.nodes[node][key] if print_in_log: - print ' ' + key + ': ' + str(self.node[node][key]) + print ' ' + key + ': ' + str(self.nodes[node][key]) else: if print_in_log: print ' ' + key + ': attribute not defined for this node' @@ -2863,7 +2882,7 @@ class KadmosGraph(nx.DiGraph, EquationMixin, VistomsMixin): # Gather data metadata = [] - node_data = dict(self.node[node]) + node_data = dict(self.nodes[node]) # First loop over preferred data for item in preferred_data: @@ -2994,6 +3013,13 @@ class KadmosGraph(nx.DiGraph, EquationMixin, VistomsMixin): def add_objective_function_by_nodes(self, *args, **kwargs): """This function adds objective functions to the graph using lists of variable nodes. + :param args: list of nodes (list elements must be strings) + :type args: list + :param kwargs: list of nodes (list elements must be strings) + :type kwargs: list + :return: list of Objective Functions added to Graph + :rtype: list + Each list produces a separate objective function node in the graph. If the list if passed as a keyword argument, the keyword is taken as the name of the objective function node. Otherwise, a standard name will be given to the node. Each objective function node has one output variable, and takes the nodes given in the argument list as @@ -3010,14 +3036,7 @@ class KadmosGraph(nx.DiGraph, EquationMixin, VistomsMixin): The added objective function nodes can be queried by the attribute: - >>> Graph.node[node]["name"] == "Objective" - - :param args: list of nodes (list elements must be strings) - :type args: list - :param kwargs: list of nodes (list elements must be strings) - :type kwargs: list - :return: list of Objective Functions added to Graph - :rtype: list + >>> Graph.nodes[node]["name"] == "Objective" """ standard_func_name = "OBJECTIVE" @@ -3089,7 +3108,7 @@ class KadmosGraph(nx.DiGraph, EquationMixin, VistomsMixin): for element in obj_fun_tpl[1]: # make sure node is in graph and in category "variable" - if element not in self or not self.node[element]["category"] == "variable": + if element not in self or not self.nodes[element]["category"] == "variable": invalid_nodes.append(element) # remove invalid elements from list @@ -3147,11 +3166,13 @@ class KadmosGraph(nx.DiGraph, EquationMixin, VistomsMixin): def select_objectives_from_graph(self, *args): """This functions lets the user select one or more objective functions from the graph. - Only functions can be selected as objectives. If no arguments are provided, user is prompted to select an - objective from all functions in graph. - - :param: args: objective functions to choose from + :param args: objective functions to choose from + :type args: str :return: list of objective functions + :rtype: list + + .. note:: Only functions can be selected as objectives. If no arguments are provided, user is prompted to select + an objective from all functions in graph. """ # check if arguments provided @@ -3195,24 +3216,24 @@ class KadmosGraph(nx.DiGraph, EquationMixin, VistomsMixin): def node_is_objective_function(self, node): """This function checks whether the provided node is a objective function. - This function checks whether the provided node: - 1) exists in graph - 2) has name-attribute "Objective" - 3) has an out-degree of 1 - 4) has an outgoing node with an out-degree of zero # TODO: THIS IS WRONG! - - Only if all checks are satisfied, is the node a valid objective function node. - :param node: graph node to be tested :type node: str :return: check result :rtype: bool + + This function checks whether the provided node: + 1. exists in graph + 2. has name-attribute "Objective" + 3. has an out-degree of 1 + 4. has an outgoing node with an out-degree of zero + + .. note:: Only if all checks are satisfied, is the node a valid objective function node. """ # TODO: This may not be a good approach (see condition 4 above) if self.node_is_function(node): if node in self: - name_check = self.node[node]['name'] == 'Objective' # TODO: Fix this + name_check = self.nodes[node]['name'] == 'Objective' # TODO: Fix this out_deg_check = self.out_degree(node) == 1 try: out_node = list(self.out_edges(node))[0][1] @@ -3228,12 +3249,12 @@ class KadmosGraph(nx.DiGraph, EquationMixin, VistomsMixin): def merge_function_nodes_based_on_modes(self, merge_funcs=None): """This class method merges all execution modes of the same function into a single node. - Mainly used for illustration purposes since information on the execution modes gets lost. Functions must be - present in graph. - :param merge_funcs: List of tuple of functions to merge. If empty (default), all functions are merged. :type merge_funcs: list, tuple :return: merged graph + + Mainly used for illustration purposes since information on the execution modes gets lost. Functions must be + present in graph. """ # TODO: What if empty list is given? @@ -3262,7 +3283,7 @@ class KadmosGraph(nx.DiGraph, EquationMixin, VistomsMixin): for super_func in merge_funcs: if super_func in m_graph: # check if that "super"-function already exists - func_node = m_graph.node.get(super_func) + func_node = m_graph.nodes.get(super_func) func_keys = [k for k in func_node] for key in func_keys: if key in ["mode", "runtime", "precision", "fidelity"]: @@ -3306,7 +3327,7 @@ class KadmosGraph(nx.DiGraph, EquationMixin, VistomsMixin): else: original_node = node - node_data_dict = dict(self.node[node]) + node_data_dict = dict(self.nodes[node]) # Determine the related schema node if 'related_to_schema_node' in node_data_dict: @@ -3346,7 +3367,7 @@ class KadmosGraph(nx.DiGraph, EquationMixin, VistomsMixin): :param label_extension: extension for labels :type label_extension: str :param kwargs: keyword arguments will be added as node attributes - :type kwargs: dict + :type kwargs: dict, int :return: new node name and enriched graph :rtype: str """ @@ -3356,11 +3377,11 @@ class KadmosGraph(nx.DiGraph, EquationMixin, VistomsMixin): assert len(suffix) > 0, 'Suffix string should be larger than zero length.' new_node = node + suffix - node_data_dict = dict(self.node[node]) + node_data_dict = dict(self.nodes[node]) # determine the related schema node - if 'related_to_schema_node' in self.node[node]: - related_schema_node = self.node[node]['related_to_schema_node'] + if 'related_to_schema_node' in self.nodes[node]: + related_schema_node = self.nodes[node]['related_to_schema_node'] else: related_schema_node = node @@ -3372,7 +3393,7 @@ class KadmosGraph(nx.DiGraph, EquationMixin, VistomsMixin): label=get_correctly_extended_latex_label(node_data_dict['label'], label_extension)) if kwargs: for key, item in kwargs.iteritems(): - self.node[new_node][key] = item + self.nodes[new_node][key] = item return new_node @@ -3380,40 +3401,36 @@ class KadmosGraph(nx.DiGraph, EquationMixin, VistomsMixin): """Method to relabel all function nodes so that they meet the minimum CMDOWS convention :param mapping: application of mapping required, optional (default=None) - :type mapping: None, True + :type mapping: None, bool + :returns: relabeled graph CMDOWS convention: * Minimum information: ID * Maximum information: ID[modeID][instanceID][version] - Note: modeID, instanceID and version are only provided if there is a function with the same ID that requires - this specification to differentiate between the functions. + .. note:: modeID, instanceID and version are only provided if there is a function with the same ID that requires + this specification to differentiate between the functions. Example: Design competences (full information): - * Aerodynamics[A][1][v1] - * Aerodynamics[A][2][v1] - * Aerodynamics[B][1][v1] - - * Structures[A][1][v1] - * Structures[A}[1][v2] - - * Propulsion[A][1][v2] + #. Aerodynamics[A][1][v1] + #. Aerodynamics[A][2][v1] + #. Aerodynamics[B][1][v1] + #. Structures[A][1][v1] + #. Structures[A}[1][v2] + #. Propulsion[A][1][v2] Design competences relabeled: - * Aerodynamics[A][1] - * Aerodynamics[A][2] - * Aerodynamics[B][1] - - * Structure[v1] - * Structure[v2] - - * Propulsion - + #. Aerodynamics[A][1] + #. Aerodynamics[A][2] + #. Aerodynamics[B][1] + #. Structure[v1] + #. Structure[v2] + #. Propulsion """ # Determine nodes to be renamed @@ -3435,10 +3452,10 @@ class KadmosGraph(nx.DiGraph, EquationMixin, VistomsMixin): des_comps = [] for design_competence in design_competences: - id = self.node[design_competence].get('name', design_competence) - mode = self.node[design_competence].get('mode', 'main') - instance = self.node[design_competence].get('instance', '1') - version = self.node[design_competence].get('version', '1.0') + id = self.nodes[design_competence].get('name', design_competence) + mode = self.nodes[design_competence].get('mode', 'main') + instance = self.nodes[design_competence].get('instance', '1') + version = self.nodes[design_competence].get('version', '1.0') mapping[design_competence] = '{}[{}][{}][{}]'.format(id, mode, instance, version) des_comps.append(design_competence) labels.append([id]) @@ -3463,7 +3480,7 @@ class KadmosGraph(nx.DiGraph, EquationMixin, VistomsMixin): ids_dict[ids[i]] = update multiples.add(ids[i]) else: - ids_dict[ids[i]]=i + ids_dict[ids[i]] = i # for the IDs that are used multiple times determine if there is a difference in mode/instance/version for multiple in multiples: indices = ids_dict[multiple] @@ -3500,8 +3517,8 @@ class KadmosGraph(nx.DiGraph, EquationMixin, VistomsMixin): [group], mapping) if 'function_order' in self.graph['problem_formulation']: - self.graph['problem_formulation']['function_order'] = translate_list(self.graph['problem_formulation'] - ['function_order'], mapping) + self.graph['problem_formulation']['function_order'] = \ + translate_list(self.graph['problem_formulation']['function_order'], mapping) if 'function_ordering' in self.graph['problem_formulation']: for group in self.graph['problem_formulation']['function_ordering']: self.graph['problem_formulation']['function_ordering'][group] = \ @@ -3512,11 +3529,13 @@ class KadmosGraph(nx.DiGraph, EquationMixin, VistomsMixin): def remove_function_nodes(self, *args): """Function that removes a function node - Also the input and output variables that only have links to this specific function node are deleted. A simple - remove_node of a function node might lead to unconnected variables in the graph. - :param args: function node id(s) - :type args: str or list + :type args: str, list + :return: graph with nodes removed + :rtype: KadmosGraph + + .. attention:: Also the input and output variables that only have links to this specific function node are + deleted. A simple remove_node of a function node might lead to unconnected variables in the graph. """ # Input assertions @@ -3526,7 +3545,7 @@ class KadmosGraph(nx.DiGraph, EquationMixin, VistomsMixin): assert isinstance(arg, basestring), 'Argument %s is not of type basestring.' % arg assert self.has_node(arg), 'Node "' + str(arg) + '" is not present in the graph.' assert self.node_is_function(arg), \ - 'Node "' + str(arg) + '" is not of category function (but ' + self.node[arg]['category'] + ').' + 'Node "' + str(arg) + '" is not of category function (but ' + self.nodes[arg]['category'] + ').' # Remove functions including input and output variables (if allowed) for node in args: @@ -3552,6 +3571,8 @@ class KadmosGraph(nx.DiGraph, EquationMixin, VistomsMixin): :type args: node_ids :param kwargs: new_label to specify new node label manually (optional) :type kwargs: dict + :return: graph with merged functions + :rtype: KadmosGraph """ # Handle the fact that the *args could also be a list or tuple directly @@ -3607,6 +3628,8 @@ class KadmosGraph(nx.DiGraph, EquationMixin, VistomsMixin): :type args: node_ids :param kwargs: new_label to specify new node label manually (optional) :type kwargs: dict + :return: graph with merged function + :rtype: KadmosGraph """ # Handle the fact that the *args could also be a list or tuple directly @@ -3646,13 +3669,15 @@ class KadmosGraph(nx.DiGraph, EquationMixin, VistomsMixin): def merge_sequential_functions(self, *args, **kwargs): """Function to merge a collection of functions. - It is assumed that the merged functions are actually executed in the sequence in which they are given to this - function. - :param args: functions to be merged in the given sequence :type args: node_ids :param kwargs: new_label to specify new node label manually (optional) :type kwargs: str + :return: graph with merged functions + :rtype: KadmosGraph + + .. attention:: It is assumed that the merged functions are actually executed in the sequence in which they are + given to this function. """ # Handle the fact that the *args could also be a list or tuple directly @@ -3706,7 +3731,7 @@ class KadmosGraph(nx.DiGraph, EquationMixin, VistomsMixin): new_graph.remove_edge(coupling_node, new_label) # If the couplings can be removed, then do so if 'remove_internal_couplings' in kwargs: - if kwargs['remove_internal_couplings'] == True: + if kwargs['remove_internal_couplings']: new_graph.remove_node(coupling_node) new_graph = graph_class(new_graph) return new_graph @@ -3796,17 +3821,24 @@ class KadmosGraph(nx.DiGraph, EquationMixin, VistomsMixin): def split_variables(self, *args, **kwargs): """Method to split a problematic variable node into multiple separate valid nodes. + :param args: problematic node in the graph + :type args: basestring, list + :param kwargs: + :type kwargs: + :return: graph with split variables + :rtype: KadmosGraph + The following variables are considered problematic and will be handled by this function: - * pure circular coupling - * shared circular coupling - * collided coupling - * collision - * collided circular coupling - * collided shared coupling - * collided shared circular coupling + * pure circular coupling + * shared circular coupling + * collided coupling + * collision + * collided circular coupling + * collided shared coupling + * collided shared circular coupling - The following table shows an example situation for each of the different problematic variables: + The following table shows an example situation for each of the different problematic variables: +----------------------+------------------------+----------------+---------------------------------------+ | PROBLEMATIC VARIABLE | SITUATION | FUNCTION ORDER | RESOLVED AS | @@ -3841,9 +3873,8 @@ class KadmosGraph(nx.DiGraph, EquationMixin, VistomsMixin): | | | | x1/variableInstance4 => F6 | +----------------------+------------------------+----------------+---------------------------------------+ - :param args: problematic node in the graph - :type args: basestring, list """ + #TODO Imco add kwargs documentation # Input assertions if len(args) == 0: @@ -3941,6 +3972,8 @@ class KadmosGraph(nx.DiGraph, EquationMixin, VistomsMixin): def make_all_variables_valid(self): """Method to analyze all variables in a graph and make any problematic variables valid. + :return: graph with problematic variables removed. + Problematic variable are holes and splittables. Splittable variables are split and holes will simply be removed. """ @@ -3963,22 +3996,23 @@ class KadmosGraph(nx.DiGraph, EquationMixin, VistomsMixin): disconnect_shared_sources=True, ignore_list=[]): """Method to automatically disconnect certain problematic variables with respect to a given function. - If given as setting (disconnect_collided_targets=True) then the collided targets will be disconnected from this - function. Also, if given as setting (disconnect_shared_sources=True), shared sources are also disconnected. - :param function: function around which problematic variables are disconnected :type function: basestring :param disconnect_collided_targets: setting to disconnect collided targets :type disconnect_collided_targets: bool :param disconnect_shared_sources: setting to disconnect shared sources :type disconnect_shared_sources: bool - :param disconnect_shared_sources: setting to ignore certain nodes - :type disconnect_shared_sources: list + :param ignore_list: setting to ignore certain nodes + :type ignore_list: list + + If given as setting (disconnect_collided_targets=True) then the collided targets will be disconnected from this + function. Also, if given as setting (disconnect_shared_sources=True), shared sources are also disconnected. """ # Input assertions assert self.has_node(function), 'Node {} not present in the graph.'.format(function) - assert self.node[function]['category'] == 'function', 'Node {} should be of category function.'.format(function) + assert self.nodes[function]['category'] == 'function', \ + 'Node {} should be of category function.'.format(function) assert isinstance(disconnect_collided_targets, bool) assert isinstance(disconnect_shared_sources, bool) assert isinstance(ignore_list, list) @@ -3999,11 +4033,11 @@ class KadmosGraph(nx.DiGraph, EquationMixin, VistomsMixin): # Disconnect if required for target_node in target_nodes: - if self.node[target_node]['subcategory'] in \ + if self.nodes[target_node]['subcategory'] in \ self.NODE_GROUP_SUBCATS['all problematic variables'][3:8]: # all collided subcategories self.remove_edge(function, target_node) for source_node in source_nodes: - if self.node[source_node]['subcategory'] in \ + if self.nodes[source_node]['subcategory'] in \ get_list_entries(self.NODE_GROUP_SUBCATS['all problematic variables'], 2, 6, 7): # all shared # subcategories self.remove_edge(source_node, function) @@ -4013,8 +4047,6 @@ class KadmosGraph(nx.DiGraph, EquationMixin, VistomsMixin): def check_for_coupling(self, function_order, only_feedback=False, raise_error_if_true=False): """Function to check for the presence of coupling in a graph for a list of analyses in a given analysis order. - Note that only the functions in the function_order list are checked for feedback. - :param function_order: list with node names of functions :type function_order: list :param only_feedback: Boolean on whether to check for feedback coupling only (this is useful for Gauss-Seidel) @@ -4023,6 +4055,8 @@ class KadmosGraph(nx.DiGraph, EquationMixin, VistomsMixin): :type raise_error_if_true: bool :return: Boolean value on whether coupling exists :rtype: bool + + .. note:: only the functions in the function_order list are checked for feedback. """ # Set coupling initially to False. @@ -4198,7 +4232,8 @@ class KadmosGraph(nx.DiGraph, EquationMixin, VistomsMixin): Get all nodes with any of the listed attribute values: >>> all_nodes = self.find_all_nodes(category='all', subcategory='all', - >>> attr_include=[['problem_role', ['constraint', 'objective']], ['instance', 1]]) + >>> attr_include=[['problem_role', ['constraint', 'objective']], + >>> ['instance', 1]]) """ # TODO: Update docstring @@ -4296,18 +4331,19 @@ class KadmosGraph(nx.DiGraph, EquationMixin, VistomsMixin): if attr_cond is None: eval_node = True elif isinstance(attr_cond[0], basestring): - if attr_cond[0] in self.node[item]: - if test_attr_cond(self.node[item][attr_cond[0]], attr_cond[1], attr_cond[2]): + if attr_cond[0] in self.nodes[item]: + if test_attr_cond(self.nodes[item][attr_cond[0]], attr_cond[1], attr_cond[2]): eval_node = True else: eval_node = False else: eval_node = False else: - eval_node=True + eval_node = True for attr in attr_cond: - if attr[0] in self.node[item]: - if test_attr_cond(self.node[item][attr[0]], attr[1], attr[2]) and eval_node: + if attr[0] in self.nodes[item]: + if test_attr_cond(self.nodes[item][attr[0]], attr[1], attr[2]) and \ + eval_node: eval_node = True else: eval_node = False @@ -4326,18 +4362,18 @@ class KadmosGraph(nx.DiGraph, EquationMixin, VistomsMixin): # include all nodes (from selection) that have any of the specified attributes. if attr_include: filtered = set() - if isinstance(attr_include,type(None)): + if isinstance(attr_include, type(None)): pass elif isinstance(attr_include[0], basestring): for node in all_nodes: - if self.node[node].get(attr_include[0]): - if self.node[node][attr_include[0]] in attr_include[1]: + if self.nodes[node].get(attr_include[0]): + if self.nodes[node][attr_include[0]] in attr_include[1]: filtered.add(node) else: for attr in attr_include: for node in all_nodes: - if self.node[node].get(attr[0]): - if self.node[node][attr[0]] in attr[1]: + if self.nodes[node].get(attr[0]): + if self.nodes[node][attr[0]] in attr[1]: filtered.add(node) filtered = list(filtered) all_nodes = filtered @@ -4350,8 +4386,8 @@ class KadmosGraph(nx.DiGraph, EquationMixin, VistomsMixin): elif isinstance(attr_exclude[0], basestring): for node in all_nodes: choice = True - if self.node[node].get(attr_exclude[0]): - if self.node[node][attr_exclude[0]] in attr_exclude[1]: + if self.nodes[node].get(attr_exclude[0]): + if self.nodes[node][attr_exclude[0]] in attr_exclude[1]: choice = False if choice: filtered.append(node) @@ -4359,8 +4395,8 @@ class KadmosGraph(nx.DiGraph, EquationMixin, VistomsMixin): for attr in attr_exclude: for node in all_nodes: choice = True - if self.node[node].get(attr[0]): - if self.node[node][attr[0]] in attr[1]: + if self.nodes[node].get(attr[0]): + if self.nodes[node][attr[0]] in attr[1]: choice = False if choice: filtered.append(node) @@ -4371,7 +4407,7 @@ class KadmosGraph(nx.DiGraph, EquationMixin, VistomsMixin): for xpath in xpath_include: path = xpath.split('/') for node in all_nodes: - node_path = self.node[node]['name'].split('/') + node_path = self.nodes[node]['name'].split('/') for el in range(len(path)): choice = False if node_path[el] == path[el]: @@ -4387,7 +4423,7 @@ class KadmosGraph(nx.DiGraph, EquationMixin, VistomsMixin): for xpath in xpath_exclude: path = xpath.split('/') for node in all_nodes: - node_path = self.node[node]['name'].split('/') + node_path = self.nodes[node]['name'].split('/') for el in range(len(path)): choice = True if node_path[el] == path[el]: @@ -4468,24 +4504,29 @@ class KadmosGraph(nx.DiGraph, EquationMixin, VistomsMixin): title=None, edge_label=False): """Function to plot a graph. - Note that you need to add matplotlib.pyplot.show() at the end of your code to see the plot window. - :param fig_num: figure number - :param fig_size: size of figure window + :type fig_num: int :param color_setting: choose from 'default', 'sinks', 'categories', 'partitions' + :type color_setting: str :param positioning: choose from 'circular', 'spring' + :type positioning: str :param save_as: save plot as figure file + :type save_as: bool :param show_now: Boolean whether to plot directly (pausing the execution until the plot is closed), or not. - :param title: title string of the graph + :type show_now: bool + :param title: title of the graph + :type title: str :param edge_label: edge attribute that will be shown for each edge in graph + :type edge_label: str :return: window with plot - """ + .. hint:: if the plot window is not showing, you need to add matplotlib.pyplot.show() at the end of your code + """ # Create node labels node_labels = {} for node, data in self.nodes(data=True): - node_labels[node] = self.node[node]['label'] + node_labels[node] = self.nodes[node]['label'] # Create figure f = plt.figure(num=fig_num, figsize=(min(len(node_labels)/3, 50), min(len(node_labels)/3, 50))) @@ -4530,8 +4571,8 @@ class KadmosGraph(nx.DiGraph, EquationMixin, VistomsMixin): 'function': '#FFD700', 'architecture element': '#66FF99'} # Based on html hex string colors legend_names = {'variable': 'variable', - 'variable group':'variable group', - 'function':'function', + 'variable group': 'variable group', + 'function': 'function', 'architecture element': 'architecture element'} for category in node_cate: @@ -4539,7 +4580,7 @@ class KadmosGraph(nx.DiGraph, EquationMixin, VistomsMixin): # the use of the layout. nx.draw_networkx_nodes(self, pos, with_labels=False, nodelist=[s_node[0] for s_node in - filter(lambda x: x[1]["category"] == category, self.nodes(data=True))], + filter(lambda x: x[1]["category"] == category, self.nodes(data=True))], node_shape=node_shapes[category], node_color=node_colors[category], node_size=node_sizes[category]) @@ -4559,7 +4600,7 @@ class KadmosGraph(nx.DiGraph, EquationMixin, VistomsMixin): node_cate = set((category[1]["category"] for category in self.nodes(data=True))) for category in node_cate: - nodelist = nodelist=[s_node[0] for s_node in + nodelist = [s_node[0] for s_node in filter(lambda x: x[1]["category"] == category, self.nodes(data=True))] node_color = [] for entry in nodelist: @@ -4602,28 +4643,26 @@ class KadmosGraph(nx.DiGraph, EquationMixin, VistomsMixin): node_color = [] for node in nodelist: if node in grouped_nodes['variable']['hole'] or \ - node in grouped_nodes['variable']['collision'] or \ - node in grouped_nodes['variable']['collided coupling'] or \ - node in grouped_nodes['variable']['collided shared coupling'] or \ - node in grouped_nodes['variable group']['hole group'] or \ - node in grouped_nodes['variable group']['hole group'] or \ - node in grouped_nodes['function']['independent']: - node_color.append(node_colors['wrong']) + node in grouped_nodes['variable']['collision'] or \ + node in grouped_nodes['variable']['collided coupling'] or \ + node in grouped_nodes['variable']['collided shared coupling'] or \ + node in grouped_nodes['variable group']['hole group'] or \ + node in grouped_nodes['variable group']['hole group'] or \ + node in grouped_nodes['function']['independent']: node_color.append(node_colors['wrong']) elif node in grouped_nodes['function']['inputless'] or \ - node in grouped_nodes['function']['outputless']: + node in grouped_nodes['function']['outputless']: node_color.append(node_colors['problematic']) elif node in grouped_nodes['variable']['supplied input'] or \ - node in grouped_nodes['variable']['supplied shared input'] or \ - node in grouped_nodes['variable']['output'] or \ - node in grouped_nodes['variable group']['supplied input group'] or \ - node in grouped_nodes['variable group']['supplied shared input group'] or \ - node in grouped_nodes['variable group']['output group'] or \ - node in grouped_nodes['function']['complete']: - node_color.append(node_colors['accepted']) + node in grouped_nodes['variable']['supplied shared input'] or \ + node in grouped_nodes['variable']['output'] or \ + node in grouped_nodes['variable group']['supplied input group'] or \ + node in grouped_nodes['variable group']['supplied shared input group'] or \ + node in grouped_nodes['variable group']['output group'] or \ + node in grouped_nodes['function']['complete']: node_color.append(node_colors['accepted']) elif node in grouped_nodes['variable']['coupling'] or \ - node in grouped_nodes['variable']['shared coupling'] or \ - node in grouped_nodes['variable group']['coupling group'] or \ - node in grouped_nodes['variable group']['shared coupling group']: + node in grouped_nodes['variable']['shared coupling'] or \ + node in grouped_nodes['variable group']['coupling group'] or \ + node in grouped_nodes['variable group']['shared coupling group']: node_color.append(node_colors['couplings']) else: raise AttributeError('Node not found in node grouping dictionary.') @@ -4650,8 +4689,8 @@ class KadmosGraph(nx.DiGraph, EquationMixin, VistomsMixin): filter(lambda x: x[1]["category"] == category, self.nodes(data=True))] node_color = [] for node in nodelist: - node_color.append(self.node[node]['part_color']) - color_set.add(self.node[node]['part_color']) + node_color.append(self.nodes[node]['part_color']) + color_set.add(self.nodes[node]['part_color']) # Draw the subset of nodes with the same symbol in the positions that are now known through the # use of the layout. nx.draw_networkx_nodes(self, pos, @@ -4675,7 +4714,7 @@ class KadmosGraph(nx.DiGraph, EquationMixin, VistomsMixin): nx.draw_networkx_edges(self, pos, arrows=True, ax=ax, width=0.5, arrowstyle='->', nodesize=node_sizes['function']) - if len(node_labels)<100: + if len(node_labels) < 100: nx.draw_networkx_labels(self, pos, node_labels, fontsize=10, ax=ax) if edge_label: # noinspection PyUnboundLocalVariable @@ -4752,7 +4791,10 @@ def load(file_name, file_type=None, check_list=None, file_check_critical=True, s 'schemas': to check XML input/output files against a schema file (XSD) in case of CMDOWS file in combination with in- and output XML files. :type check_list: list - + :param ignore_modes: for determining if modes are taken into account + :type ignore_modes: bool + :param keep_running: for determining if errors should be raised + :type keep_running: bool :return: graph loaded from file :rtype: KadmosGraph """ @@ -4813,28 +4855,27 @@ def load(file_name, file_type=None, check_list=None, file_check_critical=True, s def check_database(file_name, source_folder=None, check_list=None, keep_running=False): """Method to check the XML-files inside the database for parse errors, inconsistent roots, invalid leaf elements - and schema inconsistencies. - - :param file_name: name of the cmdows file. - :type file_name: str - :param file_type: file_type - :type file_type: str - :param source_folder: source folder which contains the input file - :type source_folder: str - :param check_list: list with checks to be performed on in case of CMDOWS file with in-/output XML files. - :type check_list: list + and schema inconsistencies. - :return: graph loaded from file - :rtype: KadmosGraph + :param file_name: name of the cmdows file. + :type file_name: str + :param source_folder: source folder which contains the input file + :type source_folder: str + :param check_list: list with checks to be performed on in case of CMDOWS file with in-/output XML files. + :type check_list: list + :param keep_running: for determining if errors should be raised + :type keep_running: bool + :return: graph loaded from file + :rtype: KadmosGraph - Check_list options: + Check_list options: - * 'consistent_root': to check XML input/output files have the same, single root element. - * 'invalid_leaf_elements': to check XML input/output files for invalid leaf elements. - * 'schemas': to check XML input/output files against a schema file (XSD) in case of CMDOWS file in combination - with in- and output XML files. + * 'consistent_root': to check XML input/output files have the same, single root element. + * 'invalid_leaf_elements': to check XML input/output files for invalid leaf elements. + * 'schemas': to check XML input/output files against a schema file (XSD) in case of CMDOWS file in combination + with in- and output XML files. - """ + """ # Try to detect the file type automatically if file_name.lower().endswith(tuple(file_extensions)): @@ -4938,6 +4979,7 @@ def _perform_check_list(io_list, check_list, keep_running=False): return + def _load_kdms(file_path): # Parse @@ -5060,7 +5102,7 @@ def _read_io_xml_file(file_path, mode, ignore_modes=False): if not el.getchildren(): # if leaf node - if _check_execution_mode_for_element(el, tree, file_path, mode, ignore_modes=ignore_modes): # if right mode specification + if _check_execution_mode_for_element(el, tree, file_path, mode, ignore_modes=ignore_modes): # append path to list of leaf nodes leafNodesList.append(path) @@ -5158,12 +5200,12 @@ def _check_execution_mode_for_element(element, tree, file, req_mode, ignore_mode else: # get element xpath elementPath = tree.getpath(element) - # get function modes from info file and assert that they are unique - execModes = '' # NOTE: if no modes indicated, all modes are applied to node + execModes = '' # NOTE: if no modes indicated, all modes are applied to node modesFound = False - if 'modes' in element.attrib and re.search("[^\s]", element.attrib['modes']): # if 'modes' key present and has characters + # if 'modes' key present and has characters + if 'modes' in element.attrib and re.search("[^\s]", element.attrib['modes']): assert isinstance(element.attrib['modes'], basestring), "If provided, modes-attribute of element {} in " \ "{} must be of type string.".format(elementPath, file) @@ -5171,13 +5213,13 @@ def _check_execution_mode_for_element(element, tree, file, req_mode, ignore_mode modesFound = True for anc in element.iterancestors(): - if 'modes' in anc.attrib and re.search("[^\s]", anc.attrib['modes']): + if 'modes' in anc.attrib and re.search("[^\s]", anc.attrib['modes']): if not modesFound: modesFound = True execModes = anc.attrib['modes'] else: - logger.warning("Multiple 'modes' attributes found in ancestry of element {} in {}; lowest one is " \ - "applied.".format(elementPath, file)) + logger.warning("Multiple 'modes' attributes found in ancestry of element {} in {}; lowest one is " + "applied.".format(elementPath, file)) break negModesList = [] @@ -5195,7 +5237,6 @@ def _check_execution_mode_for_element(element, tree, file, req_mode, ignore_mode negModesList = [mode[1:] for mode in modesList] modesList = [] - # check if the mode is the required mode if req_mode in modesList or not modesList: if req_mode not in negModesList: @@ -5263,11 +5304,13 @@ def _validate_file_against_schema(file_path, schema_path, keep_running=False): 'additional info).'.format(os.path.split(file_path)[1], os.path.split(schema_path)[1])) return + def _check_roots(io_list, keep_running=False): - """ - This function checks if there are inconsistent roots in the XML input and output files. + """This function checks if there are inconsistent roots in the XML input and output files. + :rtype: Warning """ + logger.info('Checking for inconsistent roots...') first_file = True @@ -5353,7 +5396,7 @@ def _check_leafs(io_list, leafs, keep_running=False): return -def _parse_check(io_list, keep_running=False): +def _parse_check(io_list): logger.info('Checking for parsing errors...') for entry in io_list: file_path=entry[0] @@ -5372,4 +5415,3 @@ def _try_parsing(file_path, keep_running=False): raise IOError('Could not parse XML file {}. Check file structure.'.format(os.path.split(file_path)[1])) return tree - diff --git a/kadmos/graph/graph_process.py b/kadmos/graph/graph_process.py index e4bfe45536a1aba046bb102bfaba1827683c245e..915bafa45c011fd508f76592315863d1f9e0fd24 100644 --- a/kadmos/graph/graph_process.py +++ b/kadmos/graph/graph_process.py @@ -174,7 +174,10 @@ class MdaoProcessGraph(ProcessGraph): # PRINTING METHODS # # ---------------------------------------------------------------------------------------------------------------- # def inspect_process(self): - """Method to print the MPG.""" + """Method to print the MPG. + + :return: printed inspection + """ print '\n- - - - - - - - - - -' print ' PROCESS INSPECTION ' @@ -202,8 +205,7 @@ class MdaoProcessGraph(ProcessGraph): # GRAPH SPECIFIC METHODS # # ---------------------------------------------------------------------------------------------------------------- # def _add_diagonal_positions(self): - """ - Method to add the diagonal positions of function blocks based on the monolithic architectures + """Method to add the diagonal positions of function blocks based on the monolithic architectures :return: function nodes with diagonal positions :rtype: None @@ -505,6 +507,20 @@ class MdaoProcessGraph(ProcessGraph): end_in_iterative_node=None): """Function to add the process in the partitions + :param previous_sequence: previous list of functions in the required sequence + :type previous_sequence: list + :param partitions: process partitions to be added + :type partitions: dict + :param next_sequence: next list of functions in the required sequence + :type next_sequence: list + :param process_step: process step number for the first element in the sequence + :type process_step: int + :param mdg: data graph to be used for execution dependencies + :type mdg: MdaoDataGraph + :param end_in_iterative_node: (optional) iterative node to which the last function should go + :type end_in_iterative_node: basestring + :return: graph enriched with process partitioning + :rtype: MdaoProcessGraph """ local_convergers = self.graph['problem_formulation']['local_convergers'] @@ -599,12 +615,14 @@ class MdaoProcessGraph(ProcessGraph): def connect_nested_iterators(self, master, slave, direction='slave->master'): """Method to connect a slave iterator to a master iterator in a nested configuration. - An example is if a converger inside an optimizer in MDF needs to be linked back. - :param master: upper iterator node in the nested configuration :type master: basestring :param slave: lower iterator node in the nested configuration :type slave: basestring + :return: graph enriched with nested iterators + :rtype: MdaoProcessGraph + + An example is if a converger inside an optimizer in MDF needs to be linked back. """ dir_options = ['slave->master', 'master->slave'] assert direction in dir_options, 'direction options are {} and {}.'.format(dir_options[0], dir_options[1]) @@ -707,8 +725,7 @@ class MdaoProcessGraph(ProcessGraph): return process_list def get_process_hierarchy(self): - """ - Method to assess the hierarchy of the process based on the process lines in a ProcessGraph. + """Method to assess the hierarchy of the process based on the process lines in a ProcessGraph. :return: nested list with process hierarchy, e.g. [COOR, A, [OPT, [CONV, D1, D2], F1, G1, G2]] :rtype: list @@ -767,8 +784,11 @@ def get_process_list_iteratively(cycle_node, cycles): :type cycle_node: str :param cycles: collection of cycles found in the graph :type cycles: list - :return: the process list, e.g. [COOR, A, [OPT, [CONV, D1, D2], F1, G1, G2]] + :return: the process list :rtype: list + + .. note:: Example of a process list: + [COOR, A, [OPT, [CONV, D1, D2], F1, G1, G2]] """ sub_list = [cycle_node, []] current_cycles = [cycle for cycle in cycles if cycle_node in cycle] @@ -800,9 +820,8 @@ def get_process_list_iteratively(cycle_node, cycles): def get_executable_functions(coupling_matrix, sequence): - """ - Method to determine which of the functions in the process graph are executable based on data dependencies from the - MDG. + """Method to determine which of the functions in the process graph are executable based on data dependencies from + the MDG. :param coupling_matrix: coupling matrix of the MDG :type coupling_matrix: array.py diff --git a/kadmos/graph/mixin_equation.py b/kadmos/graph/mixin_equation.py index ff9f4d61f86d8d7a5a4456c8e3b455546bf95cc8..6bf4a79b3cf743fddeea929712b9ac9878272473 100644 --- a/kadmos/graph/mixin_equation.py +++ b/kadmos/graph/mixin_equation.py @@ -37,7 +37,8 @@ class EquationMixin(object): :type self: KadmosGraph :return: list of proper equation nodes - :rtype: list""" + :rtype: list + """ nodes_temp = [] nodes = [] @@ -128,6 +129,9 @@ class EquationMixin(object): :type language: str :param labeling_method: select method for automatic label string determination (node_id or node_label) :type labeling_method: str + + :return: labels + :rtype: str """ # Loop @@ -146,6 +150,9 @@ class EquationMixin(object): :type equation: str :param language: equation language used for the equation :type language: str + + :return: equation + :rtype: str """ # Check if a edge or node is given @@ -183,6 +190,9 @@ class EquationMixin(object): :type output_nodes: str, list :param function_type: type of function, optional (default='regular') :type function_type: 'regular' or 'consistency' + + :return: mathematical function + :rtype: str """ assert not self.has_node(function_node), 'Function node {} already exists in the graph.'.format(function_node) diff --git a/kadmos/graph/mixin_mdao.py b/kadmos/graph/mixin_mdao.py index e4521f98803f485c901cb7961d9efafde093e452..573a5a4c44bafd13377c29b77d99749e82a150ce 100644 --- a/kadmos/graph/mixin_mdao.py +++ b/kadmos/graph/mixin_mdao.py @@ -22,6 +22,8 @@ class MdaoMixin(object): :type self: KadmosGraph :param node: node identifier :type node: str + :return: graph with removed node from diagonal + :rtype: MdaoMixin """ # Input assertions @@ -50,6 +52,8 @@ class MdaoMixin(object): :type diagonal_pos: int :param attr_dict: dictionary with node attributes :type attr_dict: dict + :return: graph with inserted node on diagonal + :rtype: MdaoMixin """ # Input assertions diff --git a/kadmos/graph/mixin_vistoms.py b/kadmos/graph/mixin_vistoms.py index 126fb758af1756f1bea99e81844dbb4f8936b00c..92b1f8a3279f36ea201257364e84e7b329ee3d69 100644 --- a/kadmos/graph/mixin_vistoms.py +++ b/kadmos/graph/mixin_vistoms.py @@ -40,6 +40,7 @@ LOCAL_FILE_REFS = dict(REP__Acknowledgements__REP=os.path.join(LOCAL_PATH_PICTUR REP__VISTOMS_Label__REP=os.path.join(LOCAL_PATH_PICTURES, "VISTOMS_Label.svg")) + class VistomsMixin(object): def vistoms_start(self, file_dir=None, mpg=None): @@ -84,7 +85,7 @@ class VistomsMixin(object): :param vistoms_dir: directory of the VISTOMS directory to be created :type vistoms_dir: str :param vistoms_version: version of the VISTOMS instance to be used (as stored in the package itself) - :param vispack_version: str + :param vistoms_version: str :param mpg: optional MPG graph to be saved with MDG as XDSM (if None a DSM is created) :type mpg: MdaoProcessGraph :param function_order: optional function order for the diagonal of the graph (only applicable for DSMs) @@ -103,7 +104,10 @@ class VistomsMixin(object): :type file_refs: dict :param xml_file: Name of the CMDOWS xml file :type xml_file: file + :return: vistoms instance + :rtype: VistomsMixin """ + # Check inputs self._vistoms_assertions(mpg, function_order, reference_file, vistoms_version, graph_id) @@ -146,13 +150,13 @@ class VistomsMixin(object): if file_refs is None: rep = dict(LOCAL_FILE_REFS) if use_png_figs: - for key,item in rep.iteritems(): + for key, item in rep.iteritems(): if '.svg' in item: rep[key] = item.replace('.svg', '.png') rep['REP__GRAPH_DATA__REP'] = data_str else: rep = file_refs - for key,item in LOCAL_FILE_REFS.iteritems(): + for key, item in LOCAL_FILE_REFS.iteritems(): assert key in rep, 'Replacement key %s is missing in the file_refs.' % key rep['REP__GRAPH_DATA__REP'] = data_str @@ -190,9 +194,6 @@ class VistomsMixin(object): remove_after_compress=True, graph_id=None, replacement_id=None, xml_file=None): """Function to add a graph to a existing VISTOMS instance. - In one VISTOMS instance different graphs can be shown. For example it is possible to include different - architectures for the same problem in one VISTOMS instance. - :param vistoms_dir: directory of the VISTOMS directory to be used for addition :type vistoms_dir: str :param mpg: optional MPG graph to be saved with MDG as XDSM (if None a DSM is created) @@ -205,10 +206,17 @@ class VistomsMixin(object): :type compress: bool :param remove_after_compress: setting whether to remove the original folder after compression :type remove_after_compress: bool + :param graph_id: indentifier of the new graph + :type graph_id: basestring :param replacement_id: indentifier of the graph to be replaced - :type replacement_id: basestr + :type replacement_id: basestring :param xml_file: Name of the CMDOWS xml-file :type xml_file: file + :return: enriched vistoms instance + :rtype: VistomsMixin + + .. hint:: In one VISTOMS instance different graphs can be shown. For example it is possible to include different + architectures for the same problem in one VISTOMS instance. """ # Check inputs @@ -216,8 +224,8 @@ class VistomsMixin(object): if replacement_id: assert isinstance(replacement_id, str), 'The attribute replacement_id should be of type str.' assert os.path.exists(vistoms_dir), 'There is not a VISTOMS instance at %s.' % vistoms_dir - assert os.path.exists(os.path.join(vistoms_dir, VISTOMS_NAME)), VISTOMS_NAME + \ - ' not found in folder %s.' % vistoms_dir + assert os.path.exists(os.path.join(vistoms_dir, VISTOMS_NAME)), \ + VISTOMS_NAME + ' not found in folder %s.' % vistoms_dir # Logging logger.info('Adding graph to the VISTOMS instance (this might take a while)...') @@ -350,9 +358,7 @@ class VistomsMixin(object): :param order: list with the order in which the tools should be placed (only required if the FPG is not given) :type order: list, None :param reference_file: file from which reference values are extracted (either full path or file in same folder) - :type reference_file: file - :param xml_file: Name of the CMDOWS xml-file - :type xml_file: file + :type reference_file: str :return: dictionary entry with all graph data :rtype: dict """ @@ -365,9 +371,9 @@ class VistomsMixin(object): coordinator_str = self.COORDINATOR_STRING # Check graph name and description - if not 'name' in self.graph: + if 'name' not in self.graph: self.add_default_name() - if not 'description' in self.graph: + if 'description' not in self.graph: self.add_default_description() # Create graph_data dictionary entry and fill in initial attributes @@ -440,7 +446,8 @@ class VistomsMixin(object): graph_data_entry['variableSchemes']['catschema_roleLev'] = variable_tree_categorized_role_level # Function level sorting of the variables (function inputs, function outputs) - variable_tree_categorized_function_level = self._get_variable_tree_categorized_function_level(functions_data_list) + variable_tree_categorized_function_level = \ + self._get_variable_tree_categorized_function_level(functions_data_list) # Write dictionary entry graph_data_entry['variableSchemes']['catschema_funLev'] = variable_tree_categorized_function_level @@ -471,37 +478,37 @@ class VistomsMixin(object): # Check if the source is already in the dictionary (else add empty list) if edge[0] not in full_graph: # Add as output of coordinator (if node is a system input or of a certain circular variable category) - if (self.in_degree(edge[0]) == 0 and self.node[edge[0]]['category'] == 'variable') or \ - self.node[edge[0]]['subcategory'] in circular_coor_input_cats: + if (self.in_degree(edge[0]) == 0 and self.nodes[edge[0]]['category'] == 'variable') or \ + self.nodes[edge[0]]['subcategory'] in circular_coor_input_cats: full_graph[edge[0]] = [coordinator_str] full_graph['attributes']['tools'].append(coordinator_str) else: full_graph[edge[0]] = [] - if self.node[edge[0]]['category'] == 'function': + if self.nodes[edge[0]]['category'] == 'function': full_graph['attributes']['tools'].append(edge[0]) - elif self.node[edge[0]]['category'] == 'variable': + elif self.nodes[edge[0]]['category'] == 'variable': full_graph['attributes']['variables'].append(edge[0]) else: - raise NotImplementedError('Node category %s is not allowed.' % self.node[edge[0]]['category']) + raise NotImplementedError('Node category %s is not allowed.' % self.nodes[edge[0]]['category']) else: # Add as output of coordinator (if node is a system input or of a certain circular variable category) - if (self.in_degree(edge[0]) == 0 and self.node[edge[0]]['category'] == 'variable') or \ - self.node[edge[0]]['subcategory'] in circular_coor_input_cats: + if (self.in_degree(edge[0]) == 0 and self.nodes[edge[0]]['category'] == 'variable') or \ + self.nodes[edge[0]]['subcategory'] in circular_coor_input_cats: full_graph[edge[0]].append(coordinator_str) # Check if the target is already in the dictionary if edge[1] in full_graph: full_graph[edge[1]].append(edge[0]) else: full_graph[edge[1]] = [edge[0]] - if self.node[edge[1]]['category'] == 'function': + if self.nodes[edge[1]]['category'] == 'function': full_graph['attributes']['tools'].append(edge[1]) - elif self.node[edge[1]]['category'] == 'variable': + elif self.nodes[edge[1]]['category'] == 'variable': full_graph['attributes']['variables'].append(edge[1]) else: - raise NotImplementedError('Node category %s is not allow.' % self.node[edge[1]]['category']) + raise NotImplementedError('Node category %s is not allow.' % self.nodes[edge[1]]['category']) # Check if the target is a system output (according to indegree or circularity) - if (self.out_degree(edge[1]) == 0 and self.node[edge[1]]['category'] == 'variable') or \ - self.node[edge[1]]['subcategory'] in circular_coor_output_cats: + if (self.out_degree(edge[1]) == 0 and self.nodes[edge[1]]['category'] == 'variable') or \ + self.nodes[edge[1]]['subcategory'] in circular_coor_output_cats: if coordinator_str in full_graph: full_graph[coordinator_str].append(edge[1]) else: @@ -539,9 +546,9 @@ class VistomsMixin(object): # Create empty dictionary edge_bundles logger.debug('Creating edge_bundles_list and tools_data_list...') edge_bundles = dict(attributes=dict(tools=full_graph['attributes']['tools'], - variables=full_graph['attributes']['variables'])) + variables=full_graph['attributes']['variables'])) tools_data = dict(attributes=dict(tools=full_graph['attributes']['tools'], - variables=full_graph['attributes']['variables'])) + variables=full_graph['attributes']['variables'])) # Setting progress bar as this process takes some time n_keys = len(full_graph.keys()) @@ -557,7 +564,7 @@ class VistomsMixin(object): progress_bar.update(n_key) n_key += 1 if key is not 'attributes' and key is not coordinator_str: - if self.node[key]['category'] == 'variable': + if self.nodes[key]['category'] == 'variable': input_tools = full_graph[key] # Extend tools_data with tool outputs for input_tool in input_tools: @@ -593,8 +600,8 @@ class VistomsMixin(object): if input_tool not in edge_bundles[coordinator_str]['pipeline_data']: edge_bundles[coordinator_str]['pipeline_data'][input_tool] = [] edge_bundles[coordinator_str]['pipeline_data'][input_tool].append(key) - elif not self.node[key]['category'] == 'function': - raise NotImplementedError('Node category %s is not allowed.' % self.node[key]['category']) + elif not self.nodes[key]['category'] == 'function': + raise NotImplementedError('Node category %s is not allowed.' % self.nodes[key]['category']) if key is not 'attributes': if key is coordinator_str: if key not in tools_data: @@ -602,7 +609,7 @@ class VistomsMixin(object): output=[]) else: tools_data[key]['input'] = full_graph[key] - elif self.node[key]['category'] == 'function': + elif self.nodes[key]['category'] == 'function': if key not in tools_data: tools_data[key] = dict(name=key, input=full_graph[key], output=[]) @@ -664,9 +671,9 @@ class VistomsMixin(object): # Add diagonal nodes for block in order: if block is not coordinator_str: - if self.node[block]['category'] == 'function': - if 'architecture_role' in self.node[block]: - arch_role = self.node[block]['architecture_role'] + if self.nodes[block]['category'] == 'function': + if 'architecture_role' in self.nodes[block]: + arch_role = self.nodes[block]['architecture_role'] if arch_role == self.ARCHITECTURE_ROLES_FUNS[0]: # coordinator block_type = 'coordinator' elif arch_role == self.ARCHITECTURE_ROLES_FUNS[1]: # optimizer @@ -695,18 +702,18 @@ class VistomsMixin(object): block_type = 'surrogatemodel' else: raise NotImplementedError('Architecture role %s not implemented.' % arch_role) - elif 'problem_role' in self.node[block]: - if self.node[block]['problem_role'] == self.FUNCTION_ROLES[0]: # pre-coupling + elif 'problem_role' in self.nodes[block]: + if self.nodes[block]['problem_role'] == self.FUNCTION_ROLES[0]: # pre-coupling block_type = 'precouplinganalysis' - elif self.node[block]['problem_role'] == self.FUNCTION_ROLES[1]: # coupled + elif self.nodes[block]['problem_role'] == self.FUNCTION_ROLES[1]: # coupled block_type = 'coupledanalysis' - elif self.node[block]['problem_role'] == self.FUNCTION_ROLES[2]: # post-coupling + elif self.nodes[block]['problem_role'] == self.FUNCTION_ROLES[2]: # post-coupling block_type = 'postcouplinganalysis' else: block_type = 'rcganalysis' block_metadata = self.get_function_metadata(block) else: - raise Exception('Block category %s not supported.' % self.node[block]['category']) + raise Exception('Block category %s not supported.' % self.nodes[block]['category']) else: block_type = 'coordinator' block_metadata = [{'name': 'Coordinator'}, @@ -779,12 +786,12 @@ class VistomsMixin(object): reference_valid = recursively_unique_attribute(reference_xml) for key in full_graph: if key is not 'attributes' and key is not coordinator_str: - if self.node[key]['category'] == 'variable': + if self.nodes[key]['category'] == 'variable': # Determine element element value and dimension based on reference file if reference_file: # Check if the variable node is actually a related node - if 'related_to_schema_node' in self.node[key]: - xpath = self.node[key]['related_to_schema_node'] + if 'related_to_schema_node' in self.nodes[key]: + xpath = self.nodes[key]['related_to_schema_node'] else: xpath = key # Get element details @@ -815,7 +822,7 @@ class VistomsMixin(object): variable_tree_categorized_system_level = dict() for key in full_graph: if key is not 'attributes' and key is not coordinator_str: - if self.node[key]['category'] == 'variable': + if self.nodes[key]['category'] == 'variable': in_degree = self.in_degree(key) out_degree = self.out_degree(key) if in_degree == 0 and out_degree > 0: @@ -847,8 +854,8 @@ class VistomsMixin(object): variable_tree_categorized_node_level = dict() for key in full_graph: if key is not 'attributes' and key is not coordinator_str: - if self.node[key]['category'] == 'variable': - subcategory = self.node[key]['subcategory'] + if self.nodes[key]['category'] == 'variable': + subcategory = self.nodes[key]['subcategory'] key = '/variables/' + make_camel_case(subcategory) + key var_dict = get_element_dict(key) variable_tree_categorized_node_level = merge(variable_tree_categorized_node_level, var_dict) @@ -878,14 +885,14 @@ class VistomsMixin(object): variable_tree_categorized_role_level = merge(variable_tree_categorized_role_level, var_dict) for key in full_graph: if key is not 'attributes' and key is not coordinator_str: - if self.node[key]['category'] == 'variable': - if 'problem_role' in self.node[key]: - prob_role = self.node[key]['problem_role'] + if self.nodes[key]['category'] == 'variable': + if 'problem_role' in self.nodes[key]: + prob_role = self.nodes[key]['problem_role'] new_key = '/variables/problemRoles/' + make_camel_case(prob_role) + 's' + key var_dict = get_element_dict(new_key) variable_tree_categorized_role_level = merge(variable_tree_categorized_role_level, var_dict) - if 'architecture_role' in self.node[key]: - arch_role = self.node[key]['architecture_role'] + if 'architecture_role' in self.nodes[key]: + arch_role = self.nodes[key]['architecture_role'] new_key = '/variables/architectureRoles/' + make_camel_case(arch_role) + 's' + key var_dict = get_element_dict(new_key) variable_tree_categorized_role_level = merge(variable_tree_categorized_role_level, var_dict) diff --git a/kadmos/utilities/printing.py b/kadmos/utilities/printing.py index e98fa21cd4efb34522c86f1d9d789f90ef699443..213d207a73625b9fea3dcc326572c8977279d4b4 100644 --- a/kadmos/utilities/printing.py +++ b/kadmos/utilities/printing.py @@ -42,7 +42,7 @@ def print_in_table(print_container, **kwargs): :param print_container: container for iterables --> [[row1], [row2], ...] :type print_container: iterable :param kwargs: keyword arguments for printing - :type kwargs: str + :type kwargs: str, bool Kwargs options: diff --git a/requirements.txt b/requirements.txt index 41f76cfe7229684681b56e1bd308c99806d1f28d..c25dc98c80b4583cb130cd90178d26fae6ac1d1b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -7,4 +7,5 @@ matlab networkx>=2.0 numpy progressbar2 -deap \ No newline at end of file +deap +Flask \ No newline at end of file diff --git a/setup.py b/setup.py index 419efcf2842f7bbe26a558c7cd2ef55a1d5d579b..567fb411c0dfca053a0c7b3c804884d396a05a79 100644 --- a/setup.py +++ b/setup.py @@ -37,7 +37,8 @@ setup(name='kadmos', 'networkx>=2.0', 'numpy', 'progressbar2', - 'deap' + 'deap', + 'Flask' ], include_package_data=True, zip_safe=False)