Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
cs598mp-fall2021-proj
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
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
chsieh16
cs598mp-fall2021-proj
Commits
ccab8d26
Commit
ccab8d26
authored
3 years ago
by
chsieh16
Browse files
Options
Downloads
Patches
Plain Diff
Fix indexed free variables for states and percepts in Z3
parent
b8382e5c
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
learner_base.py
+7
-2
7 additions, 2 deletions
learner_base.py
with
7 additions
and
2 deletions
learner_base.py
+
7
−
2
View file @
ccab8d26
...
...
@@ -32,8 +32,9 @@ class Z3LearnerBase(LearnerBase):
def
__init__
(
self
,
state_dim
,
perc_dim
)
->
None
:
super
().
__init__
()
self
.
_solver
=
z3
.
SolverFor
(
'
QF_LRA
'
)
self
.
_state_vars
=
z3
.
RealVarVector
(
state_dim
)
self
.
_percept_vars
=
z3
.
RealVarVector
(
perc_dim
)
real_var_vec
=
z3
.
RealVarVector
(
state_dim
+
perc_dim
)
self
.
_state_vars
=
real_var_vec
[
0
:
state_dim
]
self
.
_percept_vars
=
real_var_vec
[
state_dim
:
state_dim
+
perc_dim
]
@property
def
state_dim
(
self
)
->
int
:
...
...
@@ -47,5 +48,9 @@ class Z3LearnerBase(LearnerBase):
res
=
self
.
_solver
.
check
()
if
res
==
z3
.
sat
:
return
self
.
_solver
.
model
()
elif
res
==
z3
.
unsat
:
print
(
"
(unsat)
"
)
return
None
else
:
print
(
"
(unknown)
"
)
return
None
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