Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
sogMBT
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
PMC-SOG
sogMBT
Commits
83a7d8c5
Commit
83a7d8c5
authored
4 months ago
by
Jaime Arias
Browse files
Options
Downloads
Patches
Plain Diff
fix: calcul1 function
parent
c34b4c76
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#9295
failed
4 months ago
Stage: external
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
libs/parser/src/Net.cpp
+36
-14
36 additions, 14 deletions
libs/parser/src/Net.cpp
libs/parser/src/Net.hpp
+28
-16
28 additions, 16 deletions
libs/parser/src/Net.hpp
with
64 additions
and
30 deletions
libs/parser/src/Net.cpp
+
36
−
14
View file @
83a7d8c5
...
...
@@ -23,13 +23,17 @@ void Node::addPost(int node, int valuation) {
post
.
push_back
(
x
);
}
bool
Node
::
operator
==
(
const
Node
&
n
)
const
{
return
n
.
name
==
name
;
}
bool
Node
::
operator
==
(
const
Node
&
n
)
const
{
return
n
.
name
==
name
;
}
/*void Node::addReset(int node) {
reset.push_back(node);
}*/
///////////////////////////////////////////////////////operator<//////////
bool
Node
::
operator
<
(
const
Node
&
t
)
const
{
return
t
.
name
<
name
;
}
bool
Node
::
operator
<
(
const
Node
&
t
)
const
{
return
t
.
name
<
name
;
}
bool
RelaCausal
::
operator
<
(
RelaCausal
const
&
rhs
)
const
{
bool
res
=
(
*
(
rhs
.
first
)
==
*
first
)
&&
(
*
(
rhs
.
second
)
==
*
second
);
...
...
@@ -112,19 +116,32 @@ RelaCausal* net::rech_couple_cause(Transition t) {
}
/*-------------------- calcul l’ensemble d’observation-----------------------*/
set
<
int
>
net
::
calcul1
()
{
set
<
int
>
net
::
calcul1
()
const
{
set
<
int
>
unobs
;
for
(
int
i
=
0
;
i
<
transitions
.
size
();
i
++
)
{
Transition
t
=
transitions
[
i
];
t
.
visited
=
true
;
if
(
t
.
post
.
size
()
>=
1
)
{
for
(
auto
p
:
t
.
post
)
{
// t.visited = true;
if
(
!
t
.
post
.
empty
())
{
bool
is_unobs
=
false
;
for
(
const
auto
&
p
:
t
.
post
)
{
if
((
places
[
p
.
first
]).
pre
.
size
()
==
1
&&
(
places
[
p
.
first
]).
marking
==
0
&&
(
places
[
p
.
first
]).
post
.
size
()
>
0
)
{
unobs
.
insert
(
i
);
!
(
places
[
p
.
first
]).
post
.
empty
())
{
for
(
const
auto
&
tt
:
places
[
p
.
first
].
post
)
{
for
(
const
auto
&
pp
:
transitions
[
tt
.
first
].
pre
)
{
if
(
pp
.
first
==
p
.
first
and
(
places
[
p
.
first
]).
marking
<
pp
.
second
)
{
unobs
.
insert
(
i
);
is_unobs
=
true
;
break
;
}
}
if
(
is_unobs
)
break
;
}
}
if
(
is_unobs
)
break
;
}
}
}
...
...
@@ -138,7 +155,8 @@ int pos_trans(TRANSITIONS T, string trans) {
// cout<<"on cherche "<<trans<<" dans :\n";
for
(
TRANSITIONS
::
const_iterator
i
=
T
.
begin
();
!
(
i
==
T
.
end
());
i
++
,
pos
++
)
{
// cout<<i->name<<" ";
if
(
i
->
name
==
trans
)
return
pos
;
if
(
i
->
name
==
trans
)
return
pos
;
}
// cout<<"Non trouve :\n";
return
-
1
;
...
...
@@ -146,17 +164,20 @@ int pos_trans(TRANSITIONS T, string trans) {
ostream
&
operator
<<
(
ostream
&
os
,
const
ObsNCau
&
onc
)
{
os
<<
onc
.
couvrant
.
name
<<
"--->{"
;
for
(
auto
t
:
onc
.
couverts
)
os
<<
t
.
name
<<
", "
;
for
(
auto
t
:
onc
.
couverts
)
os
<<
t
.
name
<<
", "
;
os
<<
"}"
<<
endl
;
return
os
;
}
ostream
&
operator
<<
(
ostream
&
os
,
const
RelaCausal
&
onc
)
{
os
<<
"Les first :{"
;
for
(
auto
t
:
*
onc
.
first
)
os
<<
t
.
name
<<
", "
;
for
(
auto
t
:
*
onc
.
first
)
os
<<
t
.
name
<<
", "
;
os
<<
"}"
<<
endl
;
os
<<
"Les second :{"
;
for
(
auto
t
:
*
onc
.
second
)
os
<<
t
.
name
<<
", "
;
for
(
auto
t
:
*
onc
.
second
)
os
<<
t
.
name
<<
", "
;
os
<<
"}"
<<
endl
;
os
<<
" la relation: "
<<
onc
.
relation
<<
endl
;
return
os
;
...
...
@@ -309,7 +330,8 @@ ostream& operator<<(ostream& os, const net& R) {
if
(
p
->
isQueue
())
{
os
<<
"queue "
<<
setw
(
4
)
<<
i
<<
":"
<<
p
->
name
<<
", cp("
<<
p
->
capacity
<<
")"
;
if
(
p
->
isLossQueue
())
cout
<<
" loss"
;
if
(
p
->
isLossQueue
())
cout
<<
" loss"
;
cout
<<
endl
;
}
else
os
<<
"place "
<<
setw
(
4
)
<<
i
<<
":"
<<
p
->
name
<<
":"
<<
p
->
marking
...
...
This diff is collapsed.
Click to expand it.
libs/parser/src/Net.hpp
+
28
−
16
View file @
83a7d8c5
...
...
@@ -14,11 +14,11 @@
typedef
set
<
int
>
Set
;
class
Node
{
public:
Node
(){};
Node
()
{};
bool
visited
=
false
;
string
name
;
~
Node
(){};
vector
<
pair
<
int
,
int
>
>
pre
,
post
/*,inhibitor, preAuto, postAuto*/
;
~
Node
()
{};
vector
<
pair
<
int
,
int
>>
pre
,
post
/*,inhibitor, preAuto, postAuto*/
;
void
addPre
(
int
,
int
);
void
addPost
(
int
,
int
);
bool
operator
==
(
const
Node
&
)
const
;
...
...
@@ -32,17 +32,25 @@ class Place : public Node {
Place
(
const
string
&
p
,
int
m
=
0
,
int
c
=
0
)
:
marking
(
m
),
capacity
(
c
)
{
name
=
p
;
};
~
Place
(){};
bool
isLossQueue
()
const
{
return
marking
==
-
2
;
}
bool
isQueue
()
const
{
return
marking
<=
-
1
;
}
bool
hasCapacity
()
const
{
return
capacity
!=
0
;
}
~
Place
()
{};
bool
isLossQueue
()
const
{
return
marking
==
-
2
;
}
bool
isQueue
()
const
{
return
marking
<=
-
1
;
}
bool
hasCapacity
()
const
{
return
capacity
!=
0
;
}
};
class
Transition
:
public
Node
{
public:
Transition
(){};
Transition
(
const
string
&
t
)
{
name
=
t
;
};
~
Transition
(){};
Transition
()
{};
Transition
(
const
string
&
t
)
{
name
=
t
;
};
~
Transition
()
{};
};
// typedef vector<Place> PLACES;
...
...
@@ -70,7 +78,7 @@ class ObsNCau {
set
<
Transition
>
couverts
;
bool
cycle
;
ObsNCau
(
Transition
t
,
set
<
Transition
>
c
,
bool
cy
=
0
);
ObsNCau
(){};
ObsNCau
()
{};
bool
operator
<
(
ObsNCau
const
&
rhs
)
const
;
friend
ostream
&
operator
<<
(
ostream
&
,
const
ObsNCau
&
);
};
...
...
@@ -89,8 +97,8 @@ class net : public RdPMonteur {
set
<
RelaCausal
*>
causality
;
/* Constructors */
net
(){};
~
net
(){};
net
()
{};
~
net
()
{};
net
(
const
char
*
file
,
const
char
*
Obs
=
""
,
const
char
*
Int
=
""
);
/* Monteur */
...
...
@@ -98,7 +106,7 @@ class net : public RdPMonteur {
// set<ObsNCau*> observation(RelaCausal &r);
// void Obs_causee(ObsNCau & s);
// map<int,int>calcul();
set
<
int
>
calcul1
();
// mathode jorg
set
<
int
>
calcul1
()
const
;
// mathode jorg
RelaCausal
*
rech_couple_cause
(
Transition
t
);
bool
addPlace
(
const
string
&
place
,
int
marking
=
0
,
int
capacity
=
0
);
bool
addQueue
(
const
string
&
place
,
int
capacity
=
0
);
...
...
@@ -113,8 +121,12 @@ class net : public RdPMonteur {
int
valuation
=
1
);
/* Visualisation */
int
nbPlace
()
const
{
return
places
.
size
();
};
int
nbTransition
()
const
{
return
transitions
.
size
();
};
int
nbPlace
()
const
{
return
places
.
size
();
};
int
nbTransition
()
const
{
return
transitions
.
size
();
};
};
ostream
&
operator
<<
(
ostream
&
,
const
net
&
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment