Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
prism-games
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor 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
bjp1g19
prism-games
Commits
2f20f153
Commit
2f20f153
authored
2 years ago
by
Ben Plummer
Browse files
Options
Downloads
Patches
Plain Diff
Ensure termination with a max energy bound
parent
9a546a37
Branches
bp/resource-based-games
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
prism/src/explicit/RBGModelChecker.java
+11
-1
11 additions, 1 deletion
prism/src/explicit/RBGModelChecker.java
with
11 additions
and
1 deletion
prism/src/explicit/RBGModelChecker.java
+
11
−
1
View file @
2f20f153
...
...
@@ -19,6 +19,7 @@ public class RBGModelChecker extends StateModelChecker {
List
<
TransList
>
transitions
;
BitSet
accept
;
Rewards
rewards
;
double
energyBound
;
private
AcceptanceType
[]
acceptance
=
{
...
...
@@ -91,6 +92,14 @@ public class RBGModelChecker extends StateModelChecker {
Rewards
modelRewards
=
constructRewards
(
model
);
rewards
=
modelRewards
.
liftFromModel
(
ltlProduct
);
// Calculate energy bound
double
maxWeight
=
0
;
for
(
TransList
tl
:
transitions
)
for
(
Map
.
Entry
<
Integer
,
Double
>
t
:
tl
)
maxWeight
=
t
.
getValue
()
>
maxWeight
?
t
.
getValue
()
:
maxWeight
;
int
numStates
=
ltlProduct
.
getProductModel
().
getNumStates
();
energyBound
=
2
*
(
numStates
-
1
)
*
maxWeight
;
List
<
Decorator
>
dec
=
List
.
of
(
new
ShowRewardDecorator
(
rewards
));
ltlProduct
.
getProductModel
().
exportToDotFile
(
"out/product.dot"
,
/*accept,*/
dec
);
ltlProduct
.
getOriginalModel
().
exportToDotFile
(
"out/model.dot"
,
List
.
of
(
new
ShowRewardDecorator
(
modelRewards
)));
...
...
@@ -151,8 +160,9 @@ public class RBGModelChecker extends StateModelChecker {
ext
[
src
]
=
ext
[
target
]
+
weight
-
reward
;
}
//
Normalise above 0
//
Keep extents between 0 and the max energy bound
if
(
ext
[
src
]
<
0
)
ext
[
src
]
=
0
;
if
(
ext
[
src
]
>
energyBound
)
ext
[
src
]
=
Double
.
POSITIVE_INFINITY
;
}
}
...
...
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