# Algorithms for Data Science using dynamic programming

Algorithms for Data Science using dynamic programming
Algorithms for Data Science
Assignment 3
Portfolio Optimization
In this assignment, you will be using dynamic programming to select a set of investment options
that maximize your return on investment. You will be given a file of investment options along
with the estimated return on investment for each one. You also have a given amount of money
to invest.
The specific file of investment options you will be given will vary, but you will always
have the following three pieces of information you can obtain from the file:
Investment Name, Investment Cost, Estimated Return On Investment
For example:
A,10,60
B,20,100
C,30,120
Start by putting all your code in a file called portfolio.py. Create a function called
load Investments that takes in the investment Filename and returns a list of possible investment
options: name, cost, and estimated return. You will be given a file of actual investment options
along with specific directions for that file on how to obtain the three pieces of information
necessary for this assignment.
Then make a function called optimize Investments that takes the list of possible investments
along with the amount of money available to spend. This function should return both the
optimal return on investment amount as well as the actual investments selected to achieve this
optimal return. Implement this function using dynamic programming.
For dynamic programming, one needs a recursive breakdown of the problem. We have a
number of possible investments and an amount we are able to spend. At each step, we can
decide to either include investment x or exclude it.
If we include it, then we are left with a smaller problem of finding the optimal return with all the possible investments without investment x with a smaller amount we are able to spend (because we purchased investment x). If we exclude it, then we are left with a smaller problem of finding the optimal return with all the possible investments without investment x but with the same amount of money to spend as we had before. A DAC solution could be attempted, but it ends up having too much-repeated work. Therefore, we will implement our solution with dynamic programming. Note that this is a 2-D problem (number of investments and amount of money to spend). Thus, we will need a 2-D table.
The second step is filling in the base cases. Note that when we don’t select any investments, no
matter how much money we have to spend (top row), then we get no return on investment.
This is a natural base case. The third step is to identify the goal location in the table. This will be
the position where we are allowed to include all investments with our full allocation of funds to
spend. This will be the lower-right corner.
The last step in computing any optimal table is to determine the order in which to fill in the table, keeping in mind that one always needs all the results for the recursive subproblems available to fill in the next location.
After the optimal table is computed, a traceback table needs to be added to the
implementation so we can find the actual investments that produce the optimal. Recall that
traceback tables store the “winning” options at each step and are then used at the end to trace
back through these winning options.
Your code should return the optimal return on investment number as well as a list of the investment names used to obtain this optimal number. Note that this is a similar problem to the 0/1 Knapsack problem, and you should use that idea to help guide you through your implementation
Other posts:
MIS 610 Topic 8 Discussions GCU
Opioid issue within the US
EMM 442 Grand Canyon Entire Course
NRNP 6531 Week 5 Knowledge Check: Cardiovascular and Respiratory Conditions

Hire a Nursing Expert
Pages (550 words)
Approximate price: -

Why Choose Instant Nursing Papers?

Quality Nursing Papers

We assist students in achieving the best top-grade in their nursing papers, and in compliance with the provided instructions. Have your nursing paper written with a certified specialist Ph.D., Bachelor's, and Master's graduates with many years of experience in academic writing.

Experts with Ph.d., MDs and DNP Holders

Our writers have acquired Ph.D., MDs and DNP credentials from world class institutions. Our writers can handle papers from any discipline and can handle over 100+ subjects.

Nursing Papers Cheap

We provide a great deal of student-friendly prices and professionalism with all our nursing essay writing services. Our paper writing services have a user-friendly interface and professional nursing academic assistance. We are committed to assisting all students with their nursing assignments and projects regardless of their academic level.

Fast Paper Delivery

Our writers follow a strict schedule to ensure papers are delivered before the deadline to enable our editors to proofread before the final delivery to our customers. We strictly observe the early delivery of assignments to meet our clients' deadlines.

Plagiarism-free Nursing Papers

Our expert nursing paper writers are dedicated to conducting thorough research and writing papers from scratch to deliver original papers. To avoid paper plagiarism, all orders go through steps of writing, editing, and proofreading.

24Hour Customer Help

Our customer support is available 24/7/365 to help clients and make their paper writing services easy to use. Our experienced support team is available to answer your queries any time, 24 hours a day.

Try it now!

## Calculate the price of your order

We'll send you the first draft for approval by at
Total price:
\$0.00

How it works?

Fill in the order form and provide all details of your assignment.

Proceed with the payment

Choose the payment system that suits you most.

Our Nursing Papers Writing Service

We provide Nursing Assignment Services to Nursing students. Also, we are not limited to providing Nursing assignment help to students only. We also provide assignment help and solutions to community health nursing, Anatomy & Physiology, Microbiology, Biochemistry and Biophysics, and Nutrition & Dietetics.

## Nursing Essays

Sit back, relax while our writers sort you out on your most daunting nursing essay queries on how to write a good nursing essay. We got you if you are looking for the best nursing essay services.

Nursing Projects

It is no doubt that qualifying for a nursing career is difficult and requires a series of tests. Most nursing students must put in a lot of work in their assignments and coursework. Instantnursingpapers.com will help you answer queries such as “who can write my nursing research paper?”.

Nursing Dissertation Help

Instantnursingpapers.com will save you the hustle of undergoing pressure or even depression while doing your nursing dissertation paper. Save yourself from all the long sleepless nights and pressure by working with our best nursing dissertation writing professionals.

Nursing Coursework Help

If you happen to hop into our site in search of nursing coursework help, look no further. We are the number one solution for the best nursing coursework assignments. Therefore, to complete the best APA nursing coursework, seek help from professional nursing coursework experts at instantnursingpapers.com