Find the value of the optimal plan

Assignment Help JAVA Programming
Reference no: EM131449653

Question 1. Write a program to solve the Longest Common Subsequence problem using dynamic programming as discussed in class. For example, if the input is X = ABCBDAB and Y = BDCABA, then the output of your program should be BCBA.

Question 2. Suppose you need to create a work plan, and each week you have to choose a job to undertake. The set of possible jobs is divided into low-stress and high-stress jobs.

If you select a low-stress job in week i, then you get a revenue of li dollars; if you select a high-stress job, you get a revenue of hi dollars. The catch, however, is that in order for you to take on a high-stress job in week i, it's required that you rest in weeki - 1 because you need a full week of prep time to get ready for the stress level (It's okay to choose a high-stress job in week 1.) On the other hand, you can take a low-stress job in weeki even if you have done a job (of either type) in week i-1.

So, given a sequence of n weeks, a plan is speci?ed by a choice of "low-stress", "high-stress" or "none" for each of the n weeks, with the constraint that if "high-stress" is chosen for week i> 1, then "none" must be chosen for week i - 1. The value of the plan is determined in the natural way; for each i, you add li to the value if you choose "low-stress" in week i, and you add hi to the value if you choose "high-stress" in week i. (You add 0 if you choose "none" in week i.)

Example: Suppose n=4, and the values of li and hiare given by the following table. Then the plan of the maximum value would be to choose "none" in week 1, a high stress job in week 2, and low-stress jobs in weeks 3 and 4. The value of this plan would be

i

Week 1

Week 2

Week 3

Week 4

l

10

1

10

10

h

5

50

5

1

Design a dynamic programming algorithm to find the value of the optimal plan. Implement your algorithm using any programming language you prefer.

Verified Expert

The task was to implement the concept of dynamic programming in Computer science. First problem was to write code for longest common sub-sequence problem,also called LCS. Second problem was to design an algorithm for a job problem using dynamic programming and the code for it.Both were successfully implemented.

Reference no: EM131449653

Questions Cloud

Justify the nash equilibrium conditions : Exercise: (Nash demand game)* Consider the problem of dividing a pie between two players. If we let x and y denote player l and player 2 payoffs.
Calculate the set of daily returns : Calculate the set of daily returns that correspond to these daily price series - Based on your results in Part d, which stock appears to be the riskiest?
What is the function of a magistrate : What is the function of a magistrate? List the requirements for becoming a magistrate in your state of residence. Do you agree with those qualifications?
Describe edgeworth duopoly : There are two identical firms producing a homogeneous good whose demand curve is q = 100 - p. Firms simultaneously choose prices.
Find the value of the optimal plan : Design a dynamic programming algorithm to find the value of the optimal plan. Implement your algorithm using any programming language you prefer.
What is the managers expected hedge price : What is the manager's "expected hedge price?" Was the cooperatives expected hedge price equal to their realized hedge price? If not, why
Significance of the current data is for the economy : Explain what each of these economic indicators measures and what the significance of the current data is for the economy.
Cause the price of heating oil to increase : What other factors could cause the price of heating oil to increase?
Examine the components such as liquidity of debt : Examine the components, such as liquidity of debt, equity markets, existence of some form of market exchange, and regulatory body.

Reviews

Write a Review

JAVA Programming Questions & Answers

  Recursive factorial program

Write a class Array that encapsulates an array and provides bounds-checked access. Create a recursive factorial program that prompts the user for an integer N and writes out a series of equations representing the calculation of N!.

  Hunt the wumpus game

Reprot on Hunt the Wumpus Game has Source Code listing, screen captures and UML design here and also, may include Javadoc source here.

  Create a gui interface

Create GUI Interface in java programing with these function: Sort by last name and print all employees info, Sort by job title and print all employees info, Sort by weekly salary and print all employees info, search by job title and print that emp..

  Plot pois on a graph

Write a JAVA program that would get the locations of all the POIs from the file and plot them on a map.

  Write a university grading system in java

University grading system maintains number of tables to store, retrieve and manipulate student marks. Write a JAVA program that would simulate a number of cars.

  Wolves and sheep: design a game

This project is designed a game in java. you choose whether you'd like to write a wolf or a sheep agent. Then, you are assigned to either a "sheep" or a "wolf" team.

  Build a graphical user interface for displaying the image

Build a graphical user interface for displaying the image groups (= cluster) in JMJRST. Design and implement using a Swing interface.

  Determine the day of the week for new year''s day

This assignment contains a java project. Project evaluates the day of the week for New Year's Day.

  Write a java windowed application

Write a Java windowed application to do online quiz on general knowledge and the application also displays the quiz result.

  Input pairs of natural numbers

Java program to input pairs of natural numbers.

  Create classes implement java interface

Interface that contains a generic type. Create two classes that implement this interface.

  Java class, array, link list , generic class

These 14 questions covers java class, Array, link list , generic class.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd