Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
fja
eval
Commits
8197cb07
Commit
8197cb07
authored
Jul 19, 2020
by
Kateřina Sloupová
Browse files
add canonization and cleanup
parent
00ac104d
Pipeline
#62608
passed with stage
in 58 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
evalweb/web_checker.py
View file @
8197cb07
...
...
@@ -181,7 +181,7 @@ class WebChecker:
picture
=
"s_in_t"
else
:
print
(
self
.
eq
.
left_counterexample
,
self
.
eq
.
right_counterexample
)
#
print(self.eq.left_counterexample, self.eq.right_counterexample)
picture
=
"eq"
self
.
languages
[
0
]
=
self
.
language
(
teacher
.
complement
())
self
.
languages
[
1
]
=
self
.
teacher
...
...
fja_checker/__main__.py
View file @
8197cb07
...
...
@@ -138,6 +138,7 @@ def main():
task_prefix
,
teacher_string
=
teacher_string
.
split
(
":"
,
1
)
teacher_type
,
task
=
get_task
(
task_prefix
)
# When time comes, teacher's solution can surely be also GRA or REG, see web_checker.
if
teacher_type
==
"DFA"
or
teacher_type
==
"NFA"
:
dfa_task
(
teacher_type
=
teacher_type
,
teacher_string
=
teacher_string
,
task
=
task
,
student_string
=
student_string
)
...
...
lib/dfa.py
View file @
8197cb07
...
...
@@ -178,7 +178,8 @@ class DFA:
state_2
not
in
dfa_2
.
final
:
final
.
add
(
state
)
return
DFA
(
states
,
characters
,
transition
,
init
,
final
)
dfa
=
DFA
(
states
,
characters
,
transition
,
init
,
final
)
return
dfa
.
eliminate_unreachable
().
canonize
()
@
staticmethod
def
union
(
dfa_1
:
DFA
,
dfa_2
:
DFA
)
->
DFA
:
...
...
@@ -272,7 +273,7 @@ class DFA:
dfa
.
final
.
add
(
new_state
)
dfa
.
transition
=
new_transition
return
dfa
return
dfa
.
canonize
()
def
rename_state
(
self
,
rename
:
State
,
name
:
str
):
if
name
==
rename
.
name
:
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment