Changeset 1221

Show
Ignore:
Timestamp:
08/18/08 08:21:21 (3 months ago)
Author:
dmitrey.kroshko
Message:

some changes for ralg

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/openopt/scikits/openopt/solvers/UkrOpt/ralg_oo.py

    r1198 r1221  
    6464#        else: b = B_constr 
    6565 
    66  
    6766        """                           Ralg main cycle                                    """ 
    6867 
     
    7271            ls1 = 0 
    7372            # TODO: is (g^T b)^T better? 
    74             g2 = self.__economyMult__(b.T, moveDirection) 
    75             if any(g2): g2 /= p.norm(g2) 
    76             g1 = p.matmult(b, g2) 
    77  
    78             x_0 = x.copy() 
    79  
     73            g_tmp = self.__economyMult__(b.T, moveDirection) 
     74            if any(g_tmp): g_tmp /= p.norm(g_tmp) 
     75            g1 = p.matmult(b, g_tmp) 
    8076 
    8177            """                           Forward line search                          """ 
     
    8783                if ls1 > nh: 
    8884                    if itn == 0: 
    89                         hs *= 15.0 
     85                        hs *= 2.0 
    9086                    else: 
    9187                        hs *= q2 
     
    110106                return 
    111107 
     108            g2 = self.__getRalgDirection__(newPoint) # used for dilation direction obtaining 
     109 
    112110            iterPoint  = newPoint 
    113  
    114             moveDirection = self.__getRalgDirection__(iterPoint) 
    115             g2 = moveDirection 
    116  
    117  
     111#            if ls > 0: 
     112#                iterPoint = oldPoint 
     113#            else: 
     114#                iterPoint  = newPoint 
    118115 
    119116            """                          Backward line search                          """ 
    120117 
    121             x = iterPoint.x.copy() 
     118 
    122119            if ls == 0 and self.doBackwardSearch: 
     120                x_tmp = newPoint.x.copy() 
    123121                PrevPoint = iterPoint 
    124122                while 1: 
     
    127125 
    128126                    if itn == 0: 
    129                         x = p.xk - hs * g1 
     127                        x_tmp = p.xk - hs * g1 
    130128                    else: 
    131                         x = 0.5*x+0.5*prevIterPoint.x 
     129                        x_tmp = 0.5*x_tmp+0.5*prevIterPoint.x 
    132130                        hs /= self.hmult 
    133131 
    134                     newPoint = p.point(x
     132                    newPoint = p.point(x_tmp
    135133 
    136134                    if PrevPoint.betterThan(newPoint) or newPoint.f() > PrevPoint.f() or abs(newPoint.f() - p.fk) < 15 * p.ftol or p.norm(newPoint.x - p.xk) < 15 * p.xtol: 
     
    145143                        break 
    146144                iterPoint = PrevPoint 
    147                 moveDirection = self.__getRalgDirection__(iterPoint) 
     145 
    148146 
    149147 
    150148            """                      iterPoint has been obtained                     """ 
    151149 
     150            moveDirection = self.__getRalgDirection__(iterPoint) 
    152151            x = iterPoint.x.copy() 
    153152            if ls <= 0: hs *= q1 
     
    193192                    g = (g / ng).reshape(-1,1) 
    194193                    vec1 = self.__economyMult__(b, g).reshape(-1,1) 
    195                     vec2 = p.dotmult(g.T, w) 
     194                    vec2 = w * g.T 
    196195                    b += p.matmult(vec1, vec2) 
    197196            else: 
     
    259258            """                Some final things for ralg main cycle                """ 
    260259 
    261             g = g2.copy() 
     260            g = moveDirection.copy() 
     261            #g = g2.copy() 
    262262            prevIterPoint, iterPoint = iterPoint, None 
    263263