Changeset 1146

Show
Ignore:
Timestamp:
07/19/08 08:30:57 (4 months ago)
Author:
dmitrey.kroshko
Message:

LLAVP class + some changes

Files:

Legend:

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

    r1145 r1146  
    219219 
    220220        #TODO: hold it in single place 
    221         for key in ['lb', 'ub', 'A', 'Aeq', 'b', 'beq', 'contol', 'xtol', 'ftol', 'gradtol', 'iprint', 'plot', 'maxIter', 'maxTime', 'maxCPUTime','fEnough', 'goal', 'color', 'debug'] : 
     221        for key in ['lb', 'ub', 'A', 'Aeq', 'b', 'beq', 'contol', 'xtol', 'ftol', 'gradtol', 'iprint', 'plot', 'maxIter', 'maxTime', 'maxCPUTime','fEnough', 'goal', 'color', 'debug', 'maxFunEvals'] : 
    222222            if hasattr(self, key): setattr(newProb, key, getattr(self, key)) 
    223223 
  • trunk/openopt/scikits/openopt/Kernel/LLSP.py

    r1145 r1146  
    4444    prob.goal = 'minimum' 
    4545    prob.allowedGoals = ['minimum', 'min'] 
     46    prob.showGoal = False 
    4647 
    4748    kwargs['C'] = asfarray(kwargs['C']) 
  • trunk/openopt/scikits/openopt/Kernel/LSP.py

    r1091 r1146  
    1414        self.probType = 'LSP' 
    1515        self.allowedGoals = ['minimum', 'min'] 
     16        self.showGoal = False 
    1617        self.isObjFunValueASingleNumber = False 
    1718 
  • trunk/openopt/scikits/openopt/__init__.py

    r1145 r1146  
    44#from info import __doc__, __version__ 
    55 
    6 from oo import LP, NLP, NSP, MILP, QP, NLSP, LSP, GLP, LLSP,  MMP 
     6from oo import LP, NLP, NSP, MILP, QP, NLSP, LSP, GLP, LLSP,  MMP, LLAVP 
    77from Kernel.Function import oofun 
    88from info import __version__ 
  • trunk/openopt/scikits/openopt/oo.py

    r1139 r1146  
    1515from Kernel.LLSP import LLSP as CLLSP 
    1616from Kernel.MMP import MMP as CMMP 
     17from Kernel.LLAVP import LLAVP as CLLAVP 
    1718 
    1819def MILP(*args, **kwargs): 
     
    4748    r.xf - desired solution (NaNs if a problem occured) 
    4849    r.ff - objFun value (<f,x_opt>) (NaN if a problem occured) 
    49     (see also other fields, such as CPUTimeElapsed, TimeElapsed, etc
     50    (see also other r fields
    5051    Solvers available for now: 
    5152    lpSolve (LGPL) - requires lpsolve + Python bindings installations (all mentioned is available in http://sourceforge.net/projects/lpsolve) 
     
    8586    r.xf - desired solution (NaNs if a problem occured) 
    8687    r.ff - objFun value (<f,x_opt>) (NaN if a problem occured) 
    87     (see also other fields, such as CPUTimeElapsed, TimeElapsed, etc
     88    (see also other r fields
    8889    Solvers available for now: 
    8990    lpSolve (LGPL) - requires lpsolve + Python bindings installations (all mentioned is available in http://sourceforge.net/projects/lpsolve) 
     
    122123    r.xf - desired solution (NaNs if a problem occured) 
    123124    r.ff - objFun value (NaN if a problem occured) 
    124     (see also other fields, such as CPUTimeElapsed, TimeElapsed, etc
     125    (see also other r fields
    125126    Solvers available for now: 
    126127    cvxopt_qp (GPL) - requires CVXOPT (http://abel.ee.ucla.edu/cvxopt) 
     
    295296    """ 
    296297    LLSP: constructor for Linear Least Squares Problem assignment 
    297     ||C * x - d|| -> min 
    298298    0.5*||C*x-d||^2 + 0.5*damp*||x-X||^2 + <f,x> -> min 
    299299 
     
    326326    r.xf - desired solution (NaNs if a problem occured) 
    327327    r.ff - objFun value (NaN if a problem occured) 
    328     (see also other fields, such as CPUTimeElapsed, TimeElapsed, etc
     328    (see also other r fields
    329329    Solvers available for now: 
    330330    lapack_dgelss - slow but stable, requires scipy; unconstrained 
     
    346346    """ 
    347347    return CMMP(*args, **kwargs) 
     348 
     349def LLAVP(*args, **kwargs): 
     350    """ 
     351   LLAVP : constructor for Linear Least Absolute Value Problem assignment 
     352    ||C * x - d||_1  + damp*||x-X||_1-> min 
     353 
     354    subjected to: 
     355    lb <= x <= ub 
     356 
     357    Examples of valid calls: 
     358    p = LLAVP(C, d, <params as kwargs>) 
     359    p = LLAVP(C=my_C, d=my_d, <params as kwargs>) 
     360 
     361    p = LLAVP(C, d, lb=lb, ub=ub) 
     362 
     363    See also: /examples/llavp_*.py 
     364 
     365    :Parameters: 
     366    C - float m x n numpy.ndarray, numpy.matrix or Python list of lists 
     367    d - float array of length m (numpy.ndarray, numpy.matrix, Python list or tuple) 
     368    damp - non-negative float number 
     369    X - float array of length n (by default all-zeros) 
     370    lb, ub - float arrays of length n (numpy.ndarray, numpy.matrix, Python list or tuple) 
     371 
     372    :Returns: 
     373    OpenOpt LLAVP class instance 
     374 
     375    Notes 
     376    ----- 
     377    Solving of LLAVPs is performed via 
     378    r = p.solve(string_name_of_solver) 
     379    r.xf - desired solution (NaNs if a problem occured) 
     380    r.ff - objFun value (NaN if a problem occured) 
     381    (see also other r fields) 
     382    Solvers available for now: 
     383    nsp:<NSP_solver_name> - converter llavp2nsp. Example: r = p.solve('nsp:ralg', plot=1, iprint =15, <...>) 
     384    """ 
     385    return CLLAVP(*args, **kwargs) 
  • trunk/openopt/scikits/openopt/solvers/CoinOr/ipopt_oo.py

    r1098 r1146  
    1717 
    1818    # CHECK ME! 
    19     __isIterPointAlwaysFeasible__ = lambda self, p: p.__isNoMoreThanBoxBounded__() 
     19    __isIterPointAlwaysFeasible__ = lambda self, p: False 
     20    #__isIterPointAlwaysFeasible__ = lambda self, p: p.__isNoMoreThanBoxBounded__() 
    2021 
    2122    optFile = 'auto' 
     
    8182        x, zl, zu, obj = nlp.solve(p.x0) 
    8283 
    83         nlp.close() 
     84 
    8485        p.istop = 1000 
    8586        p.iterfcn(x, obj) 
     87        nlp.close() 
    8688 
    8789