blob: caf9425cf98ec57bd355029167e7903b5a8e531a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
#include "Manager.h"
#include "SearchCubePruning.h"
#include "SearchNormal.h"
#include "InputType.h"
#include "util/exception.hh"
namespace Moses
{
Search::Search(Manager& manager)
: m_manager(manager)
, m_source(manager.GetSource())
, m_options(*manager.options())
, m_inputPath()
, m_initialTransOpt()
, m_bitmaps(manager.GetSource().GetSize(), manager.GetSource().m_sourceCompleted)
, interrupted_flag(0)
{
m_initialTransOpt.SetInputPath(m_inputPath);
m_timer.start();
}
bool
Search::
out_of_time()
{
int const& timelimit = m_options.search.timeout;
if (timelimit > 0) {
double elapsed_time = GetUserTime();
if (elapsed_time > timelimit) {
VERBOSE(1,"Decoding is out of time (" << elapsed_time << ","
<< timelimit << ")" << std::endl);
interrupted_flag = 1;
return true;
}
}
int const& segment_timelimit = m_options.search.segment_timeout;
if (segment_timelimit > 0) {
double elapsed_time = m_timer.get_elapsed_time();
if (elapsed_time > segment_timelimit) {
VERBOSE(1,"Decoding for segment is out of time (" << elapsed_time << ","
<< segment_timelimit << ")" << std::endl);
interrupted_flag = 1;
return true;
}
}
return false;
}
}
|