Sale!

CSCI 1180 Programming Assignment 4 solved

Original price was: $35.00.Current price is: $30.00. $25.50

Category:

Description

5/5 - (6 votes)

This assignment is a generalization of the example of the publisher and reviewers, discussed in the
textbook There is a publisher who needs to decide whether to publish a book, and who has the
option of consulting with reviewers. The difference from the example in the book is that, in this
exercise, the publisher may consult with more than one reviewer.
We will assume the same simple model of publishing and of reviewers as in the example in the book.
The outcome of publishing is either Success, with a specified profit, or Fail with a specified loss.
The outcome of not publishing is 0. Consulting with a reviewer costs a specified amount Fee. A
reviewer gives a Boolean answer, Pos or Neg. Reviewers’ opinions are conditionally independent
given the value of Success/Fail. We will assume that all the reviewers are functionally identical;
that is, they all have the same probabilities and they all cost the same. We will also assume that the
publisher initially chooses the number of reviewers they want to consult with (the problem where the
publisher can consult with reviewers sequentially is good deal trickier — if you feel underchallenged
in this course, you might enjoy thinking about it.)
Write the following functions:
Part A
ProbSuccess(ProbSuc,ProbPosSuc,ProbPosFail,NPos,NNeg) where
ProbSuc = P(Success).
ProbPosSuc = P(For | Success).
ProbPosFail = P(For | Fail).
NPos = the number of reviewers who have given a positive review.
NNeg = the number of reviewers who have given a negative review.
This returns the conditional probability of success, given these parameters.
Part B
PubValue1(ValueSuc,ValueFail,Fee,ProbSuc,ProbPosSuc,ProbPosFail,NPos,NNeg) where:
ProbSuc,ProbPosSuc,ProbPosFail,NPos,NNeg are as above.
ValueSuc = Dollar profit if the book succeeds.
CostFail = Cost if the book fails (a positive number).
Fee = Cost of hiring a reviewer (a positive number).
This returns two values: A Boolean indicating whether the publisher should publish and a number
which is the expected return if they follow the advice of ChooseToPub.
Part C
PubValue2(ValueSuc,ValueFail,Fee,ProbSuc,ProbPosSuc,ProbPosFail,N) which returns the expected return if the publisher chooses to consult with N reviewers.
Note: If N reviewers are consulted then P(NPos|Success) and P(NPos|Failure) each follow a
binomial distribution, with p = ProbPosSuccess and p = ProbPosFail respectively. In Matlab, the
function nchoosek(n,k) computes the binomial coefficient C(n, k) = n!/(k!(n − k)!).
1 CSCI 1180
Part D
OptimalN(ValueSuc,ValueFail,Fee,ProbSuc,ProbPosSuc,ProbPosFail) which returns a pair of
values: The optimal number of reviewers to consult, and the expected profit.
Clearly, the maximum number of reviewers that can possibly be worth consulting is ProbSuc*ValueSuc/Fee;
at that point, you have spent all your expected profit in fees, even if you could completely guarantee a right decision. So just loop through the values of PubValue2 with N going from 0 to
ProbSuc*ValueSuc/Fee, and return the best value and the corresponding N.
2 CSCI 1180