We propose a mathematical formalism with which we compare three organization
schemes for discrete production: manual, with robots produced outside a facility, and with
robots produced on the same facility (self-replication). For each of the three schemes, we
consider production conditions that presume perfect production (the probability of correctly
performing a technological operation equals 1) and stochastic production (all technological
operations during production are correctly performed with probability less than one). We solve
the problem of finding the optimal level of automation for this production that would minimize
human intervention in the production process for various schemes of production. We show
that including a feedback with respect to the ready product (self-replication) may lead to an
additional decrease in production cost.