plt17:assignment_1

This shows you the differences between two versions of the page.

Both sides previous revision Previous revision | |||

plt17:assignment_1 [2017/09/08 16:05] hossein [Task 4] |
plt17:assignment_1 [2017/12/05 14:55] (current) hossein [Task 3] |
||
---|---|---|---|

Line 43: | Line 43: | ||

Write a function that gets a DIMACS benchmark file and uses a concurrent version of the truth table algorithm to solve it. | Write a function that gets a DIMACS benchmark file and uses a concurrent version of the truth table algorithm to solve it. | ||

- | A powerful and easy way to write concurrent programs in Scala is to use the [[http://doc.akka.io/docs/akka/current/scala/actors.html|Akka]] actor library. Write an actor that takes a boolean formula and checks a subset of rows in its truth table. Spawn multiple instances of that actor to cover all the rows. | + | A powerful and easy way to write concurrent programs in Scala is to use the [[http://doc.akka.io/docs/akka/current/scala/actors.html|Akka]] actor library. Alternatively you can use Scala Futures that provides a simple way to run an algorithm concurrently. |

+ | Write an actor that takes a boolean formula and checks a subset of rows in its truth table. Spawn multiple instances of that actor to cover all the rows. | ||

For example, for a Boolean formula with 4 variables, there are $2^4=16$ rows in the truth table. You can use one actor to check 8 rows and another for the rest of 8 rows. Or, you can use 4 actors that each of them checks 4 rows of the truth table. The actor gets a parameter (in the message) to know which subset of the table it should check. | For example, for a Boolean formula with 4 variables, there are $2^4=16$ rows in the truth table. You can use one actor to check 8 rows and another for the rest of 8 rows. Or, you can use 4 actors that each of them checks 4 rows of the truth table. The actor gets a parameter (in the message) to know which subset of the table it should check. | ||

The function in this task should also take an argument to know how many actors it should spawn to check the Boolean formula. The function should assert that the given number is only a power of 2. | The function in this task should also take an argument to know how many actors it should spawn to check the Boolean formula. The function should assert that the given number is only a power of 2. |

plt17/assignment_1.txt · Last modified: 2017/12/05 14:55 by hossein