I'm currently trying to solve a problem. According to some people I know it's a linear programming problem, however, I've not had the course just yet.
Situation: At my warehouse we get different types of materials to craft the final product $r$. The production depends on how well you can manage the stock so that you won't run out of intermediate resources. I basically have to maximize crafting product $r$. In order to do so, I need to know how much I need to craft from each intermediate step. The final working code will provide me information on how much $gp$ and then $e$ I should craft.
To make one $r$, you need 150 $gp$ and 10 $e$. So I formulated my steps as follows:
$$r = 150 gp + 10 e$$ $$10 gp = 20 s$$ $$e = 50 gp + 10 s$$
Obviously you cannot craft more than your stock allows you to, so I am upperbound by my stock. This stock is variable every cycle I need it, as the stock constantly changes.
$$s \leq 500000$$
$$gp \leq 11866$$
$$e \leq 1107$$
Also said stock cannot be negative as it is a real problem.
For visualization I've attached a diagram to see what the relations are between each resource.
I've found a function in MATLAB that should be able to be able to solve my problem.
[X,Z] = linprog(f,A,b,Aeq,beq,lb,ub)
I know I need to set up an objective function to maximize/minimize over, and I need to replace the variables with $x_1 ... x_n$. However, I don't know how to tackle it right at the moment.