UAS

From ccitonlinewiki
Revision as of 20:59, 29 May 2019 by Nomensenp (talk | contribs) (Created page with " == Perhitungan Optimasi Struktur == 1. Truss Element 2. Golden Section Search The golden section search is the counterpart of bisection used in finding roots of equations...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Perhitungan Optimasi Struktur

1. Truss Element

2. Golden Section Search

The golden section search is the counterpart of bisection used in finding roots of equations. Suppose that the minimum of f(x) has been bracketed in the interval (a,b) of length h. To telescope the interval, we evaluate the function at x1 =b− Rh and x2 =a + Rh, as shown in Figure 10.2(a). The constant R is to be determined shortly. If f1 > f2 as indicated in the figure, the minimum lies in (x1,b); otherwise itislocatedin(a, x2). Assuming that f1 > f2, we set a ←x1 and x1 ←x2, which yields a new interval (a,b) of length h� = Rh, as illustrated in Figure 10.2(b). To carry out the next telescopingoperationweevaluatethefunctionat x2 =a + Rh� andrepeattheprocess. The procedure works only if Figures 10.1(a) and (b) are similar (i.e., if the same constant R locatesx1 andx2 inbothfigures).ReferringtoFigure10.2(a),wenotethat x2 −x1 =2Rh−h.ThesamedistanceinFigure10.2(b)isx1 −a =h�− Rh�.Equating thetwo,we get

2Rh−h=h�− Rh�

code : For Profil L import math def bracket(f,x1,h):

   c = 1.618033989
   f1 = f(x1)
   x2 = x1 + h
   f2 = f(x2)
   if f2 > f1:
       h = -h
       x2 = x1 + h
       f2 = f(x2)
       if f2 > f1:
           return x2,x1 - h
   for i in range (100):
       h = c*h
       x3 = x2 + h
       f3 = f(x3)
       if f3 > f2:
           return x1,x3
       x1 = x2
       x2 = x3
       f1 = f2
       f2 = f3
       print ("Bracket did not find a minimum")

def search(f,a,b,tol=1.0e-9):

       nIter = int(math.ceil(-2.078087*math.log(tol/abs(b-a))))
       R = 0.618033989
       C = 1.0 - R
       x1 = R*a + C*b
       x2 = C*a + R*b
       f1 = f(x1)
       f2 = f(x2)
       for i in range(nIter):
           if f1 > f2:
               a = x1
               x1 = x2
               f1 = f2
               x2 = C*a + R*b
               f2 = f(x2)
           else:
               b = x2
               x2 = x1
               f2 = f1
               x1 = R*a + C*b
               f1 = f(x1)
       if f1 < f2:
           return x1,f1
       else:
           return x2,f2

print("Aplikasi Optimasi Section Modulus L Stiffner") print("Kondisi Terikat : lebar alas > lebar atas > lebar tengah") b1 = eval(input("Nilai lebar bangun alas (meter) :")) b3 = eval(input("Nilai lebar bangun atas (meter):")) b2 = eval(input("Nilai lebar bangun tengah (meter) :")) H = eval(input("Nilai tinggi T stiffner (meter) :")) def f(x):

   A1 = b1*(H-x)/2
   A2 = b2*x
   A3 = b3*(H-x)/2
   d1 = 1/2*(H-x)/2
   d2 = 1/2*x+(H-x)/2
   d3 = 3/4*(H-x)+x
   I1 = 1/12*b1*((H-x)/2)**3
   I2 = 1/12*b2*x**3
   I3 = 1/12*b3*((H-x)/2)**3
   dc = H-(d1*A1+d2*A2+d3*A3)/(A1+A2+A3)
   I = I1-A1*(d1-dc)**2+I2-A2*(d2-dc)**2+I3-A3*(d3-dc)**2
   Z = I/dc
   return Z

xStart = 0.0 h = 1.0 x1,x2 = bracket(f,xStart,h) y,fMin = search(f,x1,x2) print("optimal sectional area =",-fMin) print("sectional area awal" , f(H)) A = -fMin/f(H)*100 print ("efisiensi",A,"%") input ("\nPress return to exit")