884 lines
53 KiB
HTML
884 lines
53 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">Google OR-Tools 7.5</span>
|
|
</div>
|
|
</div>
|
|
<div id="content" style="width: 100%; overflow: hidden;">
|
|
<div style="margin-left: 15px; margin-top: 5px; float: left; color: #145A32;">
|
|
<h2>C++ Reference</h2>
|
|
<ul>
|
|
<li><a href="../cpp_algorithms/annotated.html">Algorithms</a></li>
|
|
<li><a href="../cpp_sat/annotated.html">CP-SAT</a></li>
|
|
<li><a href="../cpp_graph/annotated.html">Graph</a></li>
|
|
<li><a href="../cpp_routing/annotated.html">Routing</a></li>
|
|
<li><a href="../cpp_linear/annotated.html">Linear solver</a></li>
|
|
</ul>
|
|
</div>
|
|
<div id="content">
|
|
<div align="center">
|
|
<h1 style="color: #145A32;">C++ Reference: CP-SAT</h1>
|
|
</div>
|
|
<!-- Generated by Doxygen 1.8.18 -->
|
|
<div id="navrow1" class="tabs">
|
|
<ul class="tablist">
|
|
<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="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_1TimeLimit.html">TimeLimit</a></li> </ul>
|
|
</div>
|
|
</div><!-- top -->
|
|
<div class="header">
|
|
<div class="summary">
|
|
<a href="#pub-methods">Public Member Functions</a> |
|
|
<a href="#pub-static-methods">Static Public Member Functions</a> |
|
|
<a href="#pub-static-attribs">Static Public Attributes</a> |
|
|
<a href="classoperations__research_1_1TimeLimit-members.html">List of all members</a> </div>
|
|
<div class="headertitle">
|
|
<div class="title">TimeLimit</div> </div>
|
|
</div><!--header-->
|
|
<div class="contents">
|
|
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
|
|
<div class="textblock"><p>A simple class to enforce both an elapsed time limit and a deterministic time limit in the same thread as a program. </p>
|
|
<p>The idea is to call <a class="el" href="classoperations__research_1_1TimeLimit.html#a810d5f7aaf80cc09cf5a094e20c1aaca" title="Returns true when the external limit is true, or the deterministic time is over the deterministic lim...">LimitReached()</a> as often as possible, until it returns false. The program should then abort as fast as possible.</p>
|
|
<p>The deterministic limit is used to ensure reproductibility. As a consequence the deterministic time has to be advanced manually using the method <a class="el" href="classoperations__research_1_1TimeLimit.html#af90cfd1fc238433fc303ee28c5914eb9" title="Advances the deterministic time.">AdvanceDeterministicTime()</a>.</p>
|
|
<p>The instruction counter keeps track of number of executed cpu instructions. It uses Performance Monitoring Unit (PMU) counters to keep track of instruction count.</p>
|
|
<p>The call itself is as fast as CycleClock::Now() + a few trivial instructions, unless the time_limit_use_instruction_count flag is set.</p>
|
|
<p>The limit is very conservative: it returns true (i.e. the limit is reached) when current_time + max(T, ε) >= limit_time, where ε is a small constant (see <a class="el" href="classoperations__research_1_1TimeLimit.html#a1837453fa693143e6ec334701557a448">TimeLimit::kSafetyBufferSeconds</a>), and T is the maximum measured time interval between two consecutive calls to <a class="el" href="classoperations__research_1_1TimeLimit.html#a810d5f7aaf80cc09cf5a094e20c1aaca" title="Returns true when the external limit is true, or the deterministic time is over the deterministic lim...">LimitReached()</a> over the last kHistorySize calls (so that we only consider "recent" history). This is made so that the probability of actually exceeding the time limit is small, without aborting too early.</p>
|
|
<p>The deterministic time limit can be logged at a more granular level: the method <a class="el" href="classoperations__research_1_1TimeLimit.html#af90cfd1fc238433fc303ee28c5914eb9" title="Advances the deterministic time.">TimeLimit::AdvanceDeterministicTime</a> takes an optional string argument: the name of a counter. In debug mode, the time limit object computes also the elapsed time for each named counter separately, and these values can be used to determine the coefficients for computing the deterministic duration from the number of operations. The values of the counters can be printed using <a class="el" href="classoperations__research_1_1TimeLimit.html#a764be64f3029f8b8e23511061d8de355" title="Returns information about the time limit object in a human-readable form.">TimeLimit::DebugString()</a>. There is no API to access the values of the counters directly, because they do not exist in optimized mode.</p>
|
|
<p>The basic steps for determining coefficients for the deterministic time are:</p><ol type="1">
|
|
<li>Run the code in debug mode to collect the values of the deterministic time counters. Unless the algorithm is different in optimized mode, the values of the deterministic counters in debug mode will be the same as in optimized mode.</li>
|
|
<li>Run the code in optimized mode to measure the real (CPU) time of the whole benchmark.</li>
|
|
<li>Determine the coefficients for deterministic time from the real time and the values of the deterministic counters, e. g. by solving the equations C_1*c_1 + C_2*c_2 + ... + C_N*c_N + Err = T where C_1 is the unknown coefficient for counter c_1, Err is the random measurement error and T is the measured real time. The equation can be solved e.g. using the least squares method.</li>
|
|
</ol>
|
|
<p>Note that in optimized mode, the counters are disabled for performance reasons, and calling AdvanceDeterministicTime(duration, counter_name) is equivalent to calling AdvanceDeterministicTime(duration). </p>
|
|
|
|
<p class="definition">Definition at line <a class="el" href="time__limit_8h_source.html#l00105">105</a> of file <a class="el" href="time__limit_8h_source.html">time_limit.h</a>.</p>
|
|
</div><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:aa0975c0aa18ee607a54e7c4c8986ff0f"><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classoperations__research_1_1TimeLimit.html#aa0975c0aa18ee607a54e7c4c8986ff0f">TimeLimit</a> (double limit_in_seconds, double deterministic_limit=std::numeric_limits< double >::infinity(), double instruction_limit=std::numeric_limits< double >::infinity())</td></tr>
|
|
<tr class="memdesc:aa0975c0aa18ee607a54e7c4c8986ff0f"><td class="mdescLeft"> </td><td class="mdescRight">Sets the elapsed, the deterministic time and the instruction count limits. <a href="classoperations__research_1_1TimeLimit.html#aa0975c0aa18ee607a54e7c4c8986ff0f">More...</a><br /></td></tr>
|
|
<tr class="separator:aa0975c0aa18ee607a54e7c4c8986ff0f"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:a0598aaf87dab140f870c8ada2a1f3a39"><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classoperations__research_1_1TimeLimit.html#a0598aaf87dab140f870c8ada2a1f3a39">TimeLimit</a> ()</td></tr>
|
|
<tr class="separator:a0598aaf87dab140f870c8ada2a1f3a39"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:ac056854a98f4094ef4c8d3858b955fef"><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classoperations__research_1_1TimeLimit.html#ac056854a98f4094ef4c8d3858b955fef">TimeLimit</a> (const <a class="el" href="classoperations__research_1_1TimeLimit.html">TimeLimit</a> &)=delete</td></tr>
|
|
<tr class="separator:ac056854a98f4094ef4c8d3858b955fef"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:a9d28f062361ac553f8bc1da250b205bd"><td class="memItemLeft" align="right" valign="top"><a class="el" href="classoperations__research_1_1TimeLimit.html">TimeLimit</a> & </td><td class="memItemRight" valign="bottom"><a class="el" href="classoperations__research_1_1TimeLimit.html#a9d28f062361ac553f8bc1da250b205bd">operator=</a> (const <a class="el" href="classoperations__research_1_1TimeLimit.html">TimeLimit</a> &)=delete</td></tr>
|
|
<tr class="separator:a9d28f062361ac553f8bc1da250b205bd"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:a43229b9a540c5b4c3751ebb13e73ace8"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classoperations__research_1_1TimeLimit.html#a43229b9a540c5b4c3751ebb13e73ace8">SetInstructionLimit</a> (double instruction_limit)</td></tr>
|
|
<tr class="memdesc:a43229b9a540c5b4c3751ebb13e73ace8"><td class="mdescLeft"> </td><td class="mdescRight">Sets the instruction limit. <a href="classoperations__research_1_1TimeLimit.html#a43229b9a540c5b4c3751ebb13e73ace8">More...</a><br /></td></tr>
|
|
<tr class="separator:a43229b9a540c5b4c3751ebb13e73ace8"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:a4cb3517d59bf4642a85294267736af20"><td class="memItemLeft" align="right" valign="top">double </td><td class="memItemRight" valign="bottom"><a class="el" href="classoperations__research_1_1TimeLimit.html#a4cb3517d59bf4642a85294267736af20">ReadInstructionCounter</a> ()</td></tr>
|
|
<tr class="memdesc:a4cb3517d59bf4642a85294267736af20"><td class="mdescLeft"> </td><td class="mdescRight">Returns the number of instructions executed since the creation of this object. <a href="classoperations__research_1_1TimeLimit.html#a4cb3517d59bf4642a85294267736af20">More...</a><br /></td></tr>
|
|
<tr class="separator:a4cb3517d59bf4642a85294267736af20"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:a810d5f7aaf80cc09cf5a094e20c1aaca"><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="classoperations__research_1_1TimeLimit.html#a810d5f7aaf80cc09cf5a094e20c1aaca">LimitReached</a> ()</td></tr>
|
|
<tr class="memdesc:a810d5f7aaf80cc09cf5a094e20c1aaca"><td class="mdescLeft"> </td><td class="mdescRight">Returns true when the external limit is true, or the deterministic time is over the deterministic limit or if the next time <code><a class="el" href="classoperations__research_1_1TimeLimit.html#a810d5f7aaf80cc09cf5a094e20c1aaca" title="Returns true when the external limit is true, or the deterministic time is over the deterministic lim...">LimitReached()</a></code> is called is likely to be over the time limit. <a href="classoperations__research_1_1TimeLimit.html#a810d5f7aaf80cc09cf5a094e20c1aaca">More...</a><br /></td></tr>
|
|
<tr class="separator:a810d5f7aaf80cc09cf5a094e20c1aaca"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:a4273b83b06bfbf856393db6d0a9b8715"><td class="memItemLeft" align="right" valign="top">double </td><td class="memItemRight" valign="bottom"><a class="el" href="classoperations__research_1_1TimeLimit.html#a4273b83b06bfbf856393db6d0a9b8715">GetTimeLeft</a> () const</td></tr>
|
|
<tr class="memdesc:a4273b83b06bfbf856393db6d0a9b8715"><td class="mdescLeft"> </td><td class="mdescRight">Returns the time left on this limit, or 0 if the limit was reached (it never returns a negative value). <a href="classoperations__research_1_1TimeLimit.html#a4273b83b06bfbf856393db6d0a9b8715">More...</a><br /></td></tr>
|
|
<tr class="separator:a4273b83b06bfbf856393db6d0a9b8715"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:a362a88bfe50d83c028154a62ef53e780"><td class="memItemLeft" align="right" valign="top">double </td><td class="memItemRight" valign="bottom"><a class="el" href="classoperations__research_1_1TimeLimit.html#a362a88bfe50d83c028154a62ef53e780">GetDeterministicTimeLeft</a> () const</td></tr>
|
|
<tr class="memdesc:a362a88bfe50d83c028154a62ef53e780"><td class="mdescLeft"> </td><td class="mdescRight">Returns the remaining deterministic time before <code><a class="el" href="classoperations__research_1_1TimeLimit.html#a810d5f7aaf80cc09cf5a094e20c1aaca" title="Returns true when the external limit is true, or the deterministic time is over the deterministic lim...">LimitReached()</a></code> returns true due to the deterministic limit. <a href="classoperations__research_1_1TimeLimit.html#a362a88bfe50d83c028154a62ef53e780">More...</a><br /></td></tr>
|
|
<tr class="separator:a362a88bfe50d83c028154a62ef53e780"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:a0be73bea3d751ca2926c1cd616abb31e"><td class="memItemLeft" align="right" valign="top">double </td><td class="memItemRight" valign="bottom"><a class="el" href="classoperations__research_1_1TimeLimit.html#a0be73bea3d751ca2926c1cd616abb31e">GetInstructionsLeft</a> ()</td></tr>
|
|
<tr class="memdesc:a0be73bea3d751ca2926c1cd616abb31e"><td class="mdescLeft"> </td><td class="mdescRight">Returns the number of instructions left to reach the limit. <a href="classoperations__research_1_1TimeLimit.html#a0be73bea3d751ca2926c1cd616abb31e">More...</a><br /></td></tr>
|
|
<tr class="separator:a0be73bea3d751ca2926c1cd616abb31e"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:af90cfd1fc238433fc303ee28c5914eb9"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classoperations__research_1_1TimeLimit.html#af90cfd1fc238433fc303ee28c5914eb9">AdvanceDeterministicTime</a> (double deterministic_duration)</td></tr>
|
|
<tr class="memdesc:af90cfd1fc238433fc303ee28c5914eb9"><td class="mdescLeft"> </td><td class="mdescRight">Advances the deterministic time. <a href="classoperations__research_1_1TimeLimit.html#af90cfd1fc238433fc303ee28c5914eb9">More...</a><br /></td></tr>
|
|
<tr class="separator:af90cfd1fc238433fc303ee28c5914eb9"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:ad068edb54c705c548c20e4ba47b4e3a8"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classoperations__research_1_1TimeLimit.html#ad068edb54c705c548c20e4ba47b4e3a8">AdvanceDeterministicTime</a> (double deterministic_duration, const char *counter_name)</td></tr>
|
|
<tr class="memdesc:ad068edb54c705c548c20e4ba47b4e3a8"><td class="mdescLeft"> </td><td class="mdescRight">Advances the deterministic time. <a href="classoperations__research_1_1TimeLimit.html#ad068edb54c705c548c20e4ba47b4e3a8">More...</a><br /></td></tr>
|
|
<tr class="separator:ad068edb54c705c548c20e4ba47b4e3a8"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:ae3fe2e2b613455b49c6cc74dd3c7581e"><td class="memItemLeft" align="right" valign="top">double </td><td class="memItemRight" valign="bottom"><a class="el" href="classoperations__research_1_1TimeLimit.html#ae3fe2e2b613455b49c6cc74dd3c7581e">GetElapsedTime</a> () const</td></tr>
|
|
<tr class="memdesc:ae3fe2e2b613455b49c6cc74dd3c7581e"><td class="mdescLeft"> </td><td class="mdescRight">Returns the time elapsed in seconds since the construction of this object. <a href="classoperations__research_1_1TimeLimit.html#ae3fe2e2b613455b49c6cc74dd3c7581e">More...</a><br /></td></tr>
|
|
<tr class="separator:ae3fe2e2b613455b49c6cc74dd3c7581e"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:ac7e861414a70fc937d18bc7ca743fc98"><td class="memItemLeft" align="right" valign="top">double </td><td class="memItemRight" valign="bottom"><a class="el" href="classoperations__research_1_1TimeLimit.html#ac7e861414a70fc937d18bc7ca743fc98">GetElapsedDeterministicTime</a> () const</td></tr>
|
|
<tr class="memdesc:ac7e861414a70fc937d18bc7ca743fc98"><td class="mdescLeft"> </td><td class="mdescRight">Returns the elapsed deterministic time since the construction of this object. <a href="classoperations__research_1_1TimeLimit.html#ac7e861414a70fc937d18bc7ca743fc98">More...</a><br /></td></tr>
|
|
<tr class="separator:ac7e861414a70fc937d18bc7ca743fc98"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:a5b6cf15a55615535aa54e71103de8d9f"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classoperations__research_1_1TimeLimit.html#a5b6cf15a55615535aa54e71103de8d9f">RegisterExternalBooleanAsLimit</a> (std::atomic< bool > *external_boolean_as_limit)</td></tr>
|
|
<tr class="memdesc:a5b6cf15a55615535aa54e71103de8d9f"><td class="mdescLeft"> </td><td class="mdescRight">Registers the external Boolean to check when <a class="el" href="classoperations__research_1_1TimeLimit.html#a810d5f7aaf80cc09cf5a094e20c1aaca" title="Returns true when the external limit is true, or the deterministic time is over the deterministic lim...">LimitReached()</a> is called. <a href="classoperations__research_1_1TimeLimit.html#a5b6cf15a55615535aa54e71103de8d9f">More...</a><br /></td></tr>
|
|
<tr class="separator:a5b6cf15a55615535aa54e71103de8d9f"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:a30ac580cb264bf8e92696890f212727e"><td class="memItemLeft" align="right" valign="top">std::atomic< bool > * </td><td class="memItemRight" valign="bottom"><a class="el" href="classoperations__research_1_1TimeLimit.html#a30ac580cb264bf8e92696890f212727e">ExternalBooleanAsLimit</a> () const</td></tr>
|
|
<tr class="memdesc:a30ac580cb264bf8e92696890f212727e"><td class="mdescLeft"> </td><td class="mdescRight">Returns the current external Boolean limit. <a href="classoperations__research_1_1TimeLimit.html#a30ac580cb264bf8e92696890f212727e">More...</a><br /></td></tr>
|
|
<tr class="separator:a30ac580cb264bf8e92696890f212727e"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:a312550ebabce586fb77c49e813c610f8"><td class="memTemplParams" colspan="2">template<typename Parameters > </td></tr>
|
|
<tr class="memitem:a312550ebabce586fb77c49e813c610f8"><td class="memTemplItemLeft" align="right" valign="top">void </td><td class="memTemplItemRight" valign="bottom"><a class="el" href="classoperations__research_1_1TimeLimit.html#a312550ebabce586fb77c49e813c610f8">ResetLimitFromParameters</a> (const Parameters &parameters)</td></tr>
|
|
<tr class="memdesc:a312550ebabce586fb77c49e813c610f8"><td class="mdescLeft"> </td><td class="mdescRight">Sets new time limits. <a href="classoperations__research_1_1TimeLimit.html#a312550ebabce586fb77c49e813c610f8">More...</a><br /></td></tr>
|
|
<tr class="separator:a312550ebabce586fb77c49e813c610f8"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:ad0cdf04d71ac4f14262eb4871041ddbd"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classoperations__research_1_1TimeLimit.html#ad0cdf04d71ac4f14262eb4871041ddbd">MergeWithGlobalTimeLimit</a> (<a class="el" href="classoperations__research_1_1TimeLimit.html">TimeLimit</a> *other)</td></tr>
|
|
<tr class="separator:ad0cdf04d71ac4f14262eb4871041ddbd"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:a764be64f3029f8b8e23511061d8de355"><td class="memItemLeft" align="right" valign="top">std::string </td><td class="memItemRight" valign="bottom"><a class="el" href="classoperations__research_1_1TimeLimit.html#a764be64f3029f8b8e23511061d8de355">DebugString</a> () const</td></tr>
|
|
<tr class="memdesc:a764be64f3029f8b8e23511061d8de355"><td class="mdescLeft"> </td><td class="mdescRight">Returns information about the time limit object in a human-readable form. <a href="classoperations__research_1_1TimeLimit.html#a764be64f3029f8b8e23511061d8de355">More...</a><br /></td></tr>
|
|
<tr class="separator:a764be64f3029f8b8e23511061d8de355"><td class="memSeparator" colspan="2"> </td></tr>
|
|
</table><table class="memberdecls">
|
|
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-static-methods"></a>
|
|
Static Public Member Functions</h2></td></tr>
|
|
<tr class="memitem:a517ffd071860d7efd76134e25f6f03e1"><td class="memItemLeft" align="right" valign="top">static std::unique_ptr< <a class="el" href="classoperations__research_1_1TimeLimit.html">TimeLimit</a> > </td><td class="memItemRight" valign="bottom"><a class="el" href="classoperations__research_1_1TimeLimit.html#a517ffd071860d7efd76134e25f6f03e1">Infinite</a> ()</td></tr>
|
|
<tr class="memdesc:a517ffd071860d7efd76134e25f6f03e1"><td class="mdescLeft"> </td><td class="mdescRight">Creates a time limit object that uses infinite time for wall time, deterministic time and instruction count limit. <a href="classoperations__research_1_1TimeLimit.html#a517ffd071860d7efd76134e25f6f03e1">More...</a><br /></td></tr>
|
|
<tr class="separator:a517ffd071860d7efd76134e25f6f03e1"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:a640ae7a07a6de8fe45a5526326f3b028"><td class="memItemLeft" align="right" valign="top">static std::unique_ptr< <a class="el" href="classoperations__research_1_1TimeLimit.html">TimeLimit</a> > </td><td class="memItemRight" valign="bottom"><a class="el" href="classoperations__research_1_1TimeLimit.html#a640ae7a07a6de8fe45a5526326f3b028">FromDeterministicTime</a> (double deterministic_limit)</td></tr>
|
|
<tr class="memdesc:a640ae7a07a6de8fe45a5526326f3b028"><td class="mdescLeft"> </td><td class="mdescRight">Creates a time limit object that puts limit only on the deterministic time. <a href="classoperations__research_1_1TimeLimit.html#a640ae7a07a6de8fe45a5526326f3b028">More...</a><br /></td></tr>
|
|
<tr class="separator:a640ae7a07a6de8fe45a5526326f3b028"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:a96f95e438ca7940b115c838c96c06d87"><td class="memTemplParams" colspan="2">template<typename Parameters > </td></tr>
|
|
<tr class="memitem:a96f95e438ca7940b115c838c96c06d87"><td class="memTemplItemLeft" align="right" valign="top">static std::unique_ptr< <a class="el" href="classoperations__research_1_1TimeLimit.html">TimeLimit</a> > </td><td class="memTemplItemRight" valign="bottom"><a class="el" href="classoperations__research_1_1TimeLimit.html#a96f95e438ca7940b115c838c96c06d87">FromParameters</a> (const Parameters &parameters)</td></tr>
|
|
<tr class="memdesc:a96f95e438ca7940b115c838c96c06d87"><td class="mdescLeft"> </td><td class="mdescRight">Creates a time limit object initialized from an object that provides methods <code>max_time_in_seconds()</code> and max_deterministic_time(). <a href="classoperations__research_1_1TimeLimit.html#a96f95e438ca7940b115c838c96c06d87">More...</a><br /></td></tr>
|
|
<tr class="separator:a96f95e438ca7940b115c838c96c06d87"><td class="memSeparator" colspan="2"> </td></tr>
|
|
</table><table class="memberdecls">
|
|
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-static-attribs"></a>
|
|
Static Public Attributes</h2></td></tr>
|
|
<tr class="memitem:a1837453fa693143e6ec334701557a448"><td class="memItemLeft" align="right" valign="top">static const double </td><td class="memItemRight" valign="bottom"><a class="el" href="classoperations__research_1_1TimeLimit.html#a1837453fa693143e6ec334701557a448">kSafetyBufferSeconds</a></td></tr>
|
|
<tr class="separator:a1837453fa693143e6ec334701557a448"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:ac62fbbc5383a86a9fe334e3213f6244b"><td class="memItemLeft" align="right" valign="top">static const int </td><td class="memItemRight" valign="bottom"><a class="el" href="classoperations__research_1_1TimeLimit.html#ac62fbbc5383a86a9fe334e3213f6244b">kHistorySize</a></td></tr>
|
|
<tr class="separator:ac62fbbc5383a86a9fe334e3213f6244b"><td class="memSeparator" colspan="2"> </td></tr>
|
|
</table>
|
|
<h2 class="groupheader">Constructor & Destructor Documentation</h2>
|
|
<a id="aa0975c0aa18ee607a54e7c4c8986ff0f"></a>
|
|
<h2 class="memtitle"><span class="permalink"><a href="#aa0975c0aa18ee607a54e7c4c8986ff0f">◆ </a></span>TimeLimit() <span class="overload">[1/3]</span></h2>
|
|
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="mlabels">
|
|
<tr>
|
|
<td class="mlabels-left">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname"><a class="el" href="classoperations__research_1_1TimeLimit.html">TimeLimit</a> </td>
|
|
<td>(</td>
|
|
<td class="paramtype">double </td>
|
|
<td class="paramname"><em>limit_in_seconds</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">double </td>
|
|
<td class="paramname"><em>deterministic_limit</em> = <code>std::numeric_limits<double>::infinity()</code>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">double </td>
|
|
<td class="paramname"><em>instruction_limit</em> = <code>std::numeric_limits<double>::infinity()</code> </td>
|
|
</tr>
|
|
<tr>
|
|
<td></td>
|
|
<td>)</td>
|
|
<td></td><td></td>
|
|
</tr>
|
|
</table>
|
|
</td>
|
|
<td class="mlabels-right">
|
|
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">explicit</span></span> </td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
|
|
<p>Sets the elapsed, the deterministic time and the instruction count limits. </p>
|
|
<p>The elapsed time is based on the wall time and the counter starts 'now'. The deterministic time has to be manually advanced using the method <a class="el" href="classoperations__research_1_1TimeLimit.html#af90cfd1fc238433fc303ee28c5914eb9" title="Advances the deterministic time.">AdvanceDeterministicTime()</a>.</p>
|
|
<p>Instruction count is the number of instructions executed. It is based on PMU counters and is not very acurate.</p>
|
|
<p>Use an infinite limit value to ignore a limit. </p>
|
|
|
|
<p class="definition">Definition at line <a class="el" href="time__limit_8h_source.html#l00473">473</a> of file <a class="el" href="time__limit_8h_source.html">time_limit.h</a>.</p>
|
|
|
|
</div>
|
|
</div>
|
|
<a id="a0598aaf87dab140f870c8ada2a1f3a39"></a>
|
|
<h2 class="memtitle"><span class="permalink"><a href="#a0598aaf87dab140f870c8ada2a1f3a39">◆ </a></span>TimeLimit() <span class="overload">[2/3]</span></h2>
|
|
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="mlabels">
|
|
<tr>
|
|
<td class="mlabels-left">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname"><a class="el" href="classoperations__research_1_1TimeLimit.html">TimeLimit</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="time__limit_8h_source.html#l00126">126</a> of file <a class="el" href="time__limit_8h_source.html">time_limit.h</a>.</p>
|
|
|
|
</div>
|
|
</div>
|
|
<a id="ac056854a98f4094ef4c8d3858b955fef"></a>
|
|
<h2 class="memtitle"><span class="permalink"><a href="#ac056854a98f4094ef4c8d3858b955fef">◆ </a></span>TimeLimit() <span class="overload">[3/3]</span></h2>
|
|
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="mlabels">
|
|
<tr>
|
|
<td class="mlabels-left">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname"><a class="el" href="classoperations__research_1_1TimeLimit.html">TimeLimit</a> </td>
|
|
<td>(</td>
|
|
<td class="paramtype">const <a class="el" href="classoperations__research_1_1TimeLimit.html">TimeLimit</a> & </td>
|
|
<td class="paramname"></td><td>)</td>
|
|
<td></td>
|
|
</tr>
|
|
</table>
|
|
</td>
|
|
<td class="mlabels-right">
|
|
<span class="mlabels"><span class="mlabel">delete</span></span> </td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
|
|
</div>
|
|
</div>
|
|
<h2 class="groupheader">Member Function Documentation</h2>
|
|
<a id="af90cfd1fc238433fc303ee28c5914eb9"></a>
|
|
<h2 class="memtitle"><span class="permalink"><a href="#af90cfd1fc238433fc303ee28c5914eb9">◆ </a></span>AdvanceDeterministicTime() <span class="overload">[1/2]</span></h2>
|
|
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="mlabels">
|
|
<tr>
|
|
<td class="mlabels-left">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">void AdvanceDeterministicTime </td>
|
|
<td>(</td>
|
|
<td class="paramtype">double </td>
|
|
<td class="paramname"><em>deterministic_duration</em></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>Advances the deterministic time. </p>
|
|
<p>For reproducibility reasons, the deterministic time doesn't advance automatically as the regular elapsed time does. </p>
|
|
|
|
<p class="definition">Definition at line <a class="el" href="time__limit_8h_source.html#l00226">226</a> of file <a class="el" href="time__limit_8h_source.html">time_limit.h</a>.</p>
|
|
|
|
</div>
|
|
</div>
|
|
<a id="ad068edb54c705c548c20e4ba47b4e3a8"></a>
|
|
<h2 class="memtitle"><span class="permalink"><a href="#ad068edb54c705c548c20e4ba47b4e3a8">◆ </a></span>AdvanceDeterministicTime() <span class="overload">[2/2]</span></h2>
|
|
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="mlabels">
|
|
<tr>
|
|
<td class="mlabels-left">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">void AdvanceDeterministicTime </td>
|
|
<td>(</td>
|
|
<td class="paramtype">double </td>
|
|
<td class="paramname"><em>deterministic_duration</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">const char * </td>
|
|
<td class="paramname"><em>counter_name</em> </td>
|
|
</tr>
|
|
<tr>
|
|
<td></td>
|
|
<td>)</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>Advances the deterministic time. </p>
|
|
<p>For reproducibility reasons, the deterministic time doesn't advance automatically as the regular elapsed time does.</p>
|
|
<p>In debug mode, this method also updates the deterministic time counter with the given name. In optimized mode, this method is equivalent to <code><a class="el" href="classoperations__research_1_1TimeLimit.html#af90cfd1fc238433fc303ee28c5914eb9" title="Advances the deterministic time.">AdvanceDeterministicTime(double)</a></code>. </p>
|
|
|
|
<p class="definition">Definition at line <a class="el" href="time__limit_8h_source.html#l00240">240</a> of file <a class="el" href="time__limit_8h_source.html">time_limit.h</a>.</p>
|
|
|
|
</div>
|
|
</div>
|
|
<a id="a764be64f3029f8b8e23511061d8de355"></a>
|
|
<h2 class="memtitle"><span class="permalink"><a href="#a764be64f3029f8b8e23511061d8de355">◆ </a></span>DebugString()</h2>
|
|
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">std::string DebugString </td>
|
|
<td>(</td>
|
|
<td class="paramname"></td><td>)</td>
|
|
<td> const</td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
|
|
<p>Returns information about the time limit object in a human-readable form. </p>
|
|
|
|
</div>
|
|
</div>
|
|
<a id="a30ac580cb264bf8e92696890f212727e"></a>
|
|
<h2 class="memtitle"><span class="permalink"><a href="#a30ac580cb264bf8e92696890f212727e">◆ </a></span>ExternalBooleanAsLimit()</h2>
|
|
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="mlabels">
|
|
<tr>
|
|
<td class="mlabels-left">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">std::atomic<bool>* ExternalBooleanAsLimit </td>
|
|
<td>(</td>
|
|
<td class="paramname"></td><td>)</td>
|
|
<td> const</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>Returns the current external Boolean limit. </p>
|
|
|
|
<p class="definition">Definition at line <a class="el" href="time__limit_8h_source.html#l00282">282</a> of file <a class="el" href="time__limit_8h_source.html">time_limit.h</a>.</p>
|
|
|
|
</div>
|
|
</div>
|
|
<a id="a640ae7a07a6de8fe45a5526326f3b028"></a>
|
|
<h2 class="memtitle"><span class="permalink"><a href="#a640ae7a07a6de8fe45a5526326f3b028">◆ </a></span>FromDeterministicTime()</h2>
|
|
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="mlabels">
|
|
<tr>
|
|
<td class="mlabels-left">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">static std::unique_ptr<<a class="el" href="classoperations__research_1_1TimeLimit.html">TimeLimit</a>> FromDeterministicTime </td>
|
|
<td>(</td>
|
|
<td class="paramtype">double </td>
|
|
<td class="paramname"><em>deterministic_limit</em></td><td>)</td>
|
|
<td></td>
|
|
</tr>
|
|
</table>
|
|
</td>
|
|
<td class="mlabels-right">
|
|
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">static</span></span> </td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
|
|
<p>Creates a time limit object that puts limit only on the deterministic time. </p>
|
|
|
|
<p class="definition">Definition at line <a class="el" href="time__limit_8h_source.html#l00144">144</a> of file <a class="el" href="time__limit_8h_source.html">time_limit.h</a>.</p>
|
|
|
|
</div>
|
|
</div>
|
|
<a id="a96f95e438ca7940b115c838c96c06d87"></a>
|
|
<h2 class="memtitle"><span class="permalink"><a href="#a96f95e438ca7940b115c838c96c06d87">◆ </a></span>FromParameters()</h2>
|
|
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="mlabels">
|
|
<tr>
|
|
<td class="mlabels-left">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">static std::unique_ptr<<a class="el" href="classoperations__research_1_1TimeLimit.html">TimeLimit</a>> FromParameters </td>
|
|
<td>(</td>
|
|
<td class="paramtype">const Parameters & </td>
|
|
<td class="paramname"><em>parameters</em></td><td>)</td>
|
|
<td></td>
|
|
</tr>
|
|
</table>
|
|
</td>
|
|
<td class="mlabels-right">
|
|
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">static</span></span> </td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
|
|
<p>Creates a time limit object initialized from an object that provides methods <code>max_time_in_seconds()</code> and max_deterministic_time(). </p>
|
|
<p>This method is designed specifically to work with solver parameter protos, e.g. <code>BopParameters</code>, <code>MipParameters</code> and <code>SatParameters</code>. </p>
|
|
|
|
<p class="definition">Definition at line <a class="el" href="time__limit_8h_source.html#l00159">159</a> of file <a class="el" href="time__limit_8h_source.html">time_limit.h</a>.</p>
|
|
|
|
</div>
|
|
</div>
|
|
<a id="a362a88bfe50d83c028154a62ef53e780"></a>
|
|
<h2 class="memtitle"><span class="permalink"><a href="#a362a88bfe50d83c028154a62ef53e780">◆ </a></span>GetDeterministicTimeLeft()</h2>
|
|
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="mlabels">
|
|
<tr>
|
|
<td class="mlabels-left">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">double GetDeterministicTimeLeft </td>
|
|
<td>(</td>
|
|
<td class="paramname"></td><td>)</td>
|
|
<td> const</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>Returns the remaining deterministic time before <code><a class="el" href="classoperations__research_1_1TimeLimit.html#a810d5f7aaf80cc09cf5a094e20c1aaca" title="Returns true when the external limit is true, or the deterministic time is over the deterministic lim...">LimitReached()</a></code> returns true due to the deterministic limit. </p>
|
|
<p>If the <code><a class="el" href="classoperations__research_1_1TimeLimit.html" title="A simple class to enforce both an elapsed time limit and a deterministic time limit in the same threa...">TimeLimit</a></code> was constructed with <b>infinity</b> as the deterministic limit (default value), this will always return infinity. </p>
|
|
|
|
<p class="definition">Definition at line <a class="el" href="time__limit_8h_source.html#l00212">212</a> of file <a class="el" href="time__limit_8h_source.html">time_limit.h</a>.</p>
|
|
|
|
</div>
|
|
</div>
|
|
<a id="ac7e861414a70fc937d18bc7ca743fc98"></a>
|
|
<h2 class="memtitle"><span class="permalink"><a href="#ac7e861414a70fc937d18bc7ca743fc98">◆ </a></span>GetElapsedDeterministicTime()</h2>
|
|
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="mlabels">
|
|
<tr>
|
|
<td class="mlabels-left">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">double GetElapsedDeterministicTime </td>
|
|
<td>(</td>
|
|
<td class="paramname"></td><td>)</td>
|
|
<td> const</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>Returns the elapsed deterministic time since the construction of this object. </p>
|
|
<p>That corresponds to the sum of all deterministic durations passed as an argument to <code><a class="el" href="classoperations__research_1_1TimeLimit.html#af90cfd1fc238433fc303ee28c5914eb9" title="Advances the deterministic time.">AdvanceDeterministicTime()</a></code> calls. </p>
|
|
|
|
<p class="definition">Definition at line <a class="el" href="time__limit_8h_source.html#l00260">260</a> of file <a class="el" href="time__limit_8h_source.html">time_limit.h</a>.</p>
|
|
|
|
</div>
|
|
</div>
|
|
<a id="ae3fe2e2b613455b49c6cc74dd3c7581e"></a>
|
|
<h2 class="memtitle"><span class="permalink"><a href="#ae3fe2e2b613455b49c6cc74dd3c7581e">◆ </a></span>GetElapsedTime()</h2>
|
|
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="mlabels">
|
|
<tr>
|
|
<td class="mlabels-left">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">double GetElapsedTime </td>
|
|
<td>(</td>
|
|
<td class="paramname"></td><td>)</td>
|
|
<td> const</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>Returns the time elapsed in seconds since the construction of this object. </p>
|
|
|
|
<p class="definition">Definition at line <a class="el" href="time__limit_8h_source.html#l00251">251</a> of file <a class="el" href="time__limit_8h_source.html">time_limit.h</a>.</p>
|
|
|
|
</div>
|
|
</div>
|
|
<a id="a0be73bea3d751ca2926c1cd616abb31e"></a>
|
|
<h2 class="memtitle"><span class="permalink"><a href="#a0be73bea3d751ca2926c1cd616abb31e">◆ </a></span>GetInstructionsLeft()</h2>
|
|
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="mlabels">
|
|
<tr>
|
|
<td class="mlabels-left">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">double GetInstructionsLeft </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>Returns the number of instructions left to reach the limit. </p>
|
|
|
|
<p class="definition">Definition at line <a class="el" href="time__limit_8h_source.html#l00586">586</a> of file <a class="el" href="time__limit_8h_source.html">time_limit.h</a>.</p>
|
|
|
|
</div>
|
|
</div>
|
|
<a id="a4273b83b06bfbf856393db6d0a9b8715"></a>
|
|
<h2 class="memtitle"><span class="permalink"><a href="#a4273b83b06bfbf856393db6d0a9b8715">◆ </a></span>GetTimeLeft()</h2>
|
|
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="mlabels">
|
|
<tr>
|
|
<td class="mlabels-left">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">double GetTimeLeft </td>
|
|
<td>(</td>
|
|
<td class="paramname"></td><td>)</td>
|
|
<td> const</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>Returns the time left on this limit, or 0 if the limit was reached (it never returns a negative value). </p>
|
|
<p>Note that it might return a positive value even though <code><a class="el" href="classoperations__research_1_1TimeLimit.html#a810d5f7aaf80cc09cf5a094e20c1aaca" title="Returns true when the external limit is true, or the deterministic time is over the deterministic lim...">LimitReached()</a></code> would return true; because the latter is conservative (see toplevel comment). If <code><a class="el" href="classoperations__research_1_1TimeLimit.html#a810d5f7aaf80cc09cf5a094e20c1aaca" title="Returns true when the external limit is true, or the deterministic time is over the deterministic lim...">LimitReached()</a></code> was actually called and did return <b>true</b>, though, this will always return 0.</p>
|
|
<p>If the <a class="el" href="classoperations__research_1_1TimeLimit.html" title="A simple class to enforce both an elapsed time limit and a deterministic time limit in the same threa...">TimeLimit</a> was constructed with <b>infinity</b> as the limit, this will always return infinity.</p>
|
|
<p>Note that this function is not optimized for speed as <code><a class="el" href="classoperations__research_1_1TimeLimit.html#a810d5f7aaf80cc09cf5a094e20c1aaca" title="Returns true when the external limit is true, or the deterministic time is over the deterministic lim...">LimitReached()</a></code> is. </p>
|
|
|
|
<p class="definition">Definition at line <a class="el" href="time__limit_8h_source.html#l00575">575</a> of file <a class="el" href="time__limit_8h_source.html">time_limit.h</a>.</p>
|
|
|
|
</div>
|
|
</div>
|
|
<a id="a517ffd071860d7efd76134e25f6f03e1"></a>
|
|
<h2 class="memtitle"><span class="permalink"><a href="#a517ffd071860d7efd76134e25f6f03e1">◆ </a></span>Infinite()</h2>
|
|
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="mlabels">
|
|
<tr>
|
|
<td class="mlabels-left">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">static std::unique_ptr<<a class="el" href="classoperations__research_1_1TimeLimit.html">TimeLimit</a>> Infinite </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 class="mlabel">static</span></span> </td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
|
|
<p>Creates a time limit object that uses infinite time for wall time, deterministic time and instruction count limit. </p>
|
|
|
|
<p class="definition">Definition at line <a class="el" href="time__limit_8h_source.html#l00134">134</a> of file <a class="el" href="time__limit_8h_source.html">time_limit.h</a>.</p>
|
|
|
|
</div>
|
|
</div>
|
|
<a id="a810d5f7aaf80cc09cf5a094e20c1aaca"></a>
|
|
<h2 class="memtitle"><span class="permalink"><a href="#a810d5f7aaf80cc09cf5a094e20c1aaca">◆ </a></span>LimitReached()</h2>
|
|
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="mlabels">
|
|
<tr>
|
|
<td class="mlabels-left">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">bool LimitReached </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>Returns true when the external limit is true, or the deterministic time is over the deterministic limit or if the next time <code><a class="el" href="classoperations__research_1_1TimeLimit.html#a810d5f7aaf80cc09cf5a094e20c1aaca" title="Returns true when the external limit is true, or the deterministic time is over the deterministic lim...">LimitReached()</a></code> is called is likely to be over the time limit. </p>
|
|
<p>See toplevel comment. Once it has returned true, it is guaranteed to always return true. </p>
|
|
|
|
<p class="definition">Definition at line <a class="el" href="time__limit_8h_source.html#l00537">537</a> of file <a class="el" href="time__limit_8h_source.html">time_limit.h</a>.</p>
|
|
|
|
</div>
|
|
</div>
|
|
<a id="ad0cdf04d71ac4f14262eb4871041ddbd"></a>
|
|
<h2 class="memtitle"><span class="permalink"><a href="#ad0cdf04d71ac4f14262eb4871041ddbd">◆ </a></span>MergeWithGlobalTimeLimit()</h2>
|
|
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="mlabels">
|
|
<tr>
|
|
<td class="mlabels-left">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">void MergeWithGlobalTimeLimit </td>
|
|
<td>(</td>
|
|
<td class="paramtype"><a class="el" href="classoperations__research_1_1TimeLimit.html">TimeLimit</a> * </td>
|
|
<td class="paramname"><em>other</em></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="time__limit_8h_source.html#l00516">516</a> of file <a class="el" href="time__limit_8h_source.html">time_limit.h</a>.</p>
|
|
|
|
</div>
|
|
</div>
|
|
<a id="a9d28f062361ac553f8bc1da250b205bd"></a>
|
|
<h2 class="memtitle"><span class="permalink"><a href="#a9d28f062361ac553f8bc1da250b205bd">◆ </a></span>operator=()</h2>
|
|
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="mlabels">
|
|
<tr>
|
|
<td class="mlabels-left">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname"><a class="el" href="classoperations__research_1_1TimeLimit.html">TimeLimit</a>& operator= </td>
|
|
<td>(</td>
|
|
<td class="paramtype">const <a class="el" href="classoperations__research_1_1TimeLimit.html">TimeLimit</a> & </td>
|
|
<td class="paramname"></td><td>)</td>
|
|
<td></td>
|
|
</tr>
|
|
</table>
|
|
</td>
|
|
<td class="mlabels-right">
|
|
<span class="mlabels"><span class="mlabel">delete</span></span> </td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
|
|
</div>
|
|
</div>
|
|
<a id="a4cb3517d59bf4642a85294267736af20"></a>
|
|
<h2 class="memtitle"><span class="permalink"><a href="#a4cb3517d59bf4642a85294267736af20">◆ </a></span>ReadInstructionCounter()</h2>
|
|
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="mlabels">
|
|
<tr>
|
|
<td class="mlabels-left">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">double ReadInstructionCounter </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>Returns the number of instructions executed since the creation of this object. </p>
|
|
|
|
<p class="definition">Definition at line <a class="el" href="time__limit_8h_source.html#l00527">527</a> of file <a class="el" href="time__limit_8h_source.html">time_limit.h</a>.</p>
|
|
|
|
</div>
|
|
</div>
|
|
<a id="a5b6cf15a55615535aa54e71103de8d9f"></a>
|
|
<h2 class="memtitle"><span class="permalink"><a href="#a5b6cf15a55615535aa54e71103de8d9f">◆ </a></span>RegisterExternalBooleanAsLimit()</h2>
|
|
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="mlabels">
|
|
<tr>
|
|
<td class="mlabels-left">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">void RegisterExternalBooleanAsLimit </td>
|
|
<td>(</td>
|
|
<td class="paramtype">std::atomic< bool > * </td>
|
|
<td class="paramname"><em>external_boolean_as_limit</em></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>Registers the external Boolean to check when <a class="el" href="classoperations__research_1_1TimeLimit.html#a810d5f7aaf80cc09cf5a094e20c1aaca" title="Returns true when the external limit is true, or the deterministic time is over the deterministic lim...">LimitReached()</a> is called. </p>
|
|
<p>This is used to mark the limit as reached through an external Boolean, i.e. <code><a class="el" href="classoperations__research_1_1TimeLimit.html#a810d5f7aaf80cc09cf5a094e20c1aaca" title="Returns true when the external limit is true, or the deterministic time is over the deterministic lim...">LimitReached()</a></code> returns true when the value of external_boolean_as_limit is true whatever the time limits are.</p>
|
|
<p>Note 1: The external_boolean_as_limit can be modified during solve.</p>
|
|
<p>Note 2: <code><a class="el" href="classoperations__research_1_1TimeLimit.html#a312550ebabce586fb77c49e813c610f8" title="Sets new time limits.">ResetLimitFromParameters()</a></code> will set this Boolean to false. </p>
|
|
|
|
<p class="definition">Definition at line <a class="el" href="time__limit_8h_source.html#l00274">274</a> of file <a class="el" href="time__limit_8h_source.html">time_limit.h</a>.</p>
|
|
|
|
</div>
|
|
</div>
|
|
<a id="a312550ebabce586fb77c49e813c610f8"></a>
|
|
<h2 class="memtitle"><span class="permalink"><a href="#a312550ebabce586fb77c49e813c610f8">◆ </a></span>ResetLimitFromParameters()</h2>
|
|
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="mlabels">
|
|
<tr>
|
|
<td class="mlabels-left">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">void ResetLimitFromParameters </td>
|
|
<td>(</td>
|
|
<td class="paramtype">const Parameters & </td>
|
|
<td class="paramname"><em>parameters</em></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>Sets new time limits. </p>
|
|
<p>Note that this does not reset the running max nor any registered external boolean or calls to RegisterSigintHandler(). </p>
|
|
|
|
<p class="definition">Definition at line <a class="el" href="time__limit_8h_source.html#l00510">510</a> of file <a class="el" href="time__limit_8h_source.html">time_limit.h</a>.</p>
|
|
|
|
</div>
|
|
</div>
|
|
<a id="a43229b9a540c5b4c3751ebb13e73ace8"></a>
|
|
<h2 class="memtitle"><span class="permalink"><a href="#a43229b9a540c5b4c3751ebb13e73ace8">◆ </a></span>SetInstructionLimit()</h2>
|
|
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="mlabels">
|
|
<tr>
|
|
<td class="mlabels-left">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">void SetInstructionLimit </td>
|
|
<td>(</td>
|
|
<td class="paramtype">double </td>
|
|
<td class="paramname"><em>instruction_limit</em></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>Sets the instruction limit. </p>
|
|
<p>We need this method since the static constructor to create time limit from parameters doesn't support setting instruction limit. </p>
|
|
|
|
<p class="definition">Definition at line <a class="el" href="time__limit_8h_source.html#l00171">171</a> of file <a class="el" href="time__limit_8h_source.html">time_limit.h</a>.</p>
|
|
|
|
</div>
|
|
</div>
|
|
<h2 class="groupheader">Member Data Documentation</h2>
|
|
<a id="ac62fbbc5383a86a9fe334e3213f6244b"></a>
|
|
<h2 class="memtitle"><span class="permalink"><a href="#ac62fbbc5383a86a9fe334e3213f6244b">◆ </a></span>kHistorySize</h2>
|
|
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="mlabels">
|
|
<tr>
|
|
<td class="mlabels-left">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">const int kHistorySize</td>
|
|
</tr>
|
|
</table>
|
|
</td>
|
|
<td class="mlabels-right">
|
|
<span class="mlabels"><span class="mlabel">static</span></span> </td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
|
|
<p class="definition">Definition at line <a class="el" href="time__limit_8h_source.html#l00108">108</a> of file <a class="el" href="time__limit_8h_source.html">time_limit.h</a>.</p>
|
|
|
|
</div>
|
|
</div>
|
|
<a id="a1837453fa693143e6ec334701557a448"></a>
|
|
<h2 class="memtitle"><span class="permalink"><a href="#a1837453fa693143e6ec334701557a448">◆ </a></span>kSafetyBufferSeconds</h2>
|
|
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="mlabels">
|
|
<tr>
|
|
<td class="mlabels-left">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">const double kSafetyBufferSeconds</td>
|
|
</tr>
|
|
</table>
|
|
</td>
|
|
<td class="mlabels-right">
|
|
<span class="mlabels"><span class="mlabel">static</span></span> </td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
|
|
<p class="definition">Definition at line <a class="el" href="time__limit_8h_source.html#l00107">107</a> of file <a class="el" href="time__limit_8h_source.html">time_limit.h</a>.</p>
|
|
|
|
</div>
|
|
</div>
|
|
<hr/>The documentation for this class was generated from the following file:<ul>
|
|
<li><a class="el" href="time__limit_8h_source.html">time_limit.h</a></li>
|
|
</ul>
|
|
</div><!-- contents -->
|
|
</div>
|
|
</div>
|
|
<div id="footer-container">
|
|
<div id="footer">
|
|
</div>
|
|
</div>
|
|
</body>
|
|
</html>
|