LP practice-1

pdf

School

Northeastern University *

*We aren’t endorsed by this school

Course

6230

Subject

Industrial Engineering

Date

Dec 6, 2023

Type

pdf

Pages

6

Uploaded by GrandExploration12563

Report
LP practice knitr::opts_chunk$set(echo = TRUE, comment = NA) LP Model: example 1 Comfortable Hands is a company that features a product line of winter gloves for the entire family, men, women and children. They are trying to decide what mix of these three types of gloves to produce. The company’s labor force is unionized. Each full-time employee works a 40-hour week. By union contract, the number of full-time employees can never drop below 20. Non-union part-time workers can also be hired with the following restrictions: i. Each part-time worker works 20 hours per week. ii. There must be at least 2 full-time employees for each part-time employee. All three types of gloves are made out of the same genuine cowhide leather. Comfortable Hands has a long-term contract with a leather supplier and receives a 5000 ft2 shipment of the material each week. The material and labor requirements along with the gross profit per glove sold are given in the following table. Table showing the allocation of resources for producing gloves data<-matrix(c(2,30,"$8",1.5,45,"$10",1,40,"$6"),ncol=3,byrow=TRUE) # Specifying the column names and row names colnames(data)<-c("Material","Labor","Profit") rownames(data)<-c("Men", "Women","Children") table=as.table(data) table Material Labor Profit Men 2 30 $8 Women 1.5 45 $10 Children 1 40 $6 Each full-time employee earns $13 per hour, while each part-time employee earns $10 per hour. Management wishes to know what mix of each of the three types of gloves to produce per week, as well as how many full-time and part-time workers to employ. They would like to maximize their net profit - their gross profit from sales minus their labor costs. a. Clearly define decision variables b. What is the objective function? c. What are the constraints? d. Write down the full mathematical formulation for this LP problem. Answer to the question Suppose, The number of men’s glove The number of men’s glove
The number of men’s glove The number of full-time labor The number of part-time labor a. Thus, the decision variables of the company are: b. The objective function is to maximize the net profit which is the difference between the gross profit and the labor cost. So, c. Constraints: Material Constraint: Labor constraint: For each part-time labor, there is at least 2 full-time labor, so d. The complete LP model of the given question is then Subject to the constraints: Material Constraint: Labor constraint: And non-negativity of the decision variables: LP Model: example 2
Slim-Down Manufacturing makes a line of nutritionally complete, weight-reduction beverages. One of their products is a strawberry shake which is designed to be a complete meal. The strawberry shake consists of several ingredients. Some information about each of these ingredients is given below. data<-matrix(c(1,50,20,3,"$10", 75,100,0,8,"$8", 0,0,50,1,"$25", 0,120,0,2,"$15", 30,80,2,25,"$6"),ncol=5,byrow=TRUE) # Specifying the column names and row names colnames(data)<-c("Cal_fat","Total Cal","Vitamin Cont","Thick","Costs") rownames(data)<-c("Strawberry flav", "Cream","Vitamin suppl", "Artificial sweetener","Thickening agent") table=as.table(data) table Cal_fat Total Cal Vitamin Cont Thick Costs Strawberry flav 1 50 20 3 $10 Cream 75 100 0 8 $8 Vitamin suppl 0 0 50 1 $25 Artificial sweetener 0 120 0 2 $15 Thickening agent 30 80 2 25 $6 The nutritional requirements are as follows. The beverage must total between 380 and 420 calories (inclusive). No more than 20% of the total calories should come from fat. There must be at least 50 milligrams (mg) of vitamin content. For taste reasons, there must be at least two tablespoons (tbsp) of strawberry flavoring for each tbsp of artificial sweetener. Finally, to maintain proper thickness, there must be exactly 15 mg of thickeners in the beverage. Management would like to select the quantity of each ingredient for the beverage which would minimize cost while meeting the above requirements. a. Clearly define decision variables b. What is the objective function c. What are the constraints d. Write down the full mathematical formulation for this LP problem Answer a. The decision variables can be denoted and defined as follows: S = Tablespoons of strawberry flavoring, C = Tablespoons of cream, V = Tablespoons of vitamin supplement, A = Tablespoons of artificial sweetener, T = Tablespoons of thickening agent. b. Objective function is c. Subject to
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
and non-negativity of the decision variables Solving LP practice example 1 in R library (lpSolve) Set matrix corresponding to coefficients of constraints by rows. Do not consider the non-negative decision variables; it is automatically assumed Objective function f.obj <- c(8,10,6,-520,-200) Set constraints f.con <- matrix(c(2,1.5,1,0,0, 30,45,40,-2400,-1200, 0,0,0,-1,2, 0,0,0,-1,0),nrow=4, byrow = TRUE) Set inequality signs f.dir <- c("<=", "<=", "<=", "<=") Set right hand side coefficients f.rhs <- c(5000,0,0,20) Get the final value (z) lp("max", f.obj, f.con, f.dir, f.rhs) Success: the objective function is 4500
Success: the objective function is 4500 Variables final values of the decisionn variables lp("max", f.obj, f.con, f.dir, f.rhs)$solution [1] 2500.0 0.0 0.0 25.0 12.5 Example 2 library (lpSolve) Set matrix corresponding to coefficients of constraints by rows. Do not consider the non-negative decision variables; it is automatically assumed obj <- c(10,8,15, 25,6) constraint <- matrix(c(50,100,120,0,80, 50,100,120,0,80, -9,55,-24,0,14, 20,0,0,50,2, 1,0,-2,0,0, 3,8,2,1,25),nrow=6, byrow = TRUE) Set inequality signs direction <- c(">=", "<=", "<=", ">=", ">=", "=") Set right hand side coefficients rhs_coeff <- c(380,420,0,50,0,15) Get the final value (C) minimized_cost=lp("min", obj, constraint, direction, rhs_coeff) minimized_cost$objval [1] 58.3125 Get the values of the decision variables minimized_cost$solution[1]
[1] 3.208333 minimized_cost$solution[2] [1] 0.2708333 minimized_cost$solution[3] [1] 1.604167 minimized_cost$solution[4] [1] 0 minimized_cost$solution[5] [1] 0
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help