Be G.

asked • 09/22/20

pseudocode in java

Write pseudocode for a recursive method that will calculate the expected value of a decision tree, assuming that all decisions are made by maximizing the expected utility. Your method should return a double value representing the expected utility, and take in as a parameter a reference to the root node in the tree.

Assume that you have a DecisionTreeNode class already implemented the has the following functionality (you do not need to provide pseudocode for this class). First, there are three types of nodes: Leaf, Chance, or Decision. The getType() method returns this type.

A Leaf node has no children, but has a utility value that can be accessed by calling the getUtility() method on the node. A Chance node represents a random outcome that is chosen by nature according to a known probability distribution. It has two methods, getChildren() which returns a list of DecisionTreeNode objects that are the children of this node, and getProbabilities() that returns a list of the probabilities of each child being selected (in the same order as the getChildren() method). Finally, a Decision node has a list of children that can be accessed by calling the getChildren() method. Calling the getUtility() method on any node that is not a Leaf results in an error.

b) Briefly describe the changes you would need to make to your code to minimize maximum regret for the decision tree instead.


1 Expert Answer

By:

Patrick B. answered • 09/22/20

Tutor
4.7 (31)

Math and computer tutor/teacher

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.