In teaching Behavioral Economics, optimization problems require some intuition. This intuition can be opaque without calculus literacy. Below is a simulation to demonstrate that the process for constrained optimization works. It has the added benefit of showing isoquants (by colored stripes in the image below), and the strict boundary condition of the efficiency frontier.
Basic constrained optimization problems are as follows:
I have made code in R to simulate the results for a two-part optimization process. The example uses as the functional form.
library(“plot3D”)
p1<-1
p2<-2
y<-10
x1<-runif(25000, min=0, max=y/p1)#Checking any options inside the constraint or on the constraint
x2<-runif(25000,min=0, max=(y-p1*x1)/p2)U<-sqrt(x1)+sqrt(x2)
out<-mesh(x1, x2, U)
points3D(x1, x2, U, xlab=”x1″, ylab=”x2″, zlab=”Utility”, phi=-90, theta=90)plot(x1, U)
abline(v=x1[which(U==max(U))], col=”red”)
x1_star<-x1[which(U==max(U))]
x2_star<-x2[which(U==max(U))]
y-x1_star*p1-x2_star*p2
And it outputs the following plots (with minor variation). Note that the colored bands represent utility curves, isoquants. The end of the colored points represents the efficiency frontier.
The actual solution is found by:
subject to:
The Lagrangian is then:
Leading to the first order conditions (derivatives of L):
Using these 3 conditions, we can find the equations:
Where, if then we can solve for the theoretical solutions:
These indeed match very closely with the real solutions.
One thought on “Simulating Optimization Problems and Production Possibility Frontiers”