mCRL2
Loading...
Searching...
No Matches
LinearLiftingStrategy.cpp
Go to the documentation of this file.
1// Copyright (c) 2009-2013 University of Twente
2// Copyright (c) 2009-2013 Michael Weber <michaelw@cs.utwente.nl>
3// Copyright (c) 2009-2013 Maks Verver <maksverver@geocities.com>
4// Copyright (c) 2009-2013 Eindhoven University of Technology
5//
6// Distributed under the Boost Software License, Version 1.0.
7// (See accompanying file LICENSE_1_0.txt or copy at
8// http://www.boost.org/LICENSE_1_0.txt)
9
11
13 const ParityGame &game, bool alternate )
14 : LiftingStrategy(), alternate_(alternate),
15 last_vertex_(game.graph().V() - 1),
16 dir_(0), vertex_(NO_VERTEX), failed_lifts_(0)
17{
18}
19
21{
22 (void)v; // unused
23 failed_lifts_ = 0;
24}
25
27{
29
30 if (vertex_ == NO_VERTEX)
31 {
32 dir_ = 0;
33 vertex_ = 0;
34 failed_lifts_ = 0;
35 }
36 else
37 {
38 ++failed_lifts_; // count last vertex being lifted
39
40 if (dir_ == 0) // forward
41 {
43 {
44 ++vertex_;
45 }
46 else
47 if (!alternate_)
48 {
49 vertex_ = 0;
50 }
51 else
52 {
53 dir_ = 1;
55 }
56 }
57 else // backward
58 {
59 if (vertex_ > 0)
60 {
61 --vertex_;
62 }
63 else
64 if (!alternate_)
65 {
67 }
68 else
69 {
70 dir_ = 0;
72 }
73 }
74 }
75 return vertex_;
76}
77
79 const ParityGame &game, const SmallProgressMeasures &spm )
80{
81 (void)spm; // unused
82 return new LinearLiftingStrategy(game, alternate_);
83}
std::size_t verti
type used to number vertices
Definition Graph.h:24
#define NO_VERTEX
Definition Graph.h:27
LiftingStrategy * create(const ParityGame &game, const SmallProgressMeasures &spm)
Return a new LinearLiftingStrategy instance.
const verti last_vertex_
last vertex index
verti vertex_
next vertex to lift
LinearLiftingStrategy(const ParityGame &game, bool alternate)
verti failed_lifts_
number of consecutive failed lift attempts
bool dir_
current direction of iteration
const bool alternate_
alternate direction after each pass