An Application of Stochastic Programming in Solving Capacity Allocation and Migration Planning Problem under Uncertainty

The semiconductor packaging and testing industry, which utilizes high-technology manufacturing processes and a variety of machines, belongs to an uncertain make-to-order (MTO) production environment. Order release particularly originates from customer demand; hence, demand fluctuation directly affects capacity planning. Thus, managing capacity allocation is a difficult endeavor. This study aims to determine the best capacity allocation with limited resources to maximize the net profit. Three bottleneck stations in the semiconductor packaging and testing process are mainly investigated, namely, die bond (DB), wire bond (WB), and molding (MD) stations. Deviating from previous studies that consider the deterministic programming model, customer demand in the current study is regarded as an uncertain parameter in formulating a two-stage scenario-based stochastic programming (SP) model. The SP model seeks to respond to sharp demand fluctuations. Even if future demand is uncertain, migration decision for machines and tools will still obtain better robust results for various demand scenarios. A hybrid approach is proposed to solve the SP model. Moreover, two assessment indicators, namely, the expected value of perfect information (EVPI) and the value of the stochastic solution (VSS), are adopted to compare the solving results of the deterministic planning model and stochastic programming model. Sensitivity analysis is performed to evaluate the effects of different parameters on net profit.


Introduction
The semiconductor packaging and testing industry belongs to a flow line environment.The operating procedure of this industry indicates that the die bond (DB), wire bond (WB), and molding (MD) stations are the three bottleneck stations in the manufacturing process.Consequently, capital expenditure on equipment for the DB, WB, and MD stations results in high purchasing cost.In machine utilization, the limitations of machine type and product category affect the output per hour.Given the multifactory and multiline environment of this industry, demand uncertainty and inappropriate production planning result in wasteful or insufficient machine capacity in all lines.Therefore, this research investigates the DB, WB, and MD stations in the semiconductor packaging and testing industry as the objects of the study.
The best resource configuration and capacity allocation decision in the semiconductor packaging and testing industry can effectively utilize all resources in all production lines, as well as assisting planners in reducing the readjustment of the production scheduling to efficiently accomplish order allocations as a response to substantial changes in demand.Such decision can also indirectly reduce the migration cost of machines and tools.Therefore, this study aims to investigate the capacity allocation and migration planning problem by considering demand uncertainty to solve the current problems and challenges faced by the semiconductor packaging and testing industry.
The importance of capacity planning to semiconductor packaging and testing industry is discovered based on the aforementioned background and motivation.Thus, the current study aims to attempt capacity allocation and resource configuration planning at the same time for multiperiod order demands, to improve the current capacity plan being separately implemented by packaging and testing factories and consideration of a single period and to determine the proper machine migration and capacity allocation decision.

Mathematical Problems in Engineering
Demand in packaging and testing factories fluctuates because of different limitations in capacity planning and the make-to-order (MTO) production environment.Therefore, deviating from previous studies that consider the deterministic programming model, the current study employs demand as an uncertain factor to solve the problem through a twostage stochastic programming (SP) model.The feasibility of the capacity planning method proposed in this study is also demonstrated through a practical case study.Moreover, based on the different parameters change, sensitivity analysis for the stochastic programming model is provided, to understand if capacity planning will be affected by different scenarios, demands, migration costs of machines and tools, sale prices of products, flexibility of capacity migration, and other factors.
This paper is organized as follows.Section 2 reviews the related literature.Section 3 establishes the definition of the capacity planning problem of the semiconductor packaging and testing industry, as well as the development of a two-stage stochastic programming model and the proposed hybrid approach.Section 4 discusses the application and analysis of a certain large-scale semiconductor packaging and testing factory case.Section 5 provides the conclusion of this study.

Overview of the Semiconductor Packaging and Testing
Industry Characteristics.Semiconductor products currently comprise four categories, namely, integrated circuit (IC), discrete, sensor, and optoelectronics.However, this study aims to investigate the IC category.The IC manufacturing process with vertical integration features has front-and backend processes.The upstream to downstream processes of the target industry cover the following five steps: IC design, mask making, IC making, chip packaging, and chip testing.
The manufacturing process and production characteristics of the semiconductor packaging and testing industry are described as follows.
2.1.1.Make to Order.The semiconductor packaging and testing industry prepares materials based on orders placed by customers.Thereafter, production proceeds based on customers' needs and services, thereby preventing the industry from predicting the demand in advance.Furthermore, demand forecasting for this industry cannot be learned from past experience.Accordingly, this study considers the demand to be uncertain and expresses fluctuations in customer needs through different scenarios.This consideration will avoid insufficient or wasted capacity during the production while addressing customer needs and maximizing net profit.
The production in the IC packaging and testing industry is customer-oriented.Product categories are diversified based on different customer needs.Packaging types can be divided into lead frame package, ball grid array, flip chip, system in package, and multichip packages.Moreover, each packaging type is divided into various product types because of the use of different chip sizes or pin numbers.Product types also have different capacity constraints.

Flow Shop.
In an IC packaging and testing factory, an order is often divided into several work orders.Figure 1 shows that each work order is manufactured based on the production flow.Meanwhile, IC packaging and testing factories have multiple production lines.For example, a certain large-scale domestic packaging and testing factory has approximately 25 lines.This study only investigates the bottleneck stations in these factories, namely, the DB, WB, and MD stations.It is described as a flow shop production environment.Thus, products will enter the WB station after leaving the DB station.After the products are processed in the WB station, they eventually enter the MD station.Therefore, products have sequential dependencies in the factory area.

Unrelated Parallel Machine.
Given the rapid manner by which products are updated, process changes and equipment upgrade will compel semiconductor packaging and testing factories to frequently purchase new or different brands of machines to respond to market changes.Having different machine types and brands leads to the presence of different grades of machines in the production line, thereby resulting in the production pattern of unrelated parallel machines.When managements arrange orders, they exert effort to satisfy customer needs and meet the maximal service level.In addition, they manufacture by utilizing machines with the highest capacity.Hence, they first move the machines and allocate the proper machines in groups to avoid failure in production caused by inconsistencies in machine types.Most machines for the semiconductor packaging and testing industry are movable.For domestic IC packaging and testing factories, the number of moving machines reaches approximately 60 each month.[1] indicate that capacity planning can be described as an iterative process between the following two main components: (1) capacity expansion: given projected product demands, identify the required manufacturing technologies and their capacity levels to be physically expanded or outsourced through the planning period; (2) capacity configuration: determine which facility is to be configured with which technologies mix.The overall objective is to meet a revenue model based on strategic demand planning (which blends demand forecasting and proactive market development strategies).This objective can be viewed as meeting projected demands with minimized total costs.

Capacity Planning. Karabuk and Wu
Chen et al. [2] present a capacity allocation and expansion problem of thin film transistor liquid crystal display (TFT-LCD) manufacturing in the multisite environment.The objective is to simultaneously seek an optimal capacity allocation plan and capacity expansion policy under singlestage, multigeneration, and multisite structures.Capacity allocation decides on profitable product mixes and allocated production quantities of each product group at each production site.Capacity expansion is concerned with determining the timing, types, and sizes of capacity investments, especially in the acquisition of auxiliary tools.A mixed integer linear programming (MILP) is proposed, which considers many practical characteristics.Finally, an industrial case study modified from a Taiwanese TFT-LCD manufacturer is illustrated and sensitivity analysis of some influential parameters is also addressed.The foundry is an industry whose demand varies rapidly and whose manufacturing process is quite complicated.Chen et al. [3] explore issues on midterm capacity planning for an increment strategy of the number of auxiliary tools-"photo mask" to increase the flexibility of production.The related decisions include how to allocate appropriately the forecast demands of products among multiple sites and how to decide on the production quantities of products in each site after receiving customer-confirmed orders.By constructing the mathematical programming model of capacity planning, the rates of capacity utilization and customer order fulfillment are found to be effectively enhanced by adding new masks to increase production flexibility.
Lin et al. [4] study strategic capacity planning problems under demand uncertainties in TFT-LCD industry.Demand forecasts are usually inaccurate and vary rapidly over time.Their research objective is to seek a capacity allocation and expansion policy that is robust to demand uncertainties.Special characteristics of TFT-LCD manufacturing systems are considered.A scenario-based two-stage stochastic programming model for strategic capacity planning under demand uncertainties is proposed.Comparing to the deterministic approach, their stochastic model significantly improves system robustness.
Lin et al. [5] refer to capacity planning as the process of simultaneously implementing a robust capacity allocation plan and capacity expansion policy across multiple sites against stochastic demand.Their study constructs a stochastic dynamic programming (SDP) model with an embedded linear programming (LP) to generate a capacity planning policy as the demand in each period is revealed and updated.Numerical results are illustrated to prove the feasibility and robustness of the proposed SDP model.

Stochastic Programming.
Given that demand uncertainty is considered, this paper aims to formulate a stochastic programming model for solving capacity allocation and migration planning problem.Dantzig [6] divided stochastic programming into two types: two-stage stochastic programming and multistage stochastic programming.Uribe et al. [7] indicated that the decision variable of two-stage stochastic programming consists of two types: "here and now" and "wait and see."Here and now decision in the first stage refers to decision making when all information is unknown.Wait and see decision in the second stage refers to decision making after all information has been fully revealed.Thus, decision variables for the two-stage stochastic programming are a dependent issue, and the results are more robust.
Two-stage stochastic programming can be illustrated through a scenario tree.Figure 2 shows that the time point revealing uncertain factors is  = .The time point is used to divide decisions into two stages.The first-stage decision is from  = 1 to  = .The results affect the decisions after  =  + 1.Thus, they extend many branches.Moreover, each branch represents a kind of scenario and a group of decision variables in the second stage.
Listes ¸and Dekker [8] present a stochastic programming based approach by which a deterministic location model for product recovery network design may be extended to explicitly account for the uncertainties.They apply the stochastic models to a representative real case study on recycling sand from demolition waste in Netherlands.In Salema et al. [9] work, the design of a reverse distribution network is studied.A generalized model is proposed.It contemplates the design of a generic reverse logistics network where capacity limits, multiproduct management, and uncertainty on product demands and returns are considered.A mixed integer formulation is developed which is solved using standard B&B techniques.The model is applied to an illustrative case.
Lee et al. [10] propose a stochastic programming based approach to account for the design of sustainable logistics network under uncertainty.A solution approach integrating the sample average approximation scheme with an importance sampling strategy is developed.A case study involving a large-scale sustainable logistics network in Asia Pacific region is presented to demonstrate the significance of the developed stochastic model.Cardona-Valdés et al. [11] consider the design of a two-echelon production distribution network with multiple manufacturing plants, customers, and a set of candidate distribution centers.The main contribution of the study is to extend the existing literature by incorporating the demand uncertainty of customers within the distribution center location and transportation mode allocation decisions, as well as providing a network design satisfying both economical and service quality objectives of the decision-maker.
In Kara and Onut [12] study, a two-stage stochastic revenue-maximization model is presented to determine a long-term strategy under uncertainty for a large-scale realworld paper recycling company.This network design problem includes optimal recycling center locations and optimal flow amounts between the nodes in the multifacility environment. .The proposed model is formulated with two-stage stochastic mixed integer and robust programming approaches.Pishvaee et al. [13] develop a stochastic programming model for an integrated forward/reverse logistics network design under uncertainty.An efficient deterministic mixed integer linear programming model is developed for integrated logistics network design to avoid the suboptimality caused by the separate design of the forward and reverse networks.Then the stochastic counterpart of the proposed MILP model is developed by using scenario-based stochastic approach.Numerical results show the power of the proposed stochastic model in handling data uncertainty.
In Amin and Zhang [14], a closed-loop supply chain network is investigated which includes multiple plants, collection centers, demand markets, and products.A mixed integer linear programming (MILP) model is proposed that minimizes the total cost.The model is extended to consider environmental factors by weighed sums and constraint methods.In addition, the impact of demand and return uncertainties on the network configuration is analyzed by scenario-based stochastic programming.Computational results show that the model can handle demand and return uncertainties, simultaneously.
Ramezani et al. [15] present a stochastic multiobjective model for forward/reverse logistic network design under an uncertain environment including three echelons in forward direction (i.e., suppliers, plants, and distribution centers) and two echelons in backward direction (i.e., collection centers and disposal centers).The authors demonstrate a method to evaluate the systematic supply chain configuration maximizing the profit, customer responsiveness, and quality as objectives of the logistic network.Mohammadi Bidhandi and Rosnah [16] propose an integrated model and a modified solution method for solving supply chain network design problems under uncertainty.The stochastic supply chain network design model is provided as a two-stage stochastic programming.The main uncertain parameters are the operational costs, the customer demand, and capacity of the facilities.In the improved solution method, the sample average approximation technique is integrated with the accelerated Benders' decomposition approach to improvement of the mixed integer linear programming solution phase.
Sazvar et al. [17] develop a stochastic mathematical model and propose a new replenishment policy in a centralized supply chain for deteriorating items.In this model, they consider inventory and transportation costs, as well as the environmental impacts under uncertain demand.The best transportation vehicles and inventory policy are determined by finding a balance between financial and environmental criteria.A linear mathematical model is developed and a numerical example from the real world is presented to demonstrate its applicability and effectiveness.Lin et al. [5] construct a stochastic dynamic programming model with an embedded linear programming to generate a capacity planning policy as the demand in each period is revealed and updated.Using the backward induction algorithm, the model considers several capacity expansion and budget constraints to determine a robust and dynamic capacity expansion policy in response to newly available demand information.Numerical results are also illustrated to prove the feasibility and robustness of the proposed SDP model compared to the traditional deterministic capacity planning model currently applied by the industry.
A distributed energy system is a multi-input and multioutput energy system with substantial energy and economic and environmental benefits.The optimal design of such a complex system under energy demand and supply uncertainty poses significant challenges.Zhou et al. [18] propose a two-stage stochastic programming model for the optimal design of distributed energy systems.A two-stage decomposition based solution strategy is used to solve the optimization problem with genetic algorithm performing the search on the first-stage variables and a Monte Carlo method dealing with uncertainty in the second stage.Detailed computational results are presented and compared with those generated by a deterministic model.
One of the most challenging issues for the semiconductor testing industry is how to deal with capacity planning and resource allocation simultaneously under demand and technology uncertainty.In addition, capacity planners require a tradeoff among the costs of resources with different processing technologies, while simultaneously considering resources to manufacture products.The study of K.-J.Wang and S.-M.Wang [19] focuses on the decisions pertaining to (i) the simultaneous resource portfolio/investment and allocation plan, (ii) the most profitable orders from pending ones in each time bucket under demand and technology uncertainty, and (iii) the algorithm to efficiently solve the stochastic and mixed integer programming problem.The authors develop a constraint-satisfaction based genetic algorithm to resolve the above issues simultaneously.
Dynamic programming approach is a class of optimal design tools, such as reinforcement learning.Liu et al. [20] proposed an online reinforcement learning algorithm for a class of affine multiple input and multiple output (MIMO) nonlinear discrete-time systems with unknown functions and disturbances.Liu et al. [21] addressed an adaptive fuzzy optimal control design for a class of unknown nonlinear discrete-time systems.The controlled systems are in a strictfeedback frame and contain unknown functions and nonsymmetric dead-zone.Wang et al. [22] developed a finitehorizon neurooptimal tracking control strategy for a class of discrete-time nonlinear systems.Chen et al. [23] studied an adaptive tracking control for a class of nonlinear stochastic systems with unknown functions.Tong et al. [24] proposed two adaptive fuzzy output feedback control approaches for a class of uncertain stochastic nonlinear strict-feedback systems without the measurements of the states.
Previous studies have surveyed about capacity planning issue, but only a few studies have focused on the capacity allocation problem considering machine/tool migration planning and demand uncertainty simultaneously.This paper aims to determine the best capacity allocation with limited resources to achieve net profit maximization in the semiconductor packaging and testing industry.Customer demand is regarded as an uncertain parameter in formulating a twostage scenario-based stochastic programming model.This model seeks to respond to sharp demand fluctuations.Even if future demand is uncertain, migration decision for machines and tools will still obtain better robust results for various demand scenarios.Sensitivity analysis is also performed to evaluate the effect of different parameters on net profit.

Capacity Planning of the Semiconductor
Packaging and Testing Industry

Characteristics of Capacity Planning of the Semiconductor
Packaging and Testing Industry.This study aims to determine machine migration, tool migration in all production lines, resource configuration, capacity allocation, and product flow under demand uncertainty to achieve net profit maximization.

Resource Configuration.
The manufacturing process entails that a product should sequentially go through the DB, WB, and MD stations for assembly-line production.The product considers the machine type in resource configuration during the DB and WB stages.However, three resources, namely, machine type, tool type, and material category, are considered in the MD stage.Figure 3 shows that product 1 is manufactured in machine 1 or 2 in the DB station.This product is then processed in machine 2 or 3 in the WB station.Thereafter, the product is manufactured in the MD station through 1 + 1 + 4 or 2 + 2 + 4.

Product Flow.
This study disregards defective products and only considers production through the three sequential stages.Moreover, product flow balance must be maintained in the production line.Hence, the total product input must equal the final total output.For example, the product input for product 1 is 1,000 units.Furthermore, 400 and 600 units are produced in lines 1 and 2, respectively.After production through the three sequential stages, the final total output remains as 1,000 units.

Capacity Allocation.
The capacity planning of all received orders is executed based on the current existing resources in all production stages.A product is not limited to the same production line during the entire production process; that is, a product can be manufactured in the different lines through three production stages.For example, a company has two lines, if the input of product 1 is 1,000 units.Take line 1 for explanation.Firstly, 400 units are manufactured in the DB station using machine 1 and 600 units using machine 2.Thereafter, 400 units are manufactured in the WB station using machine 2 and 200 units using machine 3.Finally, 200 units are manufactured in the MD station using resource configuration 1 + 1 + 4 and 300 units using 2 + 2 + 4.Thus, 500 units of product 1 can be made after the three production stages for this product are completed sequentially in line 1.The remaining 500 units are allocated to all production stages in line 2 for manufacturing.

Machine and Tool Migration.
The presence of several production lines and machines with different technological capability in a company will result in variations in the production capacities of all lines.Machines can be moved to all lines in each production stage, and tools can be moved to all lines in the MD stage based on the total number of available machines and tools.This study aims to respond to sharp demand fluctuation.Even if future demand is uncertain, machine and tool migration decisions are robust results for all demand scenarios.

Definition and Description of Capacity Planning Problem under Demand
Uncertainty.This study uses a scenario tree to illustrate the uncertain factor (Figure 4).Machine and tool migration decisions are deemed to be the decisions made in the first stage.The results of these decisions remain constant with the varying customer demands.Moreover, the secondstage capacity allocation decisions must be made based on the first-stage decision results.The results in the secondstage change with the varying customer demands.In this study, two-stage decisions should be optimally determined to achieve net profit maximization. (

1) First-Stage Decision: Robust Capacity Migration Decision
That Considers Demand Uncertainty.Given three demand scenarios, each type of machine and tool is considered to determine when and what quantity of machines and tools are migrated between lines in the production stage.Hence, capacity migration decision must be made in advance to consider the robust decision under demand uncertainty as being unrelated to different demand scenarios.
(2) Second-Stage Decision: Capacity Allocation Decision after All Demand Information Has Been Completely Revealed.The following factors are determined after a certain demand scenario occurs: (1) production quantity for each product in each line in all production stages during each period, (2) transportation quantity between the different production stages, (3) sales volume of each product in each period for each customer, and (4) customer service level.Therefore, capacity allocation decision is closely related to the demand scenario.According to the capacity migration result in the first stage, the optimal capacity allocation decision can be determined once a specific demand scenario occurs.

Two-Stage Stochastic Programming Model of Capacity
Planning Problem.To solve the capacity planning problem under demand uncertainty, this study uses two-stage stochastic programming to construct a mathematical model.This section explains the indices, parameters, decision variables, objective function, and constraints.
Constraint (2) shows the initial amount of machines in lines at each production stage; and constraint (3) indicates the number of machines required for lines at production stages in every period.This number of machines in the current period is equal to the number of machines in the previous period minus the number of machines moving to other lines plus Mathematical Problems in Engineering the number of machines that migrated from other lines to this line.The total initial number of machines within the company must be equal to the total number of machines after being migrated between lines without increasing or reducing the number of machines.Constraint (4) expresses that the allocated number of machines should not be more than the available space in the shop-floor production line.In addition, constraint (5) considers if machines have capability to be migrated between lines.    refers to a binary parameter.1 means machines can be migrated between production lines, and 0 means they cannot be migrated.
Constraint (6) shows the initial amount of tools in lines at each production stage; and constraint (7) indicates the number of tools required for lines at production stages in every period.This number of tools in the current period is equal to the number of tools in the previous period minus the number of tools moving to other lines plus the number of tools that migrated from other lines to this line.The total initial number of tools within the company must be equal to the total number of tools after being migrated between lines without increasing or reducing the number of tools.Constraint (8) expresses that the allocated number of tools should not be more than the available space in the shop-floor production line.In addition, constraint (9) considers if tools have capability to be migrated between lines.    refers to a binary parameter.1 means tools can be migrated between production lines, and 0 means they cannot be migrated.

(c) Domain Restriction for First-Stage Decision Variables.
Consider the following: Constraint (10) shows the domain of variables, which indicates the characteristics of its integer variables.
(II) Second-Stage Constraints (a) Production and Transportation Balance Constraints.Consider the following: Overall production and transportation must satisfy line flow balance, as shown in constraints (11) and (12).The allocated production amounts in a certain line at this stage should be equal to the total amounts that are transported from this line to all lines at the next stage.On the contrary, the total amounts that are transported from all lines at the previous stage to a certain line at the current stage should be equal to the allocated production amounts in this line.
(b) Capacity Constraints.Consider the following: For capacity constraints, constraints ( 13) and ( 14) indicate that the production amounts multiplied by work hours of machines or tools consumed should not exceed the number of machines or tools multiplied by available work hours of a unit of machine or tool.In short, the sum of work hours required for each product in available machine or tool should not be more than the total available resource limit of the company.
(c) Material Constraint.Consider the following: For material constraint (15), generally speaking, the amounts of materials to be consumed in the production process should not be beyond the quantity restriction of available materials.With limited resources, the production amounts multiplied by the material consumption ratio per unit will be less or equal to the total available quantity of the material.
(d) Production Capability Constraint.Consider the following: For production capability, constraint (16) shows whether resource configuration of a certain product is able to be used for manufacturing this product.Due to different types of machines and tools in lines at each production stage, not all resource configurations can be used for manufacturing all kinds of products.If   = 1, the resource configuration in the line at this stage can be used for manufacturing this type of product; on the contrary, if   = 0, they cannot be used.
For transportation capability, constraint (17) expresses whether there is transportation capability to move products from the current stage to the next stage.The production process is an assembly flow line environment.Thus, products are bound to go through each production stage in turn and cannot revert to a previous stage.If    (+1) = 1, there is transportation capability to move products between stages; on the contrary, if    (+1) = 0, it indicates that there is no transportation capability.
(f) Demand Fulfillment Constraints.Consider the following: Demand fulfillment is indicated by constraints ( 18) and ( 19), respectively.Constraint (18) shows that sales volume in each scenario should be equal to the total production amounts with resource configurations in all lines.Constraint (19) expresses that the sales volume must be less or equal to the demands required by customers.
(g) Service Level.Consider the following: Constraint (20) shows that the sales volume divided by customer demands is the service level.

Capacity Planning Problem under Demand Certainty.
Different from the uncertainty model, the deterministic model does not consider demand fluctuation and only considers an average demand scenario.Appendix A (see Supplementary Material available online at http://dx.doi.org/10.1155/2015/741329) shows the detailed mathematical programming model that is used to compare the differences in solving results between the deterministic model and stochastic programming model.

Proposed Hybrid Approach.
As the scenario number is increased, solving the scenario-based stochastic programming model becomes considerably difficult because of the computation complexity.Therefore, a hybrid approach is developed to efficiently address the proposed two-stage stochastic programming model.We apply the particle swarm optimization (PSO) method combined with the AIMMS optimal modeling software in a hybrid mechanism.First, an initial solution was generated to determine the migration number of machines and tools among the production lines.This result was entered into the AIMMS optimal modeling software with the ILOG CPLEX 12.6 solver to generate the optimal production amounts of products.The results are returned to the PSO algorithm to calculate the net profit and to determine whether the termination conditions have been satisfied.This study sets the termination condition as the number of generations.The search ends when the number of generations reaches the preset number of generations.If this number is reached, then the PSO algorithm is used to yield the optimal number of machines and tools of each line to the AIMMS optimal modeling software to generate the optimal production amounts of products.Fitness values are calculated during each generation.The PSO algorithm is repeated until the termination condition is satisfied.The PSO steps are stated as follows.
Step 1 (generation of an initial population).This study uses PSO to determine the migration number of machines and tools among the production lines.Given the initial number of machines and tools, an initial population is generated by randomly selecting the value limited to the available maximum number of machines and tools in each line.
Step 2 (calculation of the fitness values).The fitness value in this study is net profit.
Step 3 (updating the speed and position of the particle).Equations ( 22) and ( 23) are used to update the speed and position, using the following symbols: : iteration index,  = 1, 2, . . ., .
1 : personal best position acceleration constant.  (): position of the th particle at the th dimension in the th iteration.
(): velocity of the th particle at the th dimension in the th iteration.
(): personal best position of the th particle at the th dimension.
(): global best position at the th dimension.

Introduction to the Case
Background.This study aims to conduct a capacity allocation and migration planning for customer demands by considering a certain large-scale semiconductor packaging and testing factory as the case study.Three customers, eight types of products, and two production lines are involved in this case.The manufacturing process is divided into three bottleneck production stages, namely, the DB, WB, and MD stations in turn.Furthermore, the factory has three types of machines, four types of tools, and four categories of materials.The planning horizon covers four periods.For resource configuration, the DB and WB stations have three configurations consisting of machines.
The MD station has seven kinds of configurations consisting of machines, tools, and materials.Appendix B (see Supplementary Material) shows the related information necessary for this case study.

Capacity Planning Results
. The case problem is handled under demand uncertainty.The maximum net profit is $77,557,489.83for the stochastic programming model.Table 1 shows the number of machines for the lines in the production stages in each time period.Table 2 presents the migration number of machines between lines in each production stage in each time period.Table 3 indicates the number of tools for the lines in the MD stage in each time period.Table 4 presents the migration number of tools between lines in the MD stage in each time period.Table 5 expresses the sales amounts of products for each customer in each time period under different scenarios.

Expected Value of Perfect Information (EVPI) and Value of the Stochastic Solution (VSS)
. WS stands for "wait and see"; thus the decision-maker must wait for all information to be revealed before making a decision.The objective is to maximize the net profit.The solution obtained through the deterministic model with average demand is called the expected value (EV) solution.Through the EV solution, the individual objective values of all demand scenarios can be obtained.Thereafter, these objective values are multiplied by the occurring probability of the corresponding scenario to obtain the expected value, namely, the expected result of using the EV solution (EEV).The "here and now" type indicates the maximized net profit value of stochastic programming, which is called SP.For the capacity allocation and migration planning problem in this study, the solving result through SP under uncertainty is compared with the deterministic model.Two indicators, namely, expected value of perfect information (EVPI) and value of the stochastic solution (VSS), are used for analysis.
The optimal objective value of the stochastic programming model is compared with the expected value of the WS solutions.The latter is calculated by determining the optimal solution for each possible realization of the demand scenarios with certainty.Clearly, it is better to know the value of the future actual demand before making a decision than having to make the decision before knowing.The difference between these two expected objective values is called EVPI.Furthermore, EVPI measures the maximum amount a decision-maker would be willing to pay in return for complete (and accurate) information about the future to solve uncertainty.Thus, EVPI is defined in (24).If EVPI is smaller, the stochastic programming result is closer to the result obtained with complete information.By contrast, if EVPI is larger, the influence of uncertain factors is greater and the price paid for obtaining complete information is considerably high: VSS is used to measure the ability of the stochastic programming model to increase net profit, with the attempt to solve uncertain factors.It is the difference between the solution of the SP model and the expected value of the objective function when fixing parameters to average values and using the corresponding optimal solution.Thus, VSS is defined in (25).VSS conveys to us how much we can gain 2 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 2 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 2 0 0 0 If VSS is larger, the SP result is better than the expected result when using the EV solution obtained by replacing all possible demands with their average values: The related measurements for the case problem in this study are showed in Table 6.

Net Profit Fluctuation under Different Combinations of
Probability.Different probability combinations are designed to investigate whether the occurring probability of all demand scenarios affects the net profit.The combined design individually provides significantly high probability values to low, mean, and high demand scenarios.Table 7 shows that the capacity planning results under all probability combinations indicate that net profits using the SP model are higher than those using the deterministic model.Moreover, if the occurring probability of low demand scenario is 0.8, then its net profit is significantly lower than that of the mean demand or high demand scenario, which possesses an occurring probability of 0.8.Therefore, the occurring probability of the scenario is positively related to the demand of each corresponding scenario; that is, determining the occurring probability of scenario is highly important when using the SP model.

Changes in EVPI and VSS under Different
Probability Combinations.The current study analyzes whether the occurring probabilities of all demand scenarios have an effect on EVPI and VSS.Accordingly, several probability combinations of demand scenarios are designed, including the probability combination with considerably high occurring probability of specific demand scenario.EVPI and VSS under different probability combinations are shown in Table 8.
Figure 5 shows that when the probability combination is (0.1, 0.1, 0.8), the net profit gap between the deterministic model and SP model is $50,569.Moreover, the decision-maker is willing to pay $900 in return for the complete information on future uncertainty.Hence, when the occurring probability of high demand is higher, EVPI is lower.Specifically, the solving result of net profit under complete (perfect) information is closer to the decision made by the SP model.Similarly, if VSS is higher, then the obtained benefit from the SP model is better.and deterministic model can be calculated (Table 9).It also can be found from Figure 6 that the gap in net profit will increase with the increase of demand variation.Thus, the SP model considers demand uncertainty, and its result is better than that of the deterministic model, which only considers average demand.

Effect of Demand Change on Machine and Tool Migration and Net
Profit.Demand change is the primary problem discussed in this study.The semiconductor packaging and testing industry cannot accurately forecast the actual demand of customers.If the demand change constantly shows positive growth or a substantial negative reduction, then the twostage SP model will significantly respond to considerable demand change compared to the deterministic model.Hence, when the actual demand is lower, capacity waste can be reduced.By contrast, when the actual demand is higher, capacity shortage can be avoided.For the case company in this study, the increasing demand results in the continuous improvement in net profit because of the demand growth.However, the number of machine and tool migrations is unaffected by demand change; as demand decreases, net profit and the number of machine and tool migrations are reduced as demand is decreased.Doing so can avoid unnecessary migration costs, as shown in Tables 10 and 11.

4.4.2.Effect of Changes in Unit Migration Cost on Machine/Tool
Migration and Net Profit.The unit migration cost affects moving times.When the unit migration cost is more expensive, it significantly increases the total migration cost, thereby lowering the net profit.When the unit migration cost is considerably inexpensive, frequent machine/tool migrations and production amounts of products may increase, thereby increasing the net profit.For the case company in this study, when the unit migration cost starts to increase, the net profit will decrease, and the number of machine/tool migrations will also decrease.When the unit migration cost is down, the net profit will increase.However, the number of machine/tool migrations remains constant, as shown in Tables 12 and 13.

Effect of Sales Price Fluctuation on Machine and Tool
Migration and Net Profit.The sales price of products affects net profit.If sales price is higher, then the net profit increases.By contrast, if sale price is down, then the net profit decreases.When sales price is higher, salesmen will attempt to address the customer needs and provide higher service level; when sales price is lower, they cannot completely meet the customer promise needs, thereby resulting in the occurrence of short supply, which lowers service level.Thus, a better balanced decision must be determined between sales revenue and production/migration costs.For the case company in this study, as shown in Tables 14 and 15, when sales price is raised, the net profit increases and machine/tool migration decisions are not affected; on the contrary, when the sales price is lowered, the net profit decreases and machine/tool migration amounts are also reduced because of low sales price.

Effect of Migration Capability on Machine and Tool
Migration and Net Profit.Given that capacity allocation decisions are made, several products may not be manufactured because of the limited flexibility of machine and tool migration.Production capacity cannot be allocated flexibly between different production lines.Without migration capability limitation, all machines and tools become movable, which is advantageous to the adjustment of capacity.By contrast, if the flexibility of migration is limited, then adjusting to a considerably high capacity level is difficult, thereby decreasing net profit, as shown in Table 16.Moreover, the number of machine migrations increases as migration flexibility opens.

Conclusion
This study considers a certain large-scale semiconductor packaging and testing factory to address capacity allocation and migration planning problems under demand uncertainty.The planning scope includes three bottleneck stations, namely, the DB, WB, and MD stations.Moreover, the twostage stochastic programming approach is applied and its mathematical model is formulated to solve this problem.Machine and tool migration decisions are deemed to be the first-stage decision.The second-stage decision is capacity allocation, which can be solved once the uncertain factors are revealed.Hence, when demand is changed, machine and tool migration decisions remain to be a better robust result.The measuring indicators, EVPI and VSS, are applied to evaluate the SP model and the deterministic EEV model.SP obtains a better net profit than EEV; the VSS values obtained are positive.Thus, the two-stage SP model proposed in this study can indeed improve the deficiencies of the traditional deterministic model.Furthermore, decision-makers can make good use of sensitivity analysis results as reference.This paper can assist the semiconductor packaging and testing factory in simultaneously conducting capacity allocation and resource configuration planning with the use of existing resources.Moreover, the two-stage SP method determines a robust machine and tool migration decision in advance as a response to future fluctuating demand.This model can also obtain the optimal capacity allocation and migration planning decision.It is closer to actual industry application and reaches the economic target of semiconductor packaging and testing industry, namely, meeting customer needs and maximizing net profit.

Figure 1 :
Figure 1: Production flow of semiconductor packaging and testing factory.
Problem for the Semiconductor Packaging and Testing Industry under Demand Uncertainty.A mathematical model of two-stage scenario-based stochastic programming is formulated by considering customer demand as an uncertain parameter.

Figure 4 :
Figure 4: Diagrammatic sketch of scenario tree of the uncertain factor.

( 2 ) 7 (
Parameters (I) Demand Related Parameters    = the demand quantity of customer  for product  in time  under scenario .  = probability value occurring in scenario  (∑    = 1).  = sales price of customer  for product  in time .(II) Machine Related Parameters   = initial amount of machine  in line  at stage .  = maximum number of machines in line  at stage .  = required work hours of machine  used at stage  for manufacturing a unit of product  with resource configuration .  = available work hours of machine  at stage .    = machine migration capability from lines  to   at stage .(III) Tool Related Parameters   = initial amount of tool  in line  at stage .  = maximum number of tools in line  at stage .  = required work hours of tool  used at stage  for manufacturing a unit of product  with resource configuration .  = available work hours of tool  at stage .    = tool migration capability from lines  to   at stage .Mathematical Problems in Engineering IV) Material Related Parameters   = total available quantity of material  at stage  in time .  = consumption ratio of material  for manufacturing a unit of product  at stage  with resource configuration .(V) Production Capability Related Parameter   = production capability of product  at stage  with resource configuration .(VI) Transportation Related Parameter    (+1) = transportation capability from line  at stage  to line   at stage  + 1. (VII) Cost Parameters V  = production cost for manufacturing a unit of product  in line  at stage  with resource configuration .  = machine migration cost at stage .  = tool migration cost at stage .

( 3 )
Decision Variables (I) First-Stage Decision Variables: Capacity Migration Decision   = the number of machines  for line  at stage  in time .    = the migration number of machines  from line  to line   at stage  in time .  = the number of tools  for line  at stage  in time .    = the migration number of tools  from line  to line   at stage  in time .(II) Second-Stage Decision Variables: Capacity Allocation Decision and Service Level    = production amounts of product  with resource configuration  for line  at stage  in time  under scenario .      (+1) = transportation amounts of product  from line  with resource configuration  at stage  to line   with resource configuration   at stage ( + 1) in time  under scenario .   = sales amounts of product  for customer  in time  under scenario .   = service level for customer  under scenario .

𝑐 2 :
global best position acceleration constant.(): the  of the  time.(): inertia weight in the th iteration.

Table 1 :
The number of machines for lines at production stages in each time period (  ).

Table 2 :
The migration number of machines between lines at each production stage in each time period (    ).

Table 3 :
The number of tools for lines at MD stage in each time period (  ).

Table 4 :
The migration number of tools between lines at MD stage in each time period (    ).

Table 5 :
The sales amounts of products for each customer in each time period under different scenarios (   ).

Table 6 :
The related measurements for the case problem.

Table 7 :
The related measurements for different probability combinations.
*The occurring probability of low demand, mean demand, and high demand scenarios, respectively.

Table 8 :
EVPI and VSS under different probability combinations.

Table 9 :
Comparison of net profit under demand variability.

Table 10 :
Changes in migration costs and net profit under positively growing demand.

Table 11 :
Changes in migration costs and net profit under negatively decreasing demand.

Table 12 :
Changes in migration decisions and net profit under the increased unit migration cost.

Table 13 :
Changes in migration decisions and net profit under the reduced unit migration cost.

Table 14 :
Changes in migration decisions and net profit under the increased sales price.

Table 15 :
Changes in migration decisions and net profit under the reduced sales price.

Table 16 :
Changes in migration decisions and net profit under different migration flexibility.