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
meta
sequential
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
* Last modified:
10
* $Date: 2016-04-19 17:19:45 +0200 (Tue, 19 Apr 2016) $ by $Author: schulte $
11
* $Revision: 14967 $
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
#ifndef __GECODE_SEARCH_META_SEQUENTIAL_PBS_HH__
39
#define __GECODE_SEARCH_META_SEQUENTIAL_PBS_HH__
40
41
#include <
gecode/search.hh
>
42
43
namespace
Gecode
{
namespace
Search {
namespace
Meta {
namespace
Sequential {
44
46
class
SharedStopInfo
{
47
public
:
49
bool
done
;
51
unsigned
long
int
l
;
52
};
53
55
class
GECODE_SEARCH_EXPORT
PortfolioStop
:
public
Stop
{
56
private
:
58
Stop
* so;
60
SharedStopInfo
* ssi;
61
public
:
63
PortfolioStop
(
Stop
* so);
65
void
share(
SharedStopInfo
* ssi);
67
virtual
bool
stop
(
const
Statistics
& s,
const
Options
& o);
68
};
69
71
class
Slave
{
72
protected
:
74
Engine
*
slave
;
76
Stop
*
stop
;
77
public
:
79
void
init
(
Engine
* s,
Stop
* so);
81
Space
*
next
(
void
);
83
Statistics
statistics
(
void
)
const
;
85
bool
stopped
(
void
)
const
;
87
void
constrain
(
const
Space
&
b
);
89
void
run
(
void
);
91
~Slave
(
void
);
92
};
93
95
template
<
bool
best>
96
class
GECODE_SEARCH_EXPORT
PBS
:
public
Engine
{
97
protected
:
99
Statistics
stat
;
101
SharedStopInfo
ssi
;
103
unsigned
int
slice
;
105
Slave
*
slaves
;
107
unsigned
int
n_slaves
;
109
unsigned
int
cur
;
111
bool
slave_stop
;
112
public
:
114
PBS
(
Engine
** slaves,
Stop
** stops,
unsigned
int
n
,
115
const
Statistics
& stat,
const
Search::Options
&
opt
);
117
virtual
Space
* next(
void
);
119
virtual
Statistics
statistics(
void
)
const
;
121
virtual
bool
stopped(
void
)
const
;
123
virtual
void
constrain(
const
Space
&
b
);
125
virtual
~
PBS
(
void
);
126
};
127
128
}}}}
129
130
#include <
gecode/search/meta/sequential/pbs.hpp
>
131
132
#endif
133
134
// STATISTICS: search-meta
Gecode::Search::Meta::Sequential::PBS::slaves
Slave * slaves
Slaves.
Definition:
pbs.hh:105
Gecode::Search::Meta::Sequential::PBS::slave_stop
bool slave_stop
Whether a slave has been stopped.
Definition:
pbs.hh:111
GECODE_SEARCH_EXPORT
#define GECODE_SEARCH_EXPORT
Definition:
search.hh:63
Gecode::Search::Options
Search engine options
Definition:
search.hh:446
Gecode::Search::Stop
Base-class for Stop-object.
Definition:
search.hh:501
Gecode::Search::Meta::Sequential::SharedStopInfo
Shared stop information.
Definition:
pbs.hh:46
Gecode::Search::Meta::Sequential::PBS::slice
unsigned int slice
Size of a slice.
Definition:
pbs.hh:103
Gecode::Search::Meta::Sequential::PBS::cur
unsigned int cur
Current slave to run.
Definition:
pbs.hh:109
search.hh
Gecode::Search::Meta::Sequential::Slave::stop
Stop * stop
Stop object.
Definition:
pbs.hh:76
Gecode::Space
Computation spaces.
Definition:
core.hpp:1748
pbs.hpp
Gecode
Gecode toplevel namespace
Gecode::Search::Meta::Sequential::Slave::next
Space * next(void)
Return next solution.
Definition:
pbs.hpp:57
Gecode::Search::Meta::Sequential::Slave::slave
Engine * slave
The slave engine.
Definition:
pbs.hh:74
Test::opt
Options opt
The options.
Definition:
test.cpp:101
Gecode::Search::Meta::Sequential::Slave::constrain
void constrain(const Space &b)
Constrain with better solution b.
Definition:
pbs.hpp:69
b
struct Gecode::@579::NNF::@61::@62 b
For binary nodes (and, or, eqv)
Gecode::Search::Engine
Search engine implementation interface
Definition:
search.hh:601
Gecode::Search::Meta::Sequential::Slave::run
void run(void)
Perform one run.
Gecode::Search::Meta::Sequential::Slave::stopped
bool stopped(void) const
Check whether slave has been stopped.
Definition:
pbs.hpp:65
Gecode::Search::Meta::Sequential::Slave::init
void init(Engine *s, Stop *so)
Initialize with slave s and its stop object so.
Definition:
pbs.hpp:53
Gecode::Search::Meta::Sequential::SharedStopInfo::done
bool done
Whether search stopped because the slice is done.
Definition:
pbs.hh:49
Gecode::Search::Meta::Sequential::PBS::n_slaves
unsigned int n_slaves
Number of slave engines.
Definition:
pbs.hh:107
Gecode::Search::Meta::Sequential::Slave
Runnable slave of a portfolio master.
Definition:
pbs.hh:71
Gecode::Search::Meta::Sequential::Slave::~Slave
~Slave(void)
Delete slave.
Definition:
pbs.hpp:73
Gecode::Search::Meta::Sequential::PBS::ssi
SharedStopInfo ssi
Shared slave information.
Definition:
pbs.hh:101
Gecode::Search::Meta::Sequential::Slave::statistics
Statistics statistics(void) const
Return statistics of slave.
Definition:
pbs.hpp:61
Gecode::Search::Meta::Sequential::PBS::stat
Statistics stat
Master statistics.
Definition:
pbs.hh:99
n
int n
Number of negative literals for node type.
Definition:
bool-expr.cpp:238
Gecode::Search::Meta::Sequential::PBS
Sequential portfolio engine implementation.
Definition:
pbs.hh:96
Gecode::Search::Meta::Sequential::SharedStopInfo::l
unsigned long int l
The current failure limit, incremented for each slice.
Definition:
pbs.hh:51
Gecode::Search::Statistics
Search engine statistics
Definition:
search.hh:140
Gecode::Search::Meta::Sequential::PortfolioStop
Stop object used for controling slaves in a portfolio.
Definition:
pbs.hh:55
Gecode::Search::Meta::Sequential::stop
Stop * stop(Stop *so)
Create stop object.
Definition:
pbs.cpp:43