1
//////////////////////////////////////////////////////////////////////////////////
2
// This file is part of Toolkit for Conceptual Modeling (TCM).
3
// (c) copyright 2001, Universiteit Twente.
4
// Author: Rik Eshuis (eshuis@cs.utwente.nl).
6
// TCM is free software; you can redistribute it and/or modify
7
// it under the terms of the GNU General Public License as published by
8
// the Free Software Foundation; either version 2 of the License, or
9
// (at your option) any later version.
11
// TCM is distributed in the hope that it will be useful,
12
// but WITHOUT ANY WARRANTY; without even the implied warranty of
13
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
// GNU General Public License for more details.
16
// You should have received a copy of the GNU General Public License
17
// along with TCM; if not, write to the Free Software
18
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
20
////////////////////////////////////////////////////////////////////////////////
21
#ifndef _ADSHYPERGRAPH_H
22
#define _ADSHYPERGRAPH_H
25
#include "hypergraph.h"
34
class ATDActionStateNode;
39
class ClockConstraint;
41
/// (abstract) graph class.
42
class ADSHyperGraph: public HyperGraph {
43
/*@Doc: {\large {\bf scope:} diagram} */
50
/// does a interfere with b?
51
bool GetInterference(ADSActivity *a, ADSActivity *b);
53
bool GetInterference(ATDActionStateNode *a1, ATDActionStateNode *a2);
55
bool isConflicting(Bag <ADSHyperEdge *> *step, ADSHyperEdge *he);
61
bool AddProp(Prop *p);
63
bool AddVar(ADSVar *v);
65
void RemoveProp(Prop *p);
68
void GetPropList(List <Prop *> &l);
70
void GetExtPropList(List <Prop *> &l);
72
void GetIntPropList(List <Prop *> &l);
74
void GetVarList(List <ADSVar *> &l);
76
Prop *FindSimilarProp(Prop *p);
78
ADSVar *FindSimilarVar(ADSVar *p);
81
Node *FindNode(string name);
83
// ADSActivity *FindAct(string);
84
/// update the upper bound of each node
85
void UpdateBounds(Bag <Subject *> *cfg);
86
/// return the upper bound of node s
87
int GetBound(Subject *s);
90
int GetNrTimeouts(){return timeoutnumber;};
93
void WriteSubjects(OutputFile *ofile);
95
string DeadEdgesNodesConstraints();
97
void SetInitialFinalNames();
99
void UnSetInitialFinalNames();
101
void WriteNuSMV(OutputFile *ofile, bool);
103
string ComputeFinalPredicate();
105
void GetFinalNodes(List <Subject *> *final);
108
void RemoveLocalVariables(List <ADSVar *> *used);
111
void RemoveNodes(List <Node *> , List <ADSVar *>, bool reduction);
116
void ComputeActivities();
118
void ComputeConflicts();
120
void ComputeInterferences();
122
void ComputeInternalProperties();
124
void ComputeInternalHyperEdges();
126
void ComputeExternalProperties();
127
/// how many timeout are there in the hypergraph
128
void ComputeNrTimeouts();
130
void InitialiseBounds();
134
/// Here come the reduction rules
138
bool NodeReferredToBySomeInpredicate(Subject *n);
140
bool VarTestedInHyperEdgeWithoutUpdate(ADSVar *v);
142
bool VarUpdatedByTwoActivities(ADSVar *v);
144
bool isRemovableHyperEdge(ADSHyperEdge *hedge, List <Node *> nodeused, List <ADSVar *> varused, bool reduction);
151
/// the list of properties
153
/// the list of variables
154
List <ADSVar *> varl;
155
/// the variables updated in activities. Needed for deriving the interference relation
156
List <ADSVar *> updatedinactivities;
158
List <ADSActivity *> actlist;
159
/// n by n matrix (indexed by actlist)
160
int interference[MAXACT][MAXACT];
161
/// the list of properties that can be set by the environment
162
List <Prop *> extproplist;
163
/// the list of properties that are updated in activities
164
List <Prop *> intproplist;
165
/// the number of timeouts. Needed to initialise the interval of the clock manager
167
/// the bound of each node; needed for model checker input