main page
modules
namespaces
classes
files
Gecode home
Generated on Tue Jan 28 2020 00:00:00 for Gecode by
doxygen
1.8.17
gecode
search
stop.cpp
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-03-11 15:59:09 +0100 (Wed, 11 Mar 2015) $ by $Author: schulte $
11
* $Revision: 14435 $
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
#include <
gecode/search.hh
>
39
40
namespace
Gecode
{
namespace
Search {
41
42
/*
43
* Creation functions for stop objects
44
*
45
*/
46
Stop*
47
Stop::node
(
unsigned
long
int
l
) {
48
return
new
NodeStop
(
l
);
49
}
50
Stop
*
51
Stop::fail
(
unsigned
long
int
l
) {
52
return
new
FailStop
(
l
);
53
}
54
Stop
*
55
Stop::time
(
unsigned
long
int
l
) {
56
return
new
TimeStop
(
l
);
57
}
58
59
60
/*
61
* Stopping for node limit
62
*
63
*/
64
bool
65
NodeStop::stop
(
const
Statistics
& s,
const
Options
&) {
66
return
s.
node
>
l
;
67
}
68
69
70
/*
71
* Stopping for failure limit
72
*
73
*/
74
bool
75
FailStop::stop
(
const
Statistics
& s,
const
Options
&) {
76
return
s.
fail
>
l
;
77
}
78
79
80
/*
81
* Stopping for time limit
82
*
83
*/
84
bool
85
TimeStop::stop
(
const
Statistics
&,
const
Options
&) {
86
return
t
.
stop
() >
l
;
87
}
88
89
90
}}
91
92
// STATISTICS: search-other
Gecode::Search::NodeStop::l
unsigned long int l
Node limit.
Definition:
search.hh:534
Gecode::Search::TimeStop::t
Support::Timer t
Time when execution should stop.
Definition:
search.hh:576
Gecode::Search::Options
Search engine options
Definition:
search.hh:446
Gecode::Search::Stop::time
static Stop * time(unsigned long int l)
Stop if time limit l (in milliseconds) has been exceeded.
Definition:
stop.cpp:55
Gecode::Search::Stop
Base-class for Stop-object.
Definition:
search.hh:501
Gecode::Search::Statistics::fail
unsigned long int fail
Number of failed nodes in search tree.
Definition:
search.hh:143
Gecode::Support::Timer::stop
double stop(void)
Get time since start of timer.
Definition:
timer.hpp:80
Gecode::Search::Stop::fail
static Stop * fail(unsigned long int l)
Stop if failure limit l has been exceeded.
Definition:
stop.cpp:51
search.hh
Gecode::Search::Stop::node
static Stop * node(unsigned long int l)
Stop if node limit l has been exceeded.
Definition:
stop.cpp:47
Gecode::Search::TimeStop::l
unsigned long int l
Current limit in milliseconds.
Definition:
search.hh:578
Gecode::Search::TimeStop
Stop-object based on time
Definition:
search.hh:573
Gecode
Gecode toplevel namespace
Gecode::Search::TimeStop::stop
virtual bool stop(const Statistics &s, const Options &o)
Return true if time limit is exceeded.
Definition:
stop.cpp:85
Gecode::Search::Statistics::node
unsigned long int node
Number of nodes expanded.
Definition:
search.hh:145
Gecode::Search::NodeStop::stop
virtual bool stop(const Statistics &s, const Options &o)
Return true if node limit is exceeded.
Definition:
stop.cpp:65
Gecode::Search::FailStop::l
unsigned long int l
Failure limit.
Definition:
search.hh:557
Gecode::Search::NodeStop
Stop-object based on number of nodes
Definition:
search.hh:531
l
NNF * l
Left subtree.
Definition:
bool-expr.cpp:244
Gecode::Search::FailStop
Stop-object based on number of failures
Definition:
search.hh:554
Gecode::Search::FailStop::stop
virtual bool stop(const Statistics &s, const Options &o)
Return true if failure limit is exceeded.
Definition:
stop.cpp:75
Gecode::Search::Statistics
Search engine statistics
Definition:
search.hh:140