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
36a58d6c
Commit
36a58d6c
authored
3 years ago
by
aastorg2
Browse files
Options
Downloads
Patches
Plain Diff
implementing the algorithm
parent
d2ccc74d
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
region_synth.py
+23
-8
23 additions, 8 deletions
region_synth.py
with
23 additions
and
8 deletions
region_synth.py
+
23
−
8
View file @
36a58d6c
from
__future__
import
print_function
from
z3
import
*
from
typing
import
List
,
Tuple
from
firstpass_learner
import
FirstpassLearner
from
firstpass_teacher
import
FirstpassTeacher
def
visitor
(
e
,
seen
):
if
e
in
seen
:
...
...
@@ -69,18 +69,33 @@ def synth_region():
sqr
=
Function
(
'
sqr
'
,
RealSort
(),
RealSort
()
)
variable_map
=
{
str
(
x
):
x
,
str
(
y
):
y
,
str
(
x_p
):
x_p
,
str
(
y_p
):
y_p
,
str
(
sqr
):
sqr
}
### Chiao: Read in positive samples
positive_eyamples
:
List
[
Tuple
[
float
,...]]
=
[]
positive_examples
:
List
[
Tuple
[
float
,...]]
=
[
(
10.0
,
-
10.0
,
11.0
,
-
11.0
),
(
10.0
,
-
10.0
,
9.0
,
-
9.0
),
(
1.0
,
1.0
,
1.5
,
2.3
),
]
model
=
None
learner
=
FirstpassLearner
()
learner
.
add_positive_examples
(
*
positive_examples
)
#print(learner._solver.assertions())
model
=
learner
.
learn
()
#print(type(model))
#print(model)
teacher
=
FirstpassTeacher
()
###Angello create learner and add constraints to grammar
res
=
os
.
popen
(
'
../cvc4-1.8 --sygus-out=sygus-standard --lang=sygus2 circleSygus.sl
'
).
read
()
#
res = os.popen('../cvc4-1.8 --sygus-out=sygus-standard --lang=sygus2 circleSygus.sl').read()
# print(res)
# print("######")
exprBody
=
res
[
67
:
-
2
].
strip
()
print
(
exprBody
)
print
(
"
======
"
)
#
exprBody = res[67:-2].strip()
#
print(exprBody)
#
print("======")
z3_expr
=
parse_smt2_string
(
"
(assert
"
+
exprBody
+
"
)
"
,
decls
=
variable_map
)
#
z3_expr = parse_smt2_string("(assert "+exprBody+" )", decls=variable_map)
# seen = {}
# seen_sub = {}
# sub_term_sqr = []
...
...
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