main page
modules
namespaces
classes
files
Gecode home
Generated on Sun Aug 9 2020 05:34:08 for Gecode by
doxygen
1.8.18
gecode
search
seq
pbs.hh
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, 2015
8
*
9
* This file is part of Gecode, the generic constraint
10
* development environment:
11
* http://www.gecode.org
12
*
13
* Permission is hereby granted, free of charge, to any person obtaining
14
* a copy of this software and associated documentation files (the
15
* "Software"), to deal in the Software without restriction, including
16
* without limitation the rights to use, copy, modify, merge, publish,
17
* distribute, sublicense, and/or sell copies of the Software, and to
18
* permit persons to whom the Software is furnished to do so, subject to
19
* the following conditions:
20
*
21
* The above copyright notice and this permission notice shall be
22
* included in all copies or substantial portions of the Software.
23
*
24
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
25
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
26
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
27
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
28
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
29
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
30
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
31
*
32
*/
33
34
#ifndef __GECODE_SEARCH_SEQ_PBS_HH__
35
#define __GECODE_SEARCH_SEQ_PBS_HH__
36
37
#include <
gecode/search.hh
>
38
39
namespace
Gecode
{
namespace
Search {
namespace
Seq {
40
42
class
SharedStopInfo
{
43
public
:
45
bool
done
;
47
unsigned
long
int
l
;
48
};
49
51
class
GECODE_SEARCH_EXPORT
PortfolioStop
:
public
Stop
{
52
private
:
54
Stop
* so;
56
SharedStopInfo
* ssi;
57
public
:
59
PortfolioStop
(
Stop
* so);
61
void
share(
SharedStopInfo
* ssi);
63
virtual
bool
stop
(
const
Statistics
& s,
const
Options
& o);
64
};
65
67
class
Slave
{
68
protected
:
70
Engine
*
slave
;
72
Stop
*
stop
;
73
public
:
75
void
init
(
Engine
* s,
Stop
* so);
77
Space
*
next
(
void
);
79
Statistics
statistics
(
void
)
const
;
81
bool
stopped
(
void
)
const
;
83
void
constrain
(
const
Space
&
b
);
85
void
run
(
void
);
87
~Slave
(
void
);
88
};
89
91
template
<
bool
best>
92
class
GECODE_SEARCH_EXPORT
PBS
:
public
Engine
{
93
protected
:
95
Statistics
stat
;
97
SharedStopInfo
ssi
;
99
unsigned
int
slice
;
101
Slave
*
slaves
;
103
unsigned
int
n_slaves
;
105
unsigned
int
cur
;
107
bool
slave_stop
;
108
public
:
110
PBS
(
Engine
** slaves,
Stop
** stops,
unsigned
int
n
,
111
const
Statistics
& stat,
const
Search::Options
&
opt
);
113
virtual
Space
* next(
void
);
115
virtual
Statistics
statistics(
void
)
const
;
117
virtual
bool
stopped(
void
)
const
;
119
virtual
void
constrain(
const
Space
&
b
);
121
virtual
~
PBS
(
void
);
122
};
123
124
}}}
125
126
#include <
gecode/search/seq/pbs.hpp
>
127
128
#endif
129
130
// STATISTICS: search-seq
Gecode::Search::Seq::SharedStopInfo::l
unsigned long int l
The current failure limit, incremented for each slice.
Definition:
pbs.hh:47
GECODE_SEARCH_EXPORT
#define GECODE_SEARCH_EXPORT
Definition:
search.hh:67
Gecode::Search::Seq::SharedStopInfo
Shared stop information.
Definition:
pbs.hh:42
Gecode::Search::Options
Search engine options
Definition:
search.hh:746
Gecode::Search::Stop
Base-class for Stop-object.
Definition:
search.hh:799
Gecode::Search::Seq::PBS::slaves
Slave * slaves
Slaves.
Definition:
pbs.hh:101
Gecode::Search::Seq::Slave::constrain
void constrain(const Space &b)
Constrain with better solution b.
Definition:
pbs.hpp:65
search.hh
Gecode::Space
Computation spaces.
Definition:
core.hpp:1742
Gecode::Search::Seq::Slave::stopped
bool stopped(void) const
Check whether slave has been stopped.
Definition:
pbs.hpp:61
Gecode::Search::Seq::PBS::slave_stop
bool slave_stop
Whether a slave has been stopped.
Definition:
pbs.hh:107
Gecode::Search::Seq::Slave::~Slave
~Slave(void)
Delete slave.
Definition:
pbs.hpp:69
Gecode::Search::Seq::Slave::slave
Engine * slave
The slave engine.
Definition:
pbs.hh:70
Gecode::Search::Seq::PBS::cur
unsigned int cur
Current slave to run.
Definition:
pbs.hh:105
Gecode
Gecode toplevel namespace
Gecode::Search::Seq::Slave::run
void run(void)
Perform one run.
Test::opt
Options opt
The options.
Definition:
test.cpp:97
Gecode::Driver::stop
void stop(Support::Timer &timer, std::ostream &os)
Get time since start of timer and print user friendly time information.
Definition:
script.cpp:42
Gecode::Search::Seq::Slave::init
void init(Engine *s, Stop *so)
Initialize with slave s and its stop object so.
Definition:
pbs.hpp:49
Gecode::Search::Engine
Search engine implementation interface
Definition:
search.hh:899
b
struct Gecode::@602::NNF::@65::@66 b
For binary nodes (and, or, eqv)
Gecode::Search::Seq::Slave::stop
Stop * stop
Stop object.
Definition:
pbs.hh:72
Gecode::Search::Seq::PBS
Sequential portfolio engine implementation.
Definition:
pbs.hh:92
Gecode::Search::Seq::PortfolioStop
Stop object used for controling slaves in a portfolio.
Definition:
pbs.hh:51
Gecode::Search::Seq::Slave::statistics
Statistics statistics(void) const
Return statistics of slave.
Definition:
pbs.hpp:57
Gecode::Search::Seq::PBS::n_slaves
unsigned int n_slaves
Number of slave engines.
Definition:
pbs.hh:103
Gecode::Search::Seq::PBS::slice
unsigned int slice
Size of a slice.
Definition:
pbs.hh:99
Gecode::Search::Seq::Slave::next
Space * next(void)
Return next solution.
Definition:
pbs.hpp:53
Gecode::Search::Seq::SharedStopInfo::done
bool done
Whether search stopped because the slice is done.
Definition:
pbs.hh:45
Gecode::Search::Seq::PBS::stat
Statistics stat
Master statistics.
Definition:
pbs.hh:95
n
int n
Number of negative literals for node type.
Definition:
bool-expr.cpp:234
Gecode::Search::Seq::PBS::ssi
SharedStopInfo ssi
Shared slave information.
Definition:
pbs.hh:97
pbs.hpp
Gecode::Search::Statistics
Search engine statistics
Definition:
search.hh:147
Gecode::Search::Seq::Slave
Runnable slave of a portfolio master.
Definition:
pbs.hh:67