This file is indexed.

/usr/share/pyshared/openopt/oo.py is in python-openopt 0.34+svn1146-1build1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
import os,sys
sys.path.append(os.getcwd()+os.sep+'kernel')

from LP import LP as CLP
from LCP import LCP as CLCP
from SDP import SDP as CSDP
from QP import QP as CQP
from MILP import MILP as CMILP
from NSP import NSP as CNSP
from NLP import NLP as CNLP
from MINLP import MINLP as CMINLP
from NLSP import NLSP as CNLSP
from NLLSP import NLLSP as CNLLSP
from GLP import GLP as CGLP
from SLE import SLE as CSLE
from LLSP import LLSP as CLLSP
from MMP import MMP as CMMP
from LLAVP import LLAVP as CLLAVP
from LUNP import LUNP as CLUNP
from SOCP import SOCP as CSOCP
from DFP import DFP as CDFP
from IP import IP as CIP


'''
from kernel.LP import LP as CLP
from kernel.LCP import LCP as CLCP
from kernel.SDP import SDP as CSDP
from kernel.QP import QP as CQP
from kernel.MILP import MILP as CMILP
from kernel.NSP import NSP as CNSP
from kernel.NLP import NLP as CNLP
from kernel.MINLP import MINLP as CMINLP
from kernel.NLSP import NLSP as CNLSP
from kernel.NLLSP import NLLSP as CNLLSP
from kernel.GLP import GLP as CGLP
from kernel.SLE import SLE as CSLE
from kernel.LLSP import LLSP as CLLSP
from kernel.MMP import MMP as CMMP
from kernel.LLAVP import LLAVP as CLLAVP
from kernel.LUNP import LUNP as CLUNP
from kernel.SOCP import SOCP as CSOCP
from kernel.DFP import DFP as CDFP
'''

def MILP(*args, **kwargs):
    """
    MILP: constructor for Mixed Integer Linear Problem assignment
    f' x -> min
    subjected to
    lb <= x <= ub
    A x <= b
    Aeq x = beq
    for all i from intVars: i-th coordinate of x is required to be integer
    for all j from binVars: j-th coordinate of x is required to be from {0, 1}

    Examples of valid calls:
    p = MILP(f, <params as kwargs>)
    p = MILP(f=objFunVector, <params as kwargs>)
    p = MILP(f, A=A, intVars = myIntVars, Aeq=Aeq, b=b, beq=beq, lb=lb, ub=ub, binVars = binVars)
    See also: /examples/milp_*.py

    :Parameters:
    - intVars : Python list of those coordinates that are required to be integers.
    - binVars : Python list of those coordinates that are required to be binary.
    all other input parameters are same to LP class constructor ones

    :Returns:
    OpenOpt MILP class instance

    Notes
    -----
    Solving of MILPs is performed via
    r = p.solve(string_name_of_solver) 
    or  p.maximize, p.minimize
    r.xf - desired solution (NaNs if a problem occured)
    r.ff - objFun value (<f,x_opt>) (NaN if a problem occured)
    (see also other r fields)
    Solvers available for now:
    lpSolve (LGPL) - requires lpsolve + Python bindings installations (all mentioned is available in http://sourceforge.net/projects/lpsolve)
    glpk (GPL 2) - requires glpk + CVXOPT v >= 1.0 installations (read OO MILP webpage for more details)
    """
    return CMILP(*args, **kwargs)

def LP(*args, **kwargs):
    """
    LP: constructor for Linear Problem assignment
    f' x -> min
    subjected to
    lb <= x <= ub
    A x <= b
    Aeq x = beq

    valid calls are:
    p = LP(f, <params as kwargs>)
    p = LP(f=objFunVector, <params as kwargs>)
    p = LP(f, A=A, Aeq=Aeq, Awhole=Awhole, b=b, beq=beq, bwhole=bwhole, dwhole=dwhole, lb=lb, ub=ub)
    See also: /examples/lp_*.py

    :Parameters:
    f: vector of length n
    A: size m1 x n matrix, subjected to A * x <= b
    Aeq: size m2 x n matrix, subjected to Aeq * x = beq
    b, beq: corresponding vectors of lengthes m1, m2
    lb, ub: vectors of length n, some coords may be +/- inf

    :Returns:
    OpenOpt LP class instance

    Notes
    -----
    Solving of LPs is performed via
    r = p.solve(string_name_of_solver)
    or  p.maximize, p.minimize
    r.xf - desired solution (NaNs if a problem occured)
    r.ff - objFun value (<f,x_opt>) (NaN if a problem occured)
    (see also other r fields)
    Solvers available for now:
    pclp (BSD) - premature but pure Python implementation with permissive license
    lpSolve (LGPL) - requires lpsolve + Python bindings installations (all mentioned is available in http://sourceforge.net/projects/lpsolve)
    cvxopt_lp (GPL) - requires CVXOPT (http://abel.ee.ucla.edu/cvxopt)
    glpk(GPL2) - requires CVXOPT(http://abel.ee.ucla.edu/cvxopt) & glpk (www.gnu.org/software/glpk)
    converter to NLP. Example: r = p.solve('nlp:ipopt')
    """
    return CLP(*args, **kwargs)

def LCP(*args, **kwargs):
    """
    LCP: constructor for Linear Complementarity Problem assignment
    find w, z: w = Mz + q
    
    valid calls are:
    p = LP(M, q, <params as kwargs>)
    p = LP(M=M, q=q, <params as kwargs>)
    See also: /examples/lcp_*.py

    :Parameters:
    M: numpy array of size n x n
    q: vector of length n

    :Returns:
    OpenOpt LCP class instance

    Notes
    -----
    Solving of LCPs is performed via
    r = p.solve(string_name_of_solver)
    r.xf - desired solution (1st n/2 coords are w, other n/2 coords are z)
    r.ff - objFun value (max residual of Mz+q-w) (NaN if a problem occured)
    (see also other r fields)
    Solvers available for now:
    lcpsolve (BSD) 

    """
    return CLCP(*args, **kwargs)


def SDP(*args, **kwargs):
    """
    SDP: constructor for SemiDefinite Problem assignment
    f' x -> min
    subjected to
    lb <= x <= ub
    A x <= b
    Aeq x = beq
    For all i = 0, ..., I: Sum [j = 0, ..., n-1] {S_i_j x_j} <= d_i (matrix componentwise inequality),
    d_i are square matrices 
    S_i_j are square positive semidefinite matrices of size same to d_i
    

    valid calls are:
    p = SDP(f, <params as kwargs>)
    p = SDP(f=objFunVector, <params as kwargs>)
    p = SDP(f, S=S, d=d, A=A, Aeq=Aeq, Awhole=Awhole, b=b, beq=beq, bwhole=bwhole, dwhole=dwhole, lb=lb, ub=ub)

    See also: /examples/sdp_*.py

    :Parameters:
    f: vector of length n
    S: Python dict of square matrices S[0, 0], S[0,1], ..., S[I,J]
    S[i, j] are real symmetric positive-definite matrices
    d: Python dict of square matrices d[0], ..., d[I]
    A: size m1 x n matrix, subjected to A * x <= b
    Aeq: size m2 x n matrix, subjected to Aeq * x = beq
    b, beq: corresponding vectors of lengthes m1, m2
    lb, ub: vectors of length n, some coords may be +/- inf

    :Returns:
    OpenOpt SDP class instance

    Notes
    -----
    Solving of SDPs is performed via
    r = p.solve(string_name_of_solver)
    r.xf - desired solution (NaNs if a problem occured)
    r.ff - objFun value (<f,x_opt>) (NaN if a problem occured)
    (see also other r fields)
    Solvers available for now:
    cvxopt_sdp (LGPL) - requires CVXOPT (http://abel.ee.ucla.edu/cvxopt)
    dsdp (GPL) - requires CVXOPT + DSDP installation, can't handle linear equality constraints Aeq x = beq
    
    """
    return CSDP(*args, **kwargs)

def SOCP(*args, **kwargs):
    """
    SOCP: constructor for Second-Order Cone Problem assignment
    f' x -> min
    subjected to
    lb <= x <= ub
    Aeq x = beq
    For all i = 0, ..., I: ||C_i x + d_i|| <= q_i x + s_i    

    valid calls are:
    p = SDP(f, <params as kwargs>)
    p = SDP(f=objFunVector, <params as kwargs>)
    p = SDP(f, S=S, d=d, A=A, Aeq=Aeq, Awhole=Awhole, b=b, beq=beq, bwhole=bwhole, dwhole=dwhole, lb=lb, ub=ub)

    See also: /examples/sdp_*.py

    :Parameters:
    f: vector of length n
    Aeq: size M x n matrix, subjected to Aeq * x = beq
    beq: corresponding vector of length M
    C: Python list of matrices C_i of shape (m_i, n)
    d: Python list of vectors of length m_i
    q: Python list of vectors of length n
    s: Python list of numbers, len(s) = n
    
    lb, ub: vectors of length n, some coords may be +/- inf

    :Returns:
    OpenOpt SDP class instance

    Notes
    -----
    Solving of SOCPs is performed via
    r = p.solve(string_name_of_solver)
    r.xf - desired solution (NaNs if a problem occured)
    r.ff - objFun value (<f,x_opt>) (NaN if a problem occured)
    (see also other r fields)
    Solvers available for now:
    cvxopt_socp (LGPL) - requires CVXOPT (http://abel.ee.ucla.edu/cvxopt)
    
    """
    return CSOCP(*args, **kwargs)

def QP(*args, **kwargs):
    """
    QP: constructor for Quadratic Problem assignment
    1/2 x' H x  + f' x -> min
    subjected to
    A x <= b
    Aeq x = beq
    lb <= x <= ub

    Examples of valid calls:
    p = QP(H, f, <params as kwargs>)
    p = QP(numpy.ones((3,3)), f=numpy.array([1,2,4]), <params as kwargs>)
    p = QP(f=range(8)+15, H = numpy.diag(numpy.ones(8)), <params as kwargs>)
    p = QP(H, f, A=A, Aeq=Aeq, b=b, beq=beq, lb=lb, ub=ub, <other params as kwargs>)
    See also: /examples/qp_*.py

    INPUT:
    H: size n x n matrix, symmetric, positive-definite
    f: vector of length n
    lb, ub: vectors of length n, some coords may be +/- inf
    A: size m1 x n matrix, subjected to A * x <= b
    Aeq: size m2 x n matrix, subjected to Aeq * x = beq
    b, beq: vectors of lengths m1, m2
    Alternatively to A/Aeq you can use Awhole matrix as it's described in LP documentation (or both A, Aeq, Awhole)
    OUTPUT: OpenOpt QP class instance

    Solving of QPs is performed via
    r = p.solve(string_name_of_solver)
    r.xf - desired solution (NaNs if a problem occured)
    r.ff - objFun value (NaN if a problem occured)
    (see also other r fields)
    Solvers available for now:
    cvxopt_qp (GPL) - requires CVXOPT (http://abel.ee.ucla.edu/cvxopt)
    converter to NLP. Example: r = p.solve('nlp:ipopt')
    """
    return CQP(*args, **kwargs)

def NLP(*args, **kwargs):
    """
    NLP: constructor for general Non-Linear Problem assignment

    f(x) -> min (or -> max)
    subjected to
    c(x) <= 0
    h(x) = 0
    A x <= b
    Aeq x = beq
    lb <= x <= ub

    Examples of valid usage:
    p = NLP(f, x0, <params as kwargs>)
    p = NLP(f=objFun, x0 = myX0, <params as kwargs>)
    p = NLP(f, x0, A=A, df = objFunGradient, Aeq=Aeq, b=b, beq=beq, lb=lb, ub=ub)
    See also: /examples/nlp_*.py

    INPUTS:
    f: objFun
    x0: start point, vector of length n

    Optional:
    name: problem name (string), is used in text & graphics output
    df: user-supplied gradient of objective function
    c, h - functions defining nonlinear equality/inequality constraints
    dc, dh - functions defining 1st derivatives of non-linear constraints

    A: size m1 x n matrix, subjected to A * x <= b
    Aeq: size m2 x n matrix, subjected to Aeq * x = beq
    b, beq: corresponding vectors of lengthes m1, m2
    lb, ub: vectors of length n subjected to lb <= x <= ub constraints, may include +/- inf values

    iprint = {10}: print text output every <iprint> iteration
    goal = {'minimum'} | 'min' | 'maximum' | 'max' - minimize or maximize objective function
    diffInt = {1e-7} : finite-difference gradient aproximation step, scalar or vector of length nVars
    scale = {None} : scale factor, see /examples/badlyScaled.py for more details
    stencil = {1}|2|3: finite-differences derivatives approximation stencil, 
    used by most of solvers (except scipy_cobyla) when no user-supplied for 
    objfun / nonline constraints derivatives are provided
        1: (f(x+dx)-f(x))/dx (faster but less precize)
        2: (f(x+dx)-f(x-dx))/(2*dx) (slower but more exact)
        3: (-f(x+2*dx)+8*f(x+dx)-8*f(x-dx)+f(x-2*dx))/(12*dx) (even more slower, but even more exact)
    check.df, check.dc, check.dh: if set to True, OpenOpt will check user-supplied gradients.
    args (or args.f, args.c, args.h) - additional arguments to objFunc and non-linear constraints,
        see /examples/userArgs.py for more details.

    contol: max allowed residual in optim point
    (for any constraint from problem constraints:
    constraint(x_optim) < contol is required from solver)

    stop criteria:
    maxIter {400}
    maxFunEvals {1e5}
    maxCPUTime {inf}
    maxTime {inf}
    maxLineSearch {500}
    fEnough {-inf for min problems, +inf for max problems}:
        stop if objFunc vulue better than fEnough and all constraints less than contol
    ftol {1e-6}: used in stop criterium || f[iter_k] - f[iter_k+1] || < ftol
    xtol {1e-6}: used in stop criterium || x[iter_k] - x[iter_k+1] || < xtol
    gtol {1e-6}: used in stop criteria || gradient(x[iter_k]) || < gtol

    callback - user-defined callback function(s), see /examples/userCallback.py

    Notes:
    1) for more safety default values checking/reassigning (via print p.maxIter / prob.maxIter = 400) is recommended
    (they may change in future OpenOpt versions and/or not updated in time in the documentation)
    2) some solvers may ignore some of the stop criteria above and/or use their own ones
    3) for NSP constructor ftol, xtol, gtol defaults may have other values

    graphic options:
    plot = {False} | True : plot figure (now implemented for UC problems only), requires matplotlib installed
    color = {'blue'} | black | ... (any valid matplotlib color)
    specifier = {'-'} | '--' | ':' | '-.' - plot specifier
    show = {True} | False : call pylab.show() after solver finish or not
    xlim {(nan, nan)}, ylim {(nan, nan)} - initial estimation for graphical output borders
    (you can use for example p.xlim = (nan, 10) or p.ylim = [-8, 15] or p.xlim=[inf, 15], only real finite values will be taken into account)
    for constrained problems ylim affects only 1st subplot
    p.graphics.xlabel or p.xlabel = {'time'} | 'cputime' | 'iter' # desired graphic output units in x-axe, case-unsensetive


    Note: some Python IDEs have problems with matplotlib!

    Also, after assignment NLP instance you may modify prob fields inplace:
    p.maxIter = 1000
    p.df = lambda x: cos(x)

    OUTPUT: OpenOpt NLP class instance

    Solving of NLPs is performed via
    r = p.solve(string_name_of_solver)
    or  p.maximize, p.minimize
    r.xf - desired solution (NaNs if a problem occured)
    r.ff - objFun value (NaN if a problem occured)
    (see also other fields, such as CPUTimeElapsed, TimeElapsed, isFeasible, iter etc, via dir(r))

    Solvers available for now:
    single-variable:
        goldenSection, scipy_fminbound (latter is not recommended)
        (both these solvers require finite lb-ub and ignore user-supplied gradient)
    unconstrained:
        scipy_bfgs, scipy_cg, scipy_ncg, 
        (these ones cannot handle user-provided gradient) scipy_powell and scipy_fmin 
        amsg2p - requires knowing fOpt (optimal value)
    box-bounded:
        scipy_lbfgsb, scipy_tnc - require scipy installed
        bobyqa - doesn't use derivatives; requires http://openopt.org/nlopt installed
        ptn, slmvm1, slmvm2 - require http://openopt.org/nlopt installed
    all constraints:
        ralg
        ipopt (requires ipopt + pyipopt installed)
        scipy_slsqp
        scipy_cobyla (this one cannot handle user-supplied gradients)
        lincher (requires CVXOPT QP solver),
        gsubg - for large-scaled problems
        algencan (ver. 2.0.3 or more recent, very powerful constrained solver, GPL,
        requires ALGENCAN + Python interface installed,
        see http://www.ime.usp.br/~egbirgin/tango/)
        mma and auglag - require http://openopt.org/nlopt installed

    """
    return CNLP(*args, **kwargs)

def MINLP(*args, **kwargs):
    """
    MINLP: constructor for general Mixed-Integer Non-Linear Problem assignment
    parameters and usage: same to NLP, + parameters
    discreteVars: dictionary numberOfCoord <-> list (or tuple) of allowed values, eg
        p.discreteVars = {0: [1, 2.5], 15: (3.1, 4), 150: [4,5, 6]}
    discrtol (default 1e-5) - tolerance required for discrete constraints 
    available solvers: 
    branb (branch-and-bound) - translation of fminconset routine, requires non-default string parameter nlpSolver
    """
    return CMINLP(*args, **kwargs)

def NSP(*args, **kwargs):
    """
    Non-Smooth Problem constructor
    Same usage as NLP (see help(NLP) and /examples/nsp_*.py), but default values of contol, xtol, ftol, diffInt may differ
    Also, default finite-differences derivatives approximation stencil is 3 instead of 1 for NLP
    Solvers available for now:
        ralg - all constraints, medium-scaled (nVars = 1...1000), can handle user-provided gradient/subgradient
        amsg2p - requires knowing fOpt (optimal value), medium-scaled (nVars = 1...1000), can handle user-provided gradient/subgradient
        gsubg - for large-scaled problems
        scipy_fmin - a Nelder-Mead simplex algorithm implementation, cannot handle constraints and derivatives
        sbplx  -  A variant of Nelder-Mead algorithm; requires http://openopt.org/nlopt installed
        ShorEllipsoid (unconstrained for now) - small-scale, nVars=1...10, requires r0: ||x0-x*||<=r0
    """
    return CNSP(*args, **kwargs)

def NLSP(*args, **kwargs):
    """
    Solving systems of n non-linear equations with n variables
    Parameters and usage: same as NLP
    (see help(NLP) and /examples/nlsp_*.py)
    Solvers available for now:
        scipy_fsolve (can handle df);
        converter to NLP. Example: r = p.solve('nlp:ipopt');
        nssolve (primarily for non-smooth and noisy funcs; can handle all types of constraints and 1st derivatives df,dc,dh; splitting equations to Python list or tuple is recommended to speedup calculations)
    (these ones below are very unstable and can't use user-supplied gradient - at least, for scipy 0.6.0)
        scipy_anderson
        scipy_anderson2
        scipy_broyden1
        scipy_broyden2
        scipy_broyden3
        scipy_broyden_generalized
    """
    r = CNLSP(*args, **kwargs)
    r.pWarn('''
    OpenOpt NLSP class had been renamed to SNLE 
    (system of nonlinear equations), use "SNLE" instead of "NLSP"
    ''')
    return r
    
def SNLE(*args, **kwargs):
    """
    Solving systems of n non-linear equations with n variables
    Parameters and usage: same as NLP
    (see help(NLP) and /examples/nlsp_*.py)
    Solvers available for now:
        scipy_fsolve (can handle df);
        converter to NLP. Example: r = p.solve('nlp:ipopt');
        nssolve (primarily for non-smooth and noisy funcs; can handle all types of constraints and 1st derivatives df,dc,dh; splitting equations to Python list or tuple is recommended to speedup calculations)
    (these ones below are very unstable and can't use user-supplied gradient - at least, for scipy 0.6.0)
        scipy_anderson
        scipy_anderson2
        scipy_broyden1
        scipy_broyden2
        scipy_broyden3
        scipy_broyden_generalized
    """
    return CNLSP(*args, **kwargs)

def NLLSP(*args, **kwargs):
    """
    Given set of non-linear equations
        f1(x)=0, f2(x)=0, ... fm(x)=0
    search for x: f1(x, <optional params>)^2 + ,,, + fm(x, <optional params>)^2 -> min

    Parameters and usage: same as NLP
    (see help(openopt.NLP) and /examples/nllsp_*.py)
    Solvers available for now:
        scipy_leastsq (requires scipy installed)
        converter to NLP. Example: r = p.solve('nlp:ralg')
    """
    return CNLLSP(*args, **kwargs)

def IP(*args, **kwargs):
    """
    Integrate a function f: R^n -> R over a given domain lb_i <= x_i <= ub_i
    """
    return CIP(*args, **kwargs)

def SLE(*args, **kwargs):
    """
    SLE: constructor for system of linear equations C*x = d assignment
    
    Examples of valid usage:
    p = SLE(C, d, <params as kwargs>)
    p = SLE(C=C, d=d, <params as kwargs>)
    """
    return CSLE(*args, **kwargs)


def DFP(*args, **kwargs):
    """
    Data Fit Problem constructor
    Search for x: Sum_i || F(x, X_i) - Y_i ||^2 -> min
    subjected to
    c(x) <= 0
    h(x) = 0
    A x <= b
    Aeq x = beq
    lb <= x <= ub
    
    Some examples of valid usage:
    p = NLP(f, x0, X, Y, <params as kwargs>)
    p = NLP(f=objFun, x0 = my_x0, X = my_X, Y=my_Y, <params as kwargs>)
    p = NLP(f, x0, X, Y, A=A, Aeq=Aeq, b=b, beq=beq, lb=lb, ub=ub, <params as kwargs>)
    Parameters and usage: same as NLP, see help(openopt.NLP)
    See also: /examples/dfp_*.py
        
    Solvers available for now:
        converter to NLP. Example: r = p.solve('nlp:ralg')
    """
    return CDFP(*args, **kwargs)


def GLP(*args, **kwargs):
    """
    GLP: constructor for general GLobal Problem 
    search for global optimum of general non-linear (maybe discontinious) function
    f(x) -> min/max
    subjected to 
    lb <= x <= ub
    Ax <= b
    c(x) <= 0
    
    usage:
    p = GLP(f, <params as kwargs>)
    
    Solving of NLPs is performed via
    r = p.solve(string_name_of_solver)
    or  p.maximize, p.minimize
    
    Parameters and usage: same as NLP  (see help(NLP) and /examples/glp_*.py)
    One more stop criterion is maxNonSuccess (default: 15)
    See also: /examples/glp_*.py

    Solvers available:
        galileo - a GA-based solver by Donald Goodman, requires finite lb <= x <= ub
        pswarm (requires PSwarm installed), license: BSD, can handle Ax<=b, requires finite search area
        de (this is temporary name, will be changed till next OO release v. 0.22), license: BSD, requires finite lb <= x <= ub, can handle Ax<=b, c(x) <= 0. The solver is based on differential evolution and made by Stepan Hlushak.
        stogo and mlsl - can use derivatives; require http://openopt.org/nlopt installed
        isres - can handle any constraints; requires http://openopt.org/nlopt installed
        interalg - exact optimum wrt required tolerance, see http://openopt.org/interalg for details
    """
    return CGLP(*args, **kwargs)


def LLSP(*args, **kwargs):
    """
    LLSP: constructor for Linear Least Squares Problem assignment
    0.5*||C*x-d||^2 + 0.5*damp*||x-X||^2 + <f,x> -> min

    subjected to:
    lb <= x <= ub

    Examples of valid calls:
    p = LLSP(C, d, <params as kwargs>)
    p = LLSP(C=my_C, d=my_d, <params as kwargs>)

    p = LLSP(C, d, lb=lb, ub=ub)

    See also: /examples/llsp_*.py

    :Parameters:
    C - float m x n numpy.ndarray, numpy.matrix or Python list of lists
    d - float array of length m (numpy.ndarray, numpy.matrix, Python list or tuple)
    damp - non-negative float number
    X - float array of length n (by default all-zeros)
    f - float array of length n (by default all-zeros)
    lb, ub - float arrays of length n (numpy.ndarray, numpy.matrix, Python list or tuple)

    :Returns:
    OpenOpt LLSP class instance

    Notes
    -----
    Solving of LLSPs is performed via
    r = p.solve(string_name_of_solver)
    r.xf - desired solution (NaNs if a problem occured)
    r.ff - objFun value (NaN if a problem occured)
    (see also other r fields)
    Solvers available for now:
    lsqr (license: GPL) - most efficient, can hanlde scipy.sparse matrices, 
        user-supplied or generated by FuncDesigner models automatically
    lapack_dgelss (license: BSD) - slow but stable, requires scipy; unconstrained
    lapack_sgelss (license: BSD) - single precesion, requires scipy; unconstrained
    bvls (license: BSD) - requires installation from OO LLSP webpage, can handle lb, ub
    converter to nlp. Example: r = p.solve('nlp:ralg', plot=1, iprint =15, <...>)
    """
    return CLLSP(*args, **kwargs)

def MMP(*args, **kwargs):
    """
    MMP: constructor for Mini-Max Problem
    search for minimum of max(func0(x), func1(x), ... funcN(x))
    See also: /examples/mmp_*.py

    Parameters and usage: same as NLP  (see help(NLP) and /examples/mmp_*.py)
    Solvers available:
        nsmm (currently unconstrained, NonSmooth-based MiniMax, uses NSP ralg solver)
    """
    return CMMP(*args, **kwargs)

def LLAVP(*args, **kwargs):
    """
   LLAVP : constructor for Linear Least Absolute Value Problem assignment
    ||C * x - d||_1  + damp*||x-X||_1-> min

    subjected to:
    lb <= x <= ub

    Examples of valid calls:
    p = LLAVP(C, d, <params as kwargs>)
    p = LLAVP(C=my_C, d=my_d, <params as kwargs>)

    p = LLAVP(C, d, lb=lb, ub=ub)

    See also: /examples/llavp_*.py

    :Parameters:
    C - float m x n numpy.ndarray, numpy.matrix or Python list of lists
    d - float array of length m (numpy.ndarray, numpy.matrix, Python list or tuple)
    damp - non-negative float number
    X - float array of length n (by default all-zeros)
    lb, ub - float arrays of length n (numpy.ndarray, numpy.matrix, Python list or tuple)

    :Returns:
    OpenOpt LLAVP class instance

    Notes
    -----
    Solving of LLAVPs is performed via
    r = p.solve(string_name_of_solver)
    r.xf - desired solution (NaNs if a problem occured)
    r.ff - objFun value (NaN if a problem occured)
    (see also other r fields)
    Solvers available for now:
    nsp:<NSP_solver_name> - converter llavp2nsp. Example: r = p.solve('nsp:ralg', plot=1, iprint =15, <...>)
    """
    return CLLAVP(*args, **kwargs)


def LUNP(*args, **kwargs):
    """
   LUNP : constructor for Linear Uniform Norm Problem assignment
    || C * x - d ||_inf (that is max | C * x - d |)  -> min

    subjected to:
    lb <= x <= ub
    A x <= b
    Aeq x = beq

    Examples of valid calls:
    p = LUNP(C, d, <params as kwargs>)
    p = LUNP(C=my_C, d=my_d, <params as kwargs>)

    p = LUNP(C, d, lb=lb, ub=ub, A = A, b = b, Aeq = Aeq, beq=beq, ...)

    See also: /examples/lunp_*.py

    :Parameters:
    C - float m x n numpy.ndarray, numpy.matrix or Python list of lists
    d - float array of length m (numpy.ndarray, numpy.matrix, Python list or tuple)
    damp - non-negative float number
    lb, ub - float arrays of length n (numpy.ndarray, numpy.matrix, Python list or tuple)

    :Returns:
    OpenOpt LUNP class instance

    Notes
    -----
    Solving of LUNPs is performed via
    r = p.solve(string_name_of_solver)
    r.xf - desired solution (NaNs if a problem occured)
    r.ff - objFun value (NaN if a problem occured)
    (see also other r fields)
    Solvers available for now:
    lp:<LP_solver_name> - converter lunp2lp. Example: r = p.solve('lp:lpSolve', <...>)
    """
    return CLUNP(*args, **kwargs)