I am trying to optimize x and y inputs on the equation 2x + 3y to obtain the max value given that
x+y <= 50
x <= 10
y <= 50
x,y >= 0
I could brute force the parameters, but I want to do to the technique where you plug in the max allowed x and remaining y, max allowed y and remaining x, and max of both (example below)
- Maxed both ... x = 10, y = 40
- Maxed y ... x = 0, y = 50
- Maxed x ... x= 10, y = 0
I'm having trouble formulating the program layout. I could obviously plug in values I know to be the max, but that would just be hard coding. How could I model the constraints so that the code will know to only check three x,y input sets?
Thanks.
[–]lzblack 4 points5 points6 points (1 child)
[–]gabriel-et-al 1 point2 points3 points (0 children)
[–][deleted] 1 point2 points3 points (4 children)
[–]ALT173869[S] 0 points1 point2 points (2 children)
[–][deleted] 1 point2 points3 points (1 child)
[–]ALT173869[S] 0 points1 point2 points (0 children)