I have a store Σ, which contains products (denoted by latin mayuscules) and components (denoted by greek minuscules). A product consists of a set of components (but not more than one of each distinct component). For instance:
A = {β, γ}, B = {α}, C = {α, β, γ}
A store contains both products and components:
Σ = {(10, A), (5, B), (20, β)}
(Meaning 10 items of A, 5 items of B and 20 items of β).
You can transform the store by disassembling a product, for instance by disassembling 2 items of C, {(10, C)} transforms into {(8, C), (2, α), (2, β), (2, γ)}.
You can transform the store by assembling a product, for instance by assembling 1 item of B, {(10, α), (10, β)} transforms into {(1, B), (9, α), (10, β)}.
Given an arbitrary store, and an amount n of a required product X, how can I determine the optimal sequence(s) of transformations needed, to obtain a store that contains (n, X)? A sequence is optimal if and only if there exists no other sequence which consists of less transformations.
I am not good at mathematical syntax, please do see my post about the same topic on SO.
EDIT
Dear Milcak
I tried your solution, but obviously I am doing something wrong. Let'say we have in store three products $A_1 = \{\alpha, \beta, \gamma\}$, $A_2 = \{\alpha, \gamma, \delta\}$ and $A_3 = \{\beta, \delta\}$. We need to extract one product $X = \{\alpha, \beta, \delta\}$. Now using your notation this would be: $$ X = (1, 1, 1) \\ A_1 = (1, 1, 0) \\ A_2 = (1, 0, 1) \\ A_3 = (0, 1, 1) $$
This gives the equation:
$$ \begin{pmatrix} 1 1 0 \\ 1 0 1 \\ 0 1 1 \end{pmatrix} \begin{pmatrix} z_1\\ z_2\\ z_3 \end{pmatrix} = \begin{pmatrix} 1 \\ 1 \\ 1 \end{pmatrix} $$
Which I think is the same as:
$$z_1 + z_2 = 1 \\ z_1 + z_3 = 1 \\ z_2 + z_3 = 1 $$
Now the solution is (hopefully) $Z = ( \frac 1 2 , \frac 1 2 , \frac 1 2 )$.
You say:
then pick $y_i$'s so that they are non-negative integers, and that their sum is minimized, which is equivalent to finding the closest integral lattice point to $z$ such that $y_i \ge z_i$ and $y_i \ge 0$ for all $i$.
This yields $Y = (1, 1, 1)$, but doesn't this means I need one of each of the $A_i$? Wouldn't the solutions be $(1, 1, 0)$, $(1, 0, 1)$ and $(0, 1, 1)$?
I am sure I misunderstood some parts of your answer. Could you please expand your answer, undoing my brain knots? Thank you very much.