# dynamic programming

This spring I want to plant a garden on a 10x20 feet of land. The rows are each 10 feet long. I want to plant tomatoes, corn and green beans. The corn and tomatoes rows will be 2 feet wide each. The green beans will each be 3 feet wide. On a scale of 1 to 10 (10 being the best) I would place tomatoes at 10, corn at 7, and beans at 3. My preferences however are irrelevant to my spouse. My spouse insists that no more than two rows of tomatoes be planted; and at least one row of beans be planted. Use dynamic programming to determine how many rows of each should be planted.

This is my attempt to set up the problem, but I don't think it is right, because I keep going in circles when I try to solve:

Let tomatoes be x1, corn x2 and green bean be x3

Problem formulation:

Â© BrainMass Inc. brainmass.com December 24, 2021, 4:56 pm ad1c9bdddfhttps://brainmass.com/math/optimization/dynamic-programming-function-16970

## SOLUTION This solution is **FREE** courtesy of BrainMass!

See the attached file. My formulation is in blue.

This spring I want to plant a garden on a 10x20 feet of land. The rows are each 10 feet long. I want to plant tomatoes, corn and green beans. The corn and tomatoes rows will be 2 feet wide each. The green beans will each be 3 feet wide. On a scale of 1 to 10 (10 being the best) I would place tomatoes at 10, corn at 7, and beans at 3. My preferences however are irrelevant to my spouse. My spouse insists that no more than two rows of tomatoes be planted; and at least one row of beans be planted. Use dynamic programming to determine how many rows of each should be planted.

This is my attempt to set up the problem, but I don't think it is right, because I keep going in circles when I try to solve:

Let tomatoes be x1, corn x2 and green bean be x3

Problem formation:

Variables : x1 = rows of tomatoes

X2 = corns

X3 = beans

Objective Function: Max Z = ( 10X1 + 7 X2 + 3X3) st:

2X1 + 3X2+3X3 <= 20 ( area constraint)

X1 <=2

X3>=1

X1,X2,X3>=0.

Note: Objective Function is based on your preferences ( that's why the scale of 1-10 is given.) Objective is to maximize the points.

Â© BrainMass Inc. brainmass.com December 24, 2021, 4:56 pm ad1c9bdddf>https://brainmass.com/math/optimization/dynamic-programming-function-16970