Product Mix Optimization Case Study - OPL/ CPLEX Code

11
© 2013 OptiRisk India (P) Ltd, All rights reserved Bala. Padmakumar Director & CEO OptiRisk India Ph: +91 98406 18472/ +91 44 4501 8472 Web: http://www.optiriskindia.com Email : [email protected]

description

Product Mix Optimization Case Study - OPL/ CPLEX Code

Transcript of Product Mix Optimization Case Study - OPL/ CPLEX Code

Page 1: Product Mix Optimization Case Study - OPL/ CPLEX Code

© 2013 OptiRisk India (P) Ltd, All rights reserved

Bala. PadmakumarDirector & CEOOptiRisk India

Ph: +91 98406 18472/ +91 44 4501 8472

Web: http://www.optiriskindia.comEmail : [email protected]

Page 2: Product Mix Optimization Case Study - OPL/ CPLEX Code

2© 2013 OptiRisk India (P) Ltd, All rights reserved

XYZ Chemical Ltd manufactures three chemicals, namely CH-A, CH-B, and CH-C. All three chemicals have to go through three processes namely MIXING, CONVERSION, and BAGGING. Each process has finite daily capacity, which are given in the below table. Each chemical requires different processing time, which are also given in the below table.

Process

Production minutes per Kg of product

Capacity of production in

minutes per dayCH-A CH-B CH-CMIXING

CONVERSION

BAGGING

2

3

1

2

1

4

1

1

0

400

450

390Contribution /Kg Rs. 30 Rs. 55 Rs. 23

The company can sell whatever it produces (there is no constraint on demand). The company’s management wants to find out how much of each chemical it should produce to maximize the contribution (profit).

Page 3: Product Mix Optimization Case Study - OPL/ CPLEX Code

3© 2013 OptiRisk India (P) Ltd, All rights reserved

Decision Variables:

= Number of Kgs of chemical p produced each day. p = 1, …, P

= Number of minutes per day available at process s.

ConstraintsConstraints

px

Constraints:

sC

= Number of minutes required by product p at production stage s. s = 1, …, S  = Profit per unit of product p

Parameters:

psa ,

pv

Objective Function:

z = Maximize total daily profit

Page 4: Product Mix Optimization Case Study - OPL/ CPLEX Code

4© 2013 OptiRisk India (P) Ltd, All rights reserved

∑=

P

ppp xv

1

∑=

≤P

pspps Cxa

1,

0≥px for p = 1, …, P=Max num of products

for s = 1, …, S=Max num of processes

Subject to:

Maximize z =Objective function

Maximize total contribution (profit)

Constraint

Process Capacity Constraints

Non negativity Constraint

Production quantity must be non negative

Page 5: Product Mix Optimization Case Study - OPL/ CPLEX Code

5© 2013 OptiRisk India (P) Ltd, All rights reserved

Subject to:

Maximize z =Objective function

Maximize total contribution(profit)

Constraint

Process Capacity Constraints

Non negativity Constraint

Production quantity must be non negative

321 22 xxx ++

3213 xxx ++

21 4xx +

0,0,0 321 ≥≥≥ xxx

321 235530 xxx ++

≤ 400

≤ 450

≤ 390

Page 6: Product Mix Optimization Case Study - OPL/ CPLEX Code

Objective function

Maximize Contribution

6© 2013 OptiRisk India (P) Ltd, All rights reserved

/********************************************* * OPL 12.5 Model * Author: OptiRisk * Creation Date: 27-Aug-2013 at 10:02:32 AM *********************************************/ // Input - indices {string} Chemicals = ...; {string} Processes = ...; // Input parameters float Capacity[Processes] = ...; float ProcessTime[Chemicals][Processes] = ...; float Contribution[Chemicals] = ...;

// Decision Variable // Production Quantity of each Chemical dvar float+ ChemicalQty[Chemicals];

// Objective Function // Maximize total contribution maximize sum( p in Chemicals ) Contribution[p] * ChemicalQty[p];

Input Parameters

Decision Variables

Page 7: Product Mix Optimization Case Study - OPL/ CPLEX Code

Post Processing

Print Results

Constraint

Capacity Constraint

// Constraints // 1. Capacity Constraints subject to { forall( s in Processes ) ctCapacity: sum( p in Chemicals ) ProcessTime[p][s] * ChemicalQty[p] <= Capacity[s];}

// Post processing to print results.execute {

writeln("Maximum Contribution Possible = Rs. ",cplex.getObjValue());

writeln("\n----- RESULT: Optimal Product Mix---------");

// Print the optimal product quantities.for( var p in Chemicals){ writeln(p, " ---> ", ChemicalQty[p], " Kgs"); }

writeln("\n---- END: Optimal Product Mix-------------");}

7© 2013 OptiRisk India (P) Ltd, All rights reserved

Page 8: Product Mix Optimization Case Study - OPL/ CPLEX Code

Input Data Parameters

Index

/********************************************* * OPL 12.5 Data * Author: OptiRisk * Creation Date: 27-Aug-2013 at 10:02:32 AM *********************************************/

Chemicals = {"CH-A","CH-B","CH-C"}; Processes = {"MIXING", "CONVERSION", "BAGGING"};

// Capacity in minutes of each process Capacity = [400, 450, 390]; // Processing time for each chemical, for every process ProcessTime = [[2,3,1],[2,1,4],[1,1,0]]; // Contribution (profit) for each chemical Contribution = [30, 55, 23];

8© 2013 OptiRisk India (P) Ltd, All rights reserved

Page 9: Product Mix Optimization Case Study - OPL/ CPLEX Code

9© 2013 OptiRisk India (P) Ltd, All rights reserved

// solution (optimal) with objective 10077.5Maximum Contribution Possible = Rs. 10077.5

----------- RESULT: Optimal Product Mix---------CH-A ---> 0 KgsCH-B ---> 97.5 KgsCH-C ---> 205 Kgs

----------- END: Optimal Product Mix-------------

// solution (optimal) with objective 10077.5Maximum Contribution Possible = Rs. 10077.5

----------- RESULT: Optimal Product Mix---------CH-A ---> 0 KgsCH-B ---> 97.5 KgsCH-C ---> 205 Kgs

----------- END: Optimal Product Mix-------------

Page 10: Product Mix Optimization Case Study - OPL/ CPLEX Code

10© 2013 OptiRisk India (P) Ltd, All rights reserved

Model Code

ResultsDebug

Project Explorer

Page 11: Product Mix Optimization Case Study - OPL/ CPLEX Code

Asia Pacific, Africa, Australia & Middle East:

Europe & America:

No 12, 25th Cross StreetThiruvalluvar Nagar , Thiruvanmiyur,Chennai –600041, India

OptiRisk R&D House, One Oxford, Uxbridge, Middlesex, UB9 4DA,United Kingdom

Bala. PadmakumarPh: +91 98406 18472 / +91 44 4501 8472

Email: [email protected]: http://www.optiriskindia.com/

11© 2013 OptiRisk India (P) Ltd, All rights reserved

Development Center: Corporate Head Quarters:

No 1/4 , Justice Dwarkanath Road,Kolkata - 700020, India.