Solving allocation through cost minimization

54 Views Asked by At

I have limited knowledge when it comes to math notation so please excuse my crude example:

I am looking to allocate a number of units into boxes in a way that minimizes a total cost. Boxes have a known (1) maximum they can hold, (2) a minimum they can hold (always non-negative but sometimes a value), and each box has a (3) cost per unit.

Example: I have a pile of units totaling 100 units that must be separated into n boxes ($x_1, x_2, x_3, ... x_n$).

Where number of boxes n = 3,

Constraints:

Known maximum number of units a box can hold ($x_1 \leq 45$, $x_2 \leq 45$, $x_3 \leq 50$).

Known minimum number of units a box can hold ($x_1 \geq 15$, $x_2 \leq 0$, $x_3 \leq 0$).

Known cost (C) associated with putting units into a box is ($c_{x_1}=1$, $c_{x_1}=2, c_{x_1}=3$).

Minimize: $y = \sum_{i=1}^n{(X_i*C_i)}$

or $y = x_1*c_{x_1} + x_2*c_{x_2} + x_3*c_{x_3}$

subject to the above constraints, to solve the units per box.

This example is simple enough to solve without any calculus but for more intimidating problems I am guessing one can use Lagrange optimization but I can't quite get over the hump of inequality constraints/using slack variables. How can I solve this?

Any help and/or easy to digest references for tackling this problem would be appreciated.