Files
ortools-clone/docs/cpp_graph/classoperations__research_1_1PriorityQueueWithRestrictedPush.html
2019-06-29 18:18:08 +02:00

232 lines
14 KiB
HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>OR-Tools</title>
<meta http-equiv="Content-Type" content="text/html;"/>
<meta charset="utf-8"/>
<!--<link rel='stylesheet' type='text/css' href="https://fonts.googleapis.com/css?family=Ubuntu:400,700,400italic"/>-->
<link rel="stylesheet" type="text/css" href="ortools.css" title="default" media="screen,print" />
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
</head>
<body>
<div id="banner-container">
<div id="banner">
<span id="sfml">OR-Tools 7.2</span>
</div>
</div>
<link rel="icon" href="https://developers.google.com/optimization/images/orLogo.png">
<div id="content">
<!-- Generated by Doxygen 1.8.15 -->
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main&#160;Page</span></a></li>
<li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li class="current"><a href="annotated.html"><span>Classes</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="annotated.html"><span>Class&#160;List</span></a></li>
<li><a href="classes.html"><span>Class&#160;Index</span></a></li>
<li><a href="inherits.html"><span>Class&#160;Hierarchy</span></a></li>
<li><a href="functions.html"><span>Class&#160;Members</span></a></li>
</ul>
</div>
<div id="nav-path" class="navpath">
<ul>
<li class="navelem"><a class="el" href="namespaceoperations__research.html">operations_research</a></li><li class="navelem"><a class="el" href="classoperations__research_1_1PriorityQueueWithRestrictedPush.html">PriorityQueueWithRestrictedPush</a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="summary">
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="classoperations__research_1_1PriorityQueueWithRestrictedPush-members.html">List of all members</a> </div>
<div class="headertitle">
<div class="title">operations_research::PriorityQueueWithRestrictedPush&lt; Element, IntegerPriority &gt; Class Template Reference</div> </div>
</div><!--header-->
<div class="contents">
<p>Specific but efficient priority queue implementation.
<a href="classoperations__research_1_1PriorityQueueWithRestrictedPush.html#details">More...</a></p>
<p><code>#include &lt;<a class="el" href="max__flow_8h_source.html">max_flow.h</a>&gt;</code></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:ab5a37cc35af8067c734810424d4f395d"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classoperations__research_1_1PriorityQueueWithRestrictedPush.html#ab5a37cc35af8067c734810424d4f395d">PriorityQueueWithRestrictedPush</a> ()</td></tr>
<tr class="separator:ab5a37cc35af8067c734810424d4f395d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a0fa26c84168a6d71010556b0d6541a1f"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classoperations__research_1_1PriorityQueueWithRestrictedPush.html#a0fa26c84168a6d71010556b0d6541a1f">IsEmpty</a> () const</td></tr>
<tr class="memdesc:a0fa26c84168a6d71010556b0d6541a1f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Is the queue empty? <a href="#a0fa26c84168a6d71010556b0d6541a1f">More...</a><br /></td></tr>
<tr class="separator:a0fa26c84168a6d71010556b0d6541a1f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ad5d7012545c74d85dd938ea6bf9e9537"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classoperations__research_1_1PriorityQueueWithRestrictedPush.html#ad5d7012545c74d85dd938ea6bf9e9537">Clear</a> ()</td></tr>
<tr class="memdesc:ad5d7012545c74d85dd938ea6bf9e9537"><td class="mdescLeft">&#160;</td><td class="mdescRight">Clears the queue. <a href="#ad5d7012545c74d85dd938ea6bf9e9537">More...</a><br /></td></tr>
<tr class="separator:ad5d7012545c74d85dd938ea6bf9e9537"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a2662f061f688af21e19f3ac53027ed4b"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classoperations__research_1_1PriorityQueueWithRestrictedPush.html#a2662f061f688af21e19f3ac53027ed4b">Push</a> (Element element, IntegerPriority priority)</td></tr>
<tr class="memdesc:a2662f061f688af21e19f3ac53027ed4b"><td class="mdescLeft">&#160;</td><td class="mdescRight">Push a new element in the queue. <a href="#a2662f061f688af21e19f3ac53027ed4b">More...</a><br /></td></tr>
<tr class="separator:a2662f061f688af21e19f3ac53027ed4b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a9597013d76010425ffc592a32ff4f259"><td class="memItemLeft" align="right" valign="top">Element&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classoperations__research_1_1PriorityQueueWithRestrictedPush.html#a9597013d76010425ffc592a32ff4f259">Pop</a> ()</td></tr>
<tr class="memdesc:a9597013d76010425ffc592a32ff4f259"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the element with highest priority and remove it from the queue. <a href="#a9597013d76010425ffc592a32ff4f259">More...</a><br /></td></tr>
<tr class="separator:a9597013d76010425ffc592a32ff4f259"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><h3>template&lt;typename Element, typename IntegerPriority&gt;<br />
class operations_research::PriorityQueueWithRestrictedPush&lt; Element, IntegerPriority &gt;</h3>
<p>Specific but efficient priority queue implementation. </p>
<p>The priority type must be an integer. The queue allows to retrieve the element with highest priority but only allows pushes with a priority greater or equal to the highest priority in the queue minus one. All operations are in O(1) and the memory is in O(num elements in the queue). Elements with the same priority are retrieved with LIFO order.</p>
<p>Note(user): As far as I know, this is an original idea and is the only code that use this in the Maximum Flow context. Papers usually refer to an height-indexed array of simple linked lists of active node with the same height. Even worse, sometimes they use double-linked list to allow arbitrary height update in order to detect missing height (used for the Gap heuristic). But this can actually be implemented a lot more efficiently by just maintaining the height distribution of all the node in the graph. </p>
<p class="definition">Definition at line <a class="el" href="max__flow_8h_source.html#l00264">264</a> of file <a class="el" href="max__flow_8h_source.html">max_flow.h</a>.</p>
</div><h2 class="groupheader">Constructor &amp; Destructor Documentation</h2>
<a id="ab5a37cc35af8067c734810424d4f395d"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ab5a37cc35af8067c734810424d4f395d">&#9670;&nbsp;</a></span>PriorityQueueWithRestrictedPush()</h2>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename Element, typename IntegerPriority&gt; </div>
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="classoperations__research_1_1PriorityQueueWithRestrictedPush.html">operations_research::PriorityQueueWithRestrictedPush</a>&lt; Element, IntegerPriority &gt;::<a class="el" href="classoperations__research_1_1PriorityQueueWithRestrictedPush.html">PriorityQueueWithRestrictedPush</a> </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p class="definition">Definition at line <a class="el" href="max__flow_8h_source.html#l00266">266</a> of file <a class="el" href="max__flow_8h_source.html">max_flow.h</a>.</p>
</div>
</div>
<h2 class="groupheader">Member Function Documentation</h2>
<a id="ad5d7012545c74d85dd938ea6bf9e9537"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ad5d7012545c74d85dd938ea6bf9e9537">&#9670;&nbsp;</a></span>Clear()</h2>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename Element , typename IntegerPriority &gt; </div>
<table class="memname">
<tr>
<td class="memname">void <a class="el" href="classoperations__research_1_1PriorityQueueWithRestrictedPush.html">operations_research::PriorityQueueWithRestrictedPush</a>&lt; Element, IntegerPriority &gt;::Clear </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Clears the queue. </p>
<p class="definition">Definition at line <a class="el" href="max__flow_8h_source.html#l00667">667</a> of file <a class="el" href="max__flow_8h_source.html">max_flow.h</a>.</p>
</div>
</div>
<a id="a0fa26c84168a6d71010556b0d6541a1f"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a0fa26c84168a6d71010556b0d6541a1f">&#9670;&nbsp;</a></span>IsEmpty()</h2>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename Element , typename IntegerPriority &gt; </div>
<table class="memname">
<tr>
<td class="memname">bool <a class="el" href="classoperations__research_1_1PriorityQueueWithRestrictedPush.html">operations_research::PriorityQueueWithRestrictedPush</a>&lt; Element, IntegerPriority &gt;::IsEmpty </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td> const</td>
</tr>
</table>
</div><div class="memdoc">
<p>Is the queue empty? </p>
<p class="definition">Definition at line <a class="el" href="max__flow_8h_source.html#l00661">661</a> of file <a class="el" href="max__flow_8h_source.html">max_flow.h</a>.</p>
</div>
</div>
<a id="a9597013d76010425ffc592a32ff4f259"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a9597013d76010425ffc592a32ff4f259">&#9670;&nbsp;</a></span>Pop()</h2>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename Element , typename IntegerPriority &gt; </div>
<table class="memname">
<tr>
<td class="memname">Element <a class="el" href="classoperations__research_1_1PriorityQueueWithRestrictedPush.html">operations_research::PriorityQueueWithRestrictedPush</a>&lt; Element, IntegerPriority &gt;::Pop </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Returns the element with highest priority and remove it from the queue. </p>
<p><a class="el" href="classoperations__research_1_1PriorityQueueWithRestrictedPush.html#a0fa26c84168a6d71010556b0d6541a1f" title="Is the queue empty?">IsEmpty()</a> must be false, this condition is DCHECKed. </p>
<p class="definition">Definition at line <a class="el" href="max__flow_8h_source.html#l00692">692</a> of file <a class="el" href="max__flow_8h_source.html">max_flow.h</a>.</p>
</div>
</div>
<a id="a2662f061f688af21e19f3ac53027ed4b"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a2662f061f688af21e19f3ac53027ed4b">&#9670;&nbsp;</a></span>Push()</h2>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename Element, typename IntegerPriority&gt; </div>
<table class="memname">
<tr>
<td class="memname">void <a class="el" href="classoperations__research_1_1PriorityQueueWithRestrictedPush.html">operations_research::PriorityQueueWithRestrictedPush</a>&lt; Element, IntegerPriority &gt;::Push </td>
<td>(</td>
<td class="paramtype">Element&#160;</td>
<td class="paramname"><em>element</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">IntegerPriority&#160;</td>
<td class="paramname"><em>priority</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Push a new element in the queue. </p>
<p>Its priority must be greater or equal to the highest priority present in the queue, minus one. This condition is DCHECKed, and violating it yields erroneous queue behavior in NDEBUG mode. </p>
<p>Since users may rely on it, we DCHECK the exact condition.</p>
<dl class="section note"><dt>Note</dt><dd>the DCHECK() below are less restrictive than the ones above but check a necessary and sufficient condition for the priority queue to behave as expected. </dd></dl>
<p class="definition">Definition at line <a class="el" href="max__flow_8h_source.html#l00673">673</a> of file <a class="el" href="max__flow_8h_source.html">max_flow.h</a>.</p>
</div>
</div>
<hr/>The documentation for this class was generated from the following file:<ul>
<li><a class="el" href="max__flow_8h_source.html">max_flow.h</a></li>
</ul>
</div><!-- contents -->
</div>
<div id="footer-container">
<div id="footer">
</div>
</div>
</body>
</html>