You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since the goal of our project is to perform boolean simplification, we need a benchmark so we can formally compare various simplifications of a given boolean expression. A working metric we can use is the number of boolean operations (i.e. !, | and &; note that ( and ) do not count since these help precedence but do not act as an operation themselves - this can be discussed and evaluated later). A clean way to implement this metric is to use the visitor design pattern which we implemented in #17. The goal of this component is to write a visitor which traverses the AST and counts the number of boolean operations there are in a given boolean expression ((i.e. !, | and &). An example is shown below.
A | B & ! C -> 3
Action Items
create a new file called utils/metrics.py
write a new class called OpCounter which inherits from the Visitor class defined in parser.visitor
override all the relevant methods within the Visitor class to increment a _count variable
write an accessor, getCount, method which returns the _count variable
write some test cases using the unittest module inside a new file called tests/test_metrics.py
Resources
See #17 for a reference on how to write a visitor.
For a reference of how to use the visitor, see this example written in one of the test cases. The implementation for this should be fairly similar but only overrides a subset of the methods.
The text was updated successfully, but these errors were encountered:
Since the goal of our project is to perform boolean simplification, we need a benchmark so we can formally compare various simplifications of a given boolean expression. A working metric we can use is the number of boolean operations (i.e.
!
,|
and&
; note that(
and)
do not count since these help precedence but do not act as an operation themselves - this can be discussed and evaluated later). A clean way to implement this metric is to use the visitor design pattern which we implemented in #17. The goal of this component is to write a visitor which traverses the AST and counts the number of boolean operations there are in a given boolean expression ((i.e.!
,|
and&
). An example is shown below.Action Items
utils/metrics.py
OpCounter
which inherits from theVisitor
class defined inparser.visitor
Visitor
class to increment a_count
variablegetCount
, method which returns the_count
variableunittest
module inside a new file calledtests/test_metrics.py
Resources
See #17 for a reference on how to write a visitor.
For a reference of how to use the visitor, see this example written in one of the test cases. The implementation for this should be fairly similar but only overrides a subset of the methods.
The text was updated successfully, but these errors were encountered: