# Maximize profit with dynamic programming

 -2 I have 3 tables… quantity, expense, profit 1, 2312, 3212  All equal structure but with different values and different number of rows. I want to write a recursive function describing the optimal choices of quantities in order to maximize my profit. I have a given amount to spend and the total expenses can't exceed this. Besides, I use the notation that p_nj should the profit in table n and quantity j and c_{nj} should express the cost of choosing quantity j in table n. I think it's something like f_n(A) = max{ p_nj + f_{n+1}(A-c_nj) } where A is the amount I can invest. My intuition is that I'm adding the profit p_nj for each iteration and subtracting the cost from the total available amount (A-c_nj). I don't think it's correct but I guess it's something like that. How can I iterate through all the three different tables with recursion? asked 28 Mar '15, 10:23 Orn 0●1 accept rate: 0% 5 I have a homework problem. I want to maximize my score while minimizing my effort. (28 Mar '15, 10:33) Mark L Stone Hey Mark. I've tried to give an answer to my homework problem but I'm stuck with a solution which I don't believe is correct, so now I'm asking for help. I think it's quite ok. (28 Mar '15, 17:19) Orn 2 @Orn: Unfortunately for you, Mark is correct. Answering homework is not allowed here because it wastes professional people's time and it is also against the code of academic integrity in many institutions. The best we could do for you is to guide you through the solution process. To achieve that, you might start by stating your own solution. Then, we could help you get on the right track. Please also note that the answers to these kind of questions are usually provided late in comparison to the regular non-homework questions. (29 Mar '15, 00:02) Ehsan ♦
Be the first one to answer this question!
 toggle preview community wiki

By Email:

Markdown Basics

• *italic* or _italic_
• **bold** or __bold__
• image?![alt text](/path/img.jpg "Title")
• numbered list: 1. Foo 2. Bar
• to add a line break simply add two spaces to where you would like the new line to be.
• basic HTML tags are also supported

Tags: