Changeset 1093

Show
Ignore:
Timestamp:
07/04/08 05:34:14 (2 months ago)
Author:
dmitrey.kroshko
Message:

some changes

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/openopt/scikits/openopt/Kernel/BaseAlg.py

    r1091 r1093  
    1313 
    1414    # TODO: remove it 
    15     __constraintsThatCannotBeHandled__ = [] 
     15    #__constraintsThatCannotBeHandled__ = [] 
    1616 
    1717    __optionalDataThatCanBeHandled__ = [] 
  • trunk/openopt/scikits/openopt/Kernel/LLSP.py

    r1091 r1093  
    11from ooMisc import assignScript 
    22from BaseProblem import MatrixProblem 
    3 from numpy import asfarray, ones, inf, dot, nan, zeros 
     3from numpy import asfarray, ones, inf, dot, nan, zeros, any 
    44from numpy.linalg import norm 
    55import NLP 
     
    2626        p.args.f = self # DO NOT USE p.args = self IN PROB ASSIGNMENT! 
    2727        self.inspire(p) 
     28        p.checkdf() 
    2829        r = p.solve(solver, **kwargs) 
    2930        return r 
     
    5455#    return dot(r, r) 
    5556ff = lambda x, LLSPprob: LLSPprob.objFunc(x) 
    56 dff = lambda x, LLSPprob: 2 * (dot(LLSPprob.C.T, dot(LLSPprob.C,x)  - LLSPprob.d)) 
     57def dff(x, LLSPprob): 
     58    r = dot(LLSPprob.C.T, dot(LLSPprob.C,x))  - dot(LLSPprob.C.T, LLSPprob.d) 
     59    if LLSPprob.damp != 0: r += LLSPprob.damp*(x - LLSPprob.xd) 
     60    r += LLSPprob.f 
     61    return r 
    5762 
     63 
  • trunk/openopt/scikits/openopt/Kernel/ooCheck.py

    r1091 r1093  
    1515#            p.err('the solver ' + p.solverName + ' cannot handle ' + "'" + fn + "' data") 
    1616 
    17     if p.solver.__constraintsThatCannotBeHandled__ != []
    18         for fn in p.solver.__constraintsThatCannotBeHandled__
     17    for fn in p.__optionalData__
     18        if hasattr(p, fn)
    1919            attr = getattr(p, fn) 
    20             if (callable(attr) and getattr(p.userProvided, fn)) or (not callable(attr) and attr not in ([], (), None) and asarray(attr).size>0): 
    21                 if fn not in ['lb', 'ub'] or any(isfinite(attr)): 
    22                     p.err('the solver ' + p.solverName + ' cannot handle ' + "'" + fn + "' constraints") 
     20            if not attr in p.solver.__optionalDataThatCanBeHandled__ and (callable(attr) and getattr(p.userProvided, fn)) or (not callable(attr) and attr not in ([], (), None) and asarray(attr).size>0 and any(isfinite(attr))): 
     21                p.err('the solver ' + p.solver.__name__ + ' cannot handle ' + "'" + fn + "' data") 
    2322 
    2423