Generated on Sat Jul 29 2017 12:41:24 for Gecode by doxygen 1.8.13
stop.hpp
Go to the documentation of this file.
1 /* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
2 /*
3  * Main authors:
4  * Christian Schulte <schulte@gecode.org>
5  *
6  * Copyright:
7  * Christian Schulte, 2006
8  *
9  * Last modified:
10  * $Date: 2015-09-27 19:00:38 +0200 (Sun, 27 Sep 2015) $ by $Author: schulte $
11  * $Revision: 14762 $
12  *
13  * This file is part of Gecode, the generic constraint
14  * development environment:
15  * http://www.gecode.org
16  *
17  * Permission is hereby granted, free of charge, to any person obtaining
18  * a copy of this software and associated documentation files (the
19  * "Software"), to deal in the Software without restriction, including
20  * without limitation the rights to use, copy, modify, merge, publish,
21  * distribute, sublicense, and/or sell copies of the Software, and to
22  * permit persons to whom the Software is furnished to do so, subject to
23  * the following conditions:
24  *
25  * The above copyright notice and this permission notice shall be
26  * included in all copies or substantial portions of the Software.
27  *
28  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
29  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
30  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
31  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
32  * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
33  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
34  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
35  *
36  */
37 
38 namespace Gecode { namespace Search {
39 
40  /*
41  * Base class
42  *
43  */
45  Stop::Stop(void) {}
47  Stop::~Stop(void) {}
48 
49 
50  /*
51  * Stopping for node limit
52  *
53  */
54 
56  NodeStop::NodeStop(unsigned long int l0) : l(l0) {}
57 
58  forceinline unsigned long int
59  NodeStop::limit(void) const {
60  return l;
61  }
62 
63  forceinline void
64  NodeStop::limit(unsigned long int l0) {
65  l=l0;
66  }
67 
68 
69  /*
70  * Stopping for failure limit
71  *
72  */
73 
75  FailStop::FailStop(unsigned long int l0) : l(l0) {}
76 
77  forceinline unsigned long int
78  FailStop::limit(void) const {
79  return l;
80  }
81 
82  forceinline void
83  FailStop::limit(unsigned long int l0) {
84  l=l0;
85  }
86 
87 
88  /*
89  * Stopping for time limit
90  *
91  */
92 
94  TimeStop::TimeStop(unsigned long int l0)
95  : l(l0) {
96  t.start();
97  }
98 
99  forceinline unsigned long int
100  TimeStop::limit(void) const {
101  return l;
102  }
103 
104  forceinline void
105  TimeStop::limit(unsigned long int l0) {
106  l=l0;
107  }
108 
109  forceinline void
111  t.start();
112  }
113 
114 }}
115 
116 // STATISTICS: search-other
unsigned long int limit(void) const
Return current limit.
Definition: stop.hpp:59
NNF * l
Left subtree.
Definition: bool-expr.cpp:244
unsigned long int l
Current limit in milliseconds.
Definition: search.hh:578
unsigned long int limit(void) const
Return current limit in milliseconds.
Definition: stop.hpp:100
Support::Timer t
Time when execution should stop.
Definition: search.hh:576
NodeStop(unsigned long int l)
Stop if node limit l is exceeded.
Definition: stop.hpp:56
unsigned long int limit(void) const
Return current limit.
Definition: stop.hpp:78
void start(void)
Start timer.
Definition: timer.hpp:70
FailStop(unsigned long int l)
Stop if failure limit l is exceeded.
Definition: stop.hpp:75
void reset(void)
Reset time to zero.
Definition: stop.hpp:110
Stop(void)
Default constructor.
Definition: stop.hpp:45
unsigned long int l
Node limit.
Definition: search.hh:534
#define forceinline
Definition: config.hpp:173
unsigned long int l
Failure limit.
Definition: search.hh:557
virtual ~Stop(void)
Destructor.
Definition: stop.hpp:47
TimeStop(unsigned long int l)
Stop if search exceeds l milliseconds (from creation of this object)
Definition: stop.hpp:94
Gecode toplevel namespace