+ changed check for intial setting of old_w. (matrix != None does not work in cvxopt) master
authorFabio <fabio@congo.fml.local>
Mon, 26 Jan 2009 16:33:29 +0000 (17:33 +0100)
committerFabio <fabio@congo.fml.local>
Mon, 26 Jan 2009 16:33:29 +0000 (17:33 +0100)
qpalma/SIQP_CVXOPT.py

index 75a14f3..7433e18 100644 (file)
@@ -49,6 +49,8 @@ class SIQPSolver(SIQP):
       self.old_objective_value = -(sys.maxint-1)
       self.logfh = logfh
 
+      self.old_w = cb.matrix([0.0] ,(1,1))
+
       #self.P.tofile(open('matrix_P_%d_%d'%(self.P.size[0],self.P.size[1]),'w+'))
       #self.q.tofile(open('matrix_q_%d_%d'%(self.q.size[0],self.q.size[1]),'w+'))
       #self.G.tofile(open('matrix_G_%d_%d'%(self.G.size[0],self.G.size[1]),'w+'))
@@ -77,7 +79,7 @@ class SIQPSolver(SIQP):
       if loss < self.EPSILON:
           return False
       
-      if self.old_w != None:
+      if self.old_w.size != (1,1):
          scalar_prod = energy_deltas * self.old_w[0:self.numFeatures,0]
          old_slack = self.old_w[self.numFeatures+idx,0]
          if useMarginRescaling: