UTS: Nonlinear Programming to Optimize Cardboard Box Design
VerifiedAdded on 2023/06/04
|9
|1541
|73
Project
AI Summary
This project focuses on optimizing the dimensions of a cardboard box to maximize its volume, given a fixed amount of cardboard material. The problem is approached using nonlinear programming techniques, specifically the Lagrange multiplier method and the fmincon solver in MATLAB. The mathematical model is derived, and the optimization problem is solved analytically using Lagrange multipliers, resulting in optimal dimensions where x=y=z=0.489 meters. The solution is then validated using MATLAB's fmincon function, demonstrating a practical application of nonlinear programming in engineering design. The report includes detailed steps, code snippets, and references, offering a comprehensive understanding of the optimization process. Desklib provides students access to this project and a wealth of solved assignments and past papers.

Question: A cardboard box for packing quantities of small electronic component is to
be manufactured as shown in the figure. The top, bottom, and front faces must be of
double weight (i.e., two pieces of cardboard). A problem posed is to find dimensions
(x,y,z) of such a box that maximize the volume for given amount of cardboard, equal to
1.44 square meters.
(1) Derive the model of the optimization problem
(2) Solve the problem using Lagrange Multiplier and another two numerical
methods/software
(3) write a report
Solution:
1. Mathematical model for the cardboard box model optimization for small
electronics component.
The dimension of cardboard box is given as x,y,z meters
be manufactured as shown in the figure. The top, bottom, and front faces must be of
double weight (i.e., two pieces of cardboard). A problem posed is to find dimensions
(x,y,z) of such a box that maximize the volume for given amount of cardboard, equal to
1.44 square meters.
(1) Derive the model of the optimization problem
(2) Solve the problem using Lagrange Multiplier and another two numerical
methods/software
(3) write a report
Solution:
1. Mathematical model for the cardboard box model optimization for small
electronics component.
The dimension of cardboard box is given as x,y,z meters
Paraphrase This Document
Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser

Volume =length*breath*height
Since the double size of coordinates are assumed which as given in statement
(instead of xyz its now 8xyz)
f ( x , y , z )=8 xyz
Constraint
2 xy+ 2 yz +2 xz=1.44 square m
Since the double size of coordinates are assumed which as given in statement
(instead of xyz its now 8xyz)
f ( x , y , z )=8 xyz
Constraint
2 xy+ 2 yz +2 xz=1.44 square m

2. Lagrange multiplier method to solve the above method
Optimization problem: Maximization or minimization of any quantity or function with
consideration of constraints (means range of quantity) is called optimization. It can be
applicable to variety of fields such as engineering, manufacturing, industrial, food
industry etc. where cost minimization, loss minimization, profit maximization, etc. are
the task being done with the use of optimization programs.
Lagrange multiplier is very old still effective technique to solve nonlinear equations. This
technique unfortunately taught poorly in many institutes, but in fact its best suited and
effective method. It’s applicable for constraint optimization problems.
It’s based on assumption of certain surface where points are chosen and LaGrange
multiplier allows to minimize or maximize the function within the said boundary. Here
the function used is f(x, y, z) within a given boundary of g(x, y, z) = C which is nothing
but the constraints.
∇ f ( x , y , z ) =λ ∇ g (x , y , z )
g ( x , y , z ) =C
here ∇ f and ∇ g are the vectors and we can write it in the four equations with four
unknowns as below for x,y,z and λ
f x ( x , y , z ) = λ ∇ gx (x , y , z )
f y ( x , y , z )=λ ∇ gy (x , y , z)
f z ( x , y , z ) =λ ∇ gz (x , y , z )
g ( x , y , z ) =C
Optimization problem: Maximization or minimization of any quantity or function with
consideration of constraints (means range of quantity) is called optimization. It can be
applicable to variety of fields such as engineering, manufacturing, industrial, food
industry etc. where cost minimization, loss minimization, profit maximization, etc. are
the task being done with the use of optimization programs.
Lagrange multiplier is very old still effective technique to solve nonlinear equations. This
technique unfortunately taught poorly in many institutes, but in fact its best suited and
effective method. It’s applicable for constraint optimization problems.
It’s based on assumption of certain surface where points are chosen and LaGrange
multiplier allows to minimize or maximize the function within the said boundary. Here
the function used is f(x, y, z) within a given boundary of g(x, y, z) = C which is nothing
but the constraints.
∇ f ( x , y , z ) =λ ∇ g (x , y , z )
g ( x , y , z ) =C
here ∇ f and ∇ g are the vectors and we can write it in the four equations with four
unknowns as below for x,y,z and λ
f x ( x , y , z ) = λ ∇ gx (x , y , z )
f y ( x , y , z )=λ ∇ gy (x , y , z)
f z ( x , y , z ) =λ ∇ gz (x , y , z )
g ( x , y , z ) =C
⊘ This is a preview!⊘
Do you want full access?
Subscribe today to unlock all pages.

Trusted by 1+ million students worldwide

Here variable λ is called a dummy variable also known as “Lagrange multiplier”;and
were are interested in finding optimal value of x,y and z.
If we know the boundary of the system means constriants of the system we can set them
into the function. After that maxima or minima can be found out. The solution of
nonlinear equation can be done as after testing if λ is not equal to zero
1) Very first step is to solve the equation without taking care about λ where we have
the equations interms of λ with x,y,z
2) Solve one equation at a time
3) Wherever square root comes we have to consider the negative and positive
square roots.
4) Whenever division is taking place avoid dividing by zero
Here the problem of optimization is to maximize the volume of the box which is given
as function of f(*) as below
f ( x , y , z )=8 xyz
And subjected to the function
g ( x , y , z ) =¿>8 xyz+ λ (2 xy +2 yz +2 xz −1.44)
Thus the gradient of function f and g are given as
∇ f ( x , y , z ) = { yz , xz , xy }
∇ g ( x , y , z ) = { 2 y +2 z , 2 x +2 z , 2 x+2 y }
2 xy+2 yz +2 xz=1.44
So from above equations we can write
yz=2 y λ+2 z λ
xz=2 λx +2 λz
xy=2 λx +2 yλ
were are interested in finding optimal value of x,y and z.
If we know the boundary of the system means constriants of the system we can set them
into the function. After that maxima or minima can be found out. The solution of
nonlinear equation can be done as after testing if λ is not equal to zero
1) Very first step is to solve the equation without taking care about λ where we have
the equations interms of λ with x,y,z
2) Solve one equation at a time
3) Wherever square root comes we have to consider the negative and positive
square roots.
4) Whenever division is taking place avoid dividing by zero
Here the problem of optimization is to maximize the volume of the box which is given
as function of f(*) as below
f ( x , y , z )=8 xyz
And subjected to the function
g ( x , y , z ) =¿>8 xyz+ λ (2 xy +2 yz +2 xz −1.44)
Thus the gradient of function f and g are given as
∇ f ( x , y , z ) = { yz , xz , xy }
∇ g ( x , y , z ) = { 2 y +2 z , 2 x +2 z , 2 x+2 y }
2 xy+2 yz +2 xz=1.44
So from above equations we can write
yz=2 y λ+2 z λ
xz=2 λx +2 λz
xy=2 λx +2 yλ
Paraphrase This Document
Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser

2 xy+2 yz +2 xz=1.44
Multiplying above three equations with x,y,z
xyz=2 xy λ+2 xz λ
xyz=2 λxy +2 λyz
xyz=2 λxz +2 yzλ
From above equation its clear λ ≠ 0(otherwise x=y=z=0 which doesn’t fulfil the
requirement of constraints), so above first two equation can be rearrange as below (with
removing 2 and λ ¿
xy + xz=xy + yz
xz= yz
x= y
From second and third equation
xy + yz=xz + yz
xy=xz
y=z
now the constraint equation
2 xy+2 yz +2 xz=1.44
xy + yz+ xz=0.72
From above relationships we can write it as
y2 + y2 + y2=0.72
Multiplying above three equations with x,y,z
xyz=2 xy λ+2 xz λ
xyz=2 λxy +2 λyz
xyz=2 λxz +2 yzλ
From above equation its clear λ ≠ 0(otherwise x=y=z=0 which doesn’t fulfil the
requirement of constraints), so above first two equation can be rearrange as below (with
removing 2 and λ ¿
xy + xz=xy + yz
xz= yz
x= y
From second and third equation
xy + yz=xz + yz
xy=xz
y=z
now the constraint equation
2 xy+2 yz +2 xz=1.44
xy + yz+ xz=0.72
From above relationships we can write it as
y2 + y2 + y2=0.72

3 y2=0.72
y2=0.24
y=0.489
And x=y=z=0.489 which indicate it’s a square box with dimension of x y and z as 0.489
meter where volume of cardboard box is given as 1.44 m2
y2=0.24
y=0.489
And x=y=z=0.489 which indicate it’s a square box with dimension of x y and z as 0.489
meter where volume of cardboard box is given as 1.44 m2
⊘ This is a preview!⊘
Do you want full access?
Subscribe today to unlock all pages.

Trusted by 1+ million students worldwide

3. Report
Optimization using Matlab program (fmincon)
MATLAB base optimization program for non linear programming is fmincon which is
best effective solver for nonlinear mathematical models.
b and beq are vectors,
A and Aeq are matrices,
c(x) and ceq(x) are functions that return vectors,
f(x) is a function that returns a scalar.
f(x), c(x), and ceq(x) can be nonlinear functions.
Syntax is given as matlab command or program
x = fmincon(fun,x0,A,b)
x = fmincon(fun,x0,A,b) starts at x0 and attempts to find a minimizer x of the function
described in funsubject to the linear inequalities A*x ≤ b. x0 can be a scalar, vector, or
matrix.
Matlab Code for carboard box optimization problem:
%%SET THE INITIAL GUESS VALUE
lengthGuess=1;
widthGuess=1;
heightGuess=1;
x0=[lengthGuess widthGuess heightGuess];
%%call sover to maximize objective function give the constraints
xopt=fmincon(@objective,x0,[],[],[],[],[],[],@constraint,[])
%%retrive optimized box sizing and volume
Optimization using Matlab program (fmincon)
MATLAB base optimization program for non linear programming is fmincon which is
best effective solver for nonlinear mathematical models.
b and beq are vectors,
A and Aeq are matrices,
c(x) and ceq(x) are functions that return vectors,
f(x) is a function that returns a scalar.
f(x), c(x), and ceq(x) can be nonlinear functions.
Syntax is given as matlab command or program
x = fmincon(fun,x0,A,b)
x = fmincon(fun,x0,A,b) starts at x0 and attempts to find a minimizer x of the function
described in funsubject to the linear inequalities A*x ≤ b. x0 can be a scalar, vector, or
matrix.
Matlab Code for carboard box optimization problem:
%%SET THE INITIAL GUESS VALUE
lengthGuess=1;
widthGuess=1;
heightGuess=1;
x0=[lengthGuess widthGuess heightGuess];
%%call sover to maximize objective function give the constraints
xopt=fmincon(@objective,x0,[],[],[],[],[],[],@constraint,[])
%%retrive optimized box sizing and volume
Paraphrase This Document
Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser

volumeOpt=calcVolume(xopt)
%%calculate surface area with optimized valyes just to double check
surfaceAreaOpt=calcSurface(xopt)
%%define function to calculate the volume of box
function volume=calcVolume(x)
length=x(1);
width=x(2);
height=x(3);
volume=height*length*width;
end
function surfaceArea=calcSurface(x)
length=x(1);
width=x(2);
height=x(3);
volume=2*length*width+2*length*height+2*height*width;
end
%%define objective function for optimizaiton
function obj=objective(x)
obj=calcVolume(x)
end
%%define constraints for optimization
function [c,ceq]=constraint(x)
c=calcSurface(x)-1.44;
ceq=[];
end
solution using matlab program:
>> 0.486 0.487 0.487
Solution using Lagrange multiplier method
x=y=z=0.489 which indicate it’s a square box with dimension of x y and z as 0.489
meter where volume of cardboard box is given as 1.44 m2
References:
%%calculate surface area with optimized valyes just to double check
surfaceAreaOpt=calcSurface(xopt)
%%define function to calculate the volume of box
function volume=calcVolume(x)
length=x(1);
width=x(2);
height=x(3);
volume=height*length*width;
end
function surfaceArea=calcSurface(x)
length=x(1);
width=x(2);
height=x(3);
volume=2*length*width+2*length*height+2*height*width;
end
%%define objective function for optimizaiton
function obj=objective(x)
obj=calcVolume(x)
end
%%define constraints for optimization
function [c,ceq]=constraint(x)
c=calcSurface(x)-1.44;
ceq=[];
end
solution using matlab program:
>> 0.486 0.487 0.487
Solution using Lagrange multiplier method
x=y=z=0.489 which indicate it’s a square box with dimension of x y and z as 0.489
meter where volume of cardboard box is given as 1.44 m2
References:

[1].Luenberger DG, Ye Y. Linear and nonlinear programming. Reading, MA: Addison-
wesley, 1984.
[2].Haeser G, Hinder O, Ye Y. “On the behavior of Lagrange multipliers in convex and
non-convex infeasible interior point methods,” in arXiv preprint arXiv:1707.07327.
2017, pp. 23.
[3].De Abreu A, Cheung G, Frossard P, Pereira F. “Optimal Lagrange multipliers for
dependent rate allocation in video coding” in Signal Processing: Image
Communication, 2018 pp.113-118.
[4].Khamitov A, Ruderman A. “Synchronous optimal modulation: Frequency or time
domain, global or constrained optimization? 40 years to the first formulation,” in
IEEE Transactions on Industrial Electronics. 2017, pp. 8778-81.
[5].Gao Y, Mi Y, Lakerveld R. “An optimization‐based approach for structural design
of self‐assembled DNA tiles,” in AIChE Journal. 2017, pp.1804-17.
wesley, 1984.
[2].Haeser G, Hinder O, Ye Y. “On the behavior of Lagrange multipliers in convex and
non-convex infeasible interior point methods,” in arXiv preprint arXiv:1707.07327.
2017, pp. 23.
[3].De Abreu A, Cheung G, Frossard P, Pereira F. “Optimal Lagrange multipliers for
dependent rate allocation in video coding” in Signal Processing: Image
Communication, 2018 pp.113-118.
[4].Khamitov A, Ruderman A. “Synchronous optimal modulation: Frequency or time
domain, global or constrained optimization? 40 years to the first formulation,” in
IEEE Transactions on Industrial Electronics. 2017, pp. 8778-81.
[5].Gao Y, Mi Y, Lakerveld R. “An optimization‐based approach for structural design
of self‐assembled DNA tiles,” in AIChE Journal. 2017, pp.1804-17.
⊘ This is a preview!⊘
Do you want full access?
Subscribe today to unlock all pages.

Trusted by 1+ million students worldwide
1 out of 9
Related Documents
Your All-in-One AI-Powered Toolkit for Academic Success.
+13062052269
info@desklib.com
Available 24*7 on WhatsApp / Email
Unlock your academic potential
Copyright © 2020–2025 A2Z Services. All Rights Reserved. Developed and managed by ZUCOL.




