binary decision

A binary decision is a choice between two alternatives, for instance between taking some specific action or not taking it.{{citation|title=Making Critical Decisions: A Practical Guide for Nonprofit Organizations|first1=Roberta M.|last1=Snow|first2=Paul H.|last2=Phillips|publisher=John Wiley & Sons|year=2007|isbn=978-0-470-18503-2|page=44|url=https://books.google.com/books?id=RywALQbvY14C&pg=PA44}}.

Binary decisions are basic to many fields. Examples include:

  • Truth values in mathematical logic, and the corresponding Boolean data type in computer science, representing a value which may be chosen to be either true or false.{{citation|title=Computer Fundamentals and Programming in C|first=J. B.|last=Dixit|publisher=Firewall Media|year=2009|isbn=978-81-7008-882-0|page=61|url=https://books.google.com/books?id=4krQm5ohjBgC&pg=PA61}}.
  • Conditional statements (if-then or if-then-else) in computer science, binary decisions about which piece of code to execute next.{{citation|first=Edward|last=Yourdon|author-link=Edward Yourdon|title=Clear thinking vital: Nested IFs not evil plot leading to program bugs|journal=Computerworld|date=March 19, 1975|url=https://books.google.com/books?id=5XHrnDj7kG8C&pg=PA15|page=15}}.
  • Decision trees and binary decision diagrams, representations for sequences of binary decisions.{{citation|title=Model Checking|first1=E. M.|last1=Clarke|first2=Orna|last2=Grumberg|author2-link=Orna Grumberg|first3=Doron|last3=Peled|publisher=MIT Press|year=1999|isbn=978-0-262-03270-4|page=51|url=https://books.google.com/books?id=Nmc4wEaLXFEC&pg=PA51}}.
  • Binary choice, a statistical model for the outcome of a binary decision.{{citation|title=Discrete Choice Analysis: Theory and Application to Travel Demand|volume=9|series=Transportation Studies|first1=Moshe E.|last1=Ben-Akiva|first2=Steven R.|last2=Lerman|publisher=MIT Press|year=1985|isbn=978-0-262-02217-0|page=59|url=https://books.google.com/books?id=oLC6ZYPs9UoC&pg=PA59}}.

Binary decision diagrams

{{See also|Binary decision diagram}}

A binary decision diagram (BDD) is a way to visually represent a boolean function. One application of BDDs is in CAD software and digital circuit analysis where they are an efficient way to represent and manipulate boolean functions.{{Cite web |last=Kukreja |first=Jyoti |title=Application of Binary Decision Diagram in digital circuit analysis |website=University of Southern California |s2cid=13980719 |url=http://www-classes.usc.edu/engr/ee-s/552/coursematerials/ee552-D9.pdf |archive-url=https://web.archive.org/web/20030928103020/http://www-classes.usc.edu/engr/ee-s/552/coursematerials/ee552-D9.pdf |archive-date=2003-09-28}}

File:BDD simple.svg

The value of a boolean function can be determined by following a path in its BDD down to a terminal, making a binary decision at each node where a solid line is followed if the value of the variable at the node is true and a dotted line if it is false. A BDD is said to be 'ordered' if the order of the variables tested is fixed. A BDD is said to be 'reduced' if the two following conditions are true:

  • Each successor of each node is distinct.
  • There are no two distinct nodes of the same variable with the same successors.{{Cite web|title=Lecture Notes on Binary Decision Diagrams|url=https://www.cs.cmu.edu/~fp/courses/15122-f10/lectures/19-bdds.pdf|last=Pfenning|first=Frank|date=October 28, 2010|website=Carnegie Mellon School of Computer Science|url-status=live|archive-url=https://web.archive.org/web/20140309033128/http://www.cs.cmu.edu:80/~fp/courses/15122-f10/lectures/19-bdds.pdf |archive-date=2014-03-09 |access-date=26 May 2020}}{{Cite web|title=Binary Decision Diagrams|url=http://www.di.univr.it/documenti/OccorrenzaIns/matdid/matdid813066.pdf|last=|first=|date=|website=Dep. Computer Science - University of Verona|url-status=live|archive-url=https://web.archive.org/web/20160418043441/http://www.di.univr.it:80/documenti/OccorrenzaIns/matdid/matdid813066.pdf |archive-date=2016-04-18 |access-date=26 May 2020}}

BDDs that are ordered and reduced can be called Reduced Ordered Binary Decision Diagrams (ROBDD). An example of a ROBDD is the figure to the right, which represents the function f(x_1,x_2,x_3)=\bar{x}_1\bar{x}_2\bar{x}_3+x_1x_2+x_2x_3. The order of the variables along any path is always x_1, x_2, then x_3, all nodes have distinct successors, and there are no two nodes of the same variable and the same successors.

Conditional statements

In computer science, conditional statements are used to make binary decisions.{{Cite web|title=Programming - Conditionals|url=https://www.cs.utah.edu/~germain/PPS/Topics/conditionals.html|website=www.cs.utah.edu|access-date=2020-05-26}} A program can perform different computations or actions depending on whether a certain boolean value evaluates to true or false.

The if-then-else construct is a control flow statement which runs one of two code blocks depending on the value of a boolean expression, and its structure looks like this:

if condition then

code block 1

else

code block 2

end

File:IF-THEN-ELSE-END flowchart.pngThe conditional expression is condition, and if it is true, then code block 1 is executed, otherwise code block 2 is executed. It is also possible to combine multiple conditions with the else-if construct:

if condition 1 then

code block 1

else if condition 2 then

code block 2

else

code block 3

end

This can be represented by the flow diagram on the right. If one condition is found to be true, then the rest are skipped, so only one of the three code blocks above can be executed.

A while loop is a control flow statement which executes a code block repeatedly until its boolean expression becomes false, making a decision on whether to continue repeating before each loop. This is similar to the if-then construct, but it can executing a code block multiple times.

See also

References