Optimization 
Multigradient Method

Sri Harsha Garapati, Autar Kaw
University of South Florida
United States of America
kaw@eng.usf.edu

Introduction

This worksheet demonstrates the use of Mathematica to illustrate the multi-gradient method of solving optimization problems.

Problem Statement

Mathematica worksheet to solve the the cross-sectional area of a gutter with equal base and edge length of 2 is given by, A=4*sin(theta)*(1+cos(theta)). Use an initial interval of (0,pi/2).Use an initial interval epsilon=0.2.

Input

The following are the inputs to this problem
      a) Function to be optimized, A
      b) Lower limit of the range, xl
      c) Upper limit of the range, xu
      d) Initial guess, xi
      e) Allowable tolerance, tol

f[x_,y_]=x^2+y^2+2*x+4;
xi=1;
yi=1;

Multigradient Method

Programming multigradient method

xval=xi;
yval=yi;
dfdx=D[f[x,y],x]
dfdy=D[f[x,y],y]
dfdxval=100;
dfdyval=100;
iteration=0;
While[dfdxval≠0 && dfdyval≠0,
dfdxval=D[f[x,y],x]/.x->xval;
dfdyval=D[f[x,y],y]/.y->xval;
If[dfdxval≠0 && dfdyval≠0,iteration=iteration+1;g=f[xval+dfdxval*h,yval+dfdyval*h];solg=Solve[g,h]];
]