PurposeThe purpose of this paper is to consider various possible constraints of the problem of production and maintenance planning control for a multi-machine under subcontracting constraint, in order to bring the manufacturer industry closer to real mode. In this paper, we present an efficient and feasible optimal solution, by comparing optimization procedures.Design/methodology/approachOur manufacturing system is composed of parallel machines producing a single product, to satisfy a random demand under a given service level. In fact, the demand is greater than the total capacity of the set of machines; hence there rises a necessity of subcontracting to complete the missing demand. In addition, we consider that the unit cost of subcontracting is a variable depending on the quantity subcontracted. As a result, we have developed a stochastic optimal control model. Then, to solve the problem we compared three optimization methods: (exact/approximate), the genetic algorithm (GA), the Pattern Search (PS) and finally fmincon. Thus, we validate our approach via a numerical example and a sensitivity analysis.FindingsThis paper defines an internal production plan, a subcontracting plan and an optimal maintenance strategy. The optimal solution presented in this paper significantly improves the ability of the decision maker to consider larger instances of the integrated model. In addition, the decision maker can answer the following question: Which is the most optimal subcontractor to choose?Practical implicationsThe approach developed deals with the case of the real-mode manufacturing industry, taking into consideration different constraints and determining decision variables which allow it to expand the profits of the manufacturing industry in different domains such as automotive, aeronautics, textile and pharmacies.Originality/valueThis paper is one of the few documents dealing with the integrated maintenance in subcontracting constraint production which considers the complex aspect of the multi-machine manufacturing industry. We also dealt with the stochastic aspect of demand and failures. Then, we covered the impact of the unit cost variation of subcontracting on the total cost. Finally, we shed light on a comparison between three optimization methods in order to arrive at the most optimal solution.