opentps.core.processing.planOptimization.solvers package

Submodules

opentps.core.processing.planOptimization.solvers.beamletFree module

opentps.core.processing.planOptimization.solvers.bfgs module

class BFGS(accel=<opentps.core.processing.planOptimization.acceleration.linesearch.LineSearch object>, **kwargs)

Bases: GradientDescent

Broyden–Fletcher–Goldfarb–Shanno algorithm. This algorithm solves unconstrained nonlinear planOptimization problems. The BFGS method belongs to quasi-Newton methods, a class of hill-climbing planOptimization techniques that seek a stationary point of a (preferably twice continuously differentiable) function.

class LBFGS(m=10, accel=<opentps.core.processing.planOptimization.acceleration.linesearch.LineSearch object>, **kwargs)

Bases: BFGS

Limited-memory Broyden–Fletcher–Goldfarb–Shanno algorithm (L-BFGS). It approximates BFGS using a limited amount of computer memory. Like the original BFGS, L-BFGS uses an estimate of the inverse Hessian matrix to steer its search through variable space, but where BFGS stores a dense n × n approximation to the inverse Hessian (n being the number of variables in the problem), L-BFGS stores only a few vectors that represent the approximation implicitly

getHg(H0, g)

This function returns the approximate inverse Hessian multiplied by the gradient, H*g

Parameters:
  • H0 (ndarray) – Initial guess for the inverse Hessian

  • g (ndarray) – Gradient of the objective function

opentps.core.processing.planOptimization.solvers.fista module

class FISTA(accel=<opentps.core.processing.planOptimization.acceleration.fistaAccel.FistaAccel object>, indicator=None, lambda_=1, **kwargs)

Bases: ConvexSolver

Fast Iterative Shrinkage-Thresholding Algorithm (FISTA) solver class for convex problems. Inherit from ConvexSolver. This part of the code comes from the EPFL LTS2 convex optimization toolbox.

Variables:
  • meth (str (default: 'ForwardBackward')) – The name of the FISTA method to be used.

  • indicator (Indicator (default: None)) – The indicator function.

  • projection (Projection (default: None)) – The projection function.

  • lambda (float (default: 1)) – The lambda parameter.

  • z (ndarray) – The z variable.

solveForwardBackward()

Forward-backward proximal splitting algorithm (ISTA and FISTA). Can be used for problems composed of the sum of a smooth and a non-smooth function. For details about the algorithm, see A. Beck and M. Teboulle, “A fast iterative shrinkage-thresholding algorithm for linear inverse problems”, SIAM Journal on Imaging Sciences, vol. 2, no. 1, pp. 183–202, 2009.

solveGeneralizedForwardBackward()

Generalized forward-backward proximal splitting algorithm. Can be used for problems composed of the sum of any number of smooth and non-smooth functions. For details about the algorithm, see H. Raguet, “A Generalized Forward-Backward Splitting”, SIAM Journal on Imaging Sciences, vol. 6, no. 13, pp 1199-1226, 2013.

opentps.core.processing.planOptimization.solvers.gradientDescent module

class GradientDescent(**kwargs)

Bases: ConvexSolver

class for gradient descent solver. Inherits from ConvexSolver. This part of the code comes from the EPFL LTS2 convex optimization toolbox.

opentps.core.processing.planOptimization.solvers.localSearch module

opentps.core.processing.planOptimization.solvers.lp module

opentps.core.processing.planOptimization.solvers.mip module

opentps.core.processing.planOptimization.solvers.solver module

class ConvexSolver(step=0.1, accel=None, **kwargs)

Bases: object

ConvexSolver is the base class for all convex solvers. This part of the code comes from the EPFL LTS2 convex optimization toolbox.

Variables:
  • step (float (default: 0.1)) – The step size.

  • accel (Accel (default: None)) – The acceleration scheme.

  • params (dict) –

    The parameters for the solver. The paremeters are:

    dtolfloat (default: None)

    Tolerance for termination by the change of the cost function.

    xtolfloat (default: None)

    Tolerance for termination by the change of the solution.

    atolfloat (default: None)

    Tolerance for termination by the cost function.

    ftolfloat (default: 1e-03)

    Tolerance for termination by the relative change of the cost function.

  • non_smooth_funs (list) – The list of non-smooth functions.

  • smooth_funs (list) – The list of smooth functions.

  • fid_cost (list) – The list of the cost function values.

  • sol (ndarray) – The solution.

algo(objective, niter)

Call the solver iterative algorithm and the provided acceleration scheme

Parameters:
  • objective (list) – The value of the objective function at each iteration.

  • niter (int) – The number of iterations.

objective(x)

Return the objective function at x. Necessitate solver._pre(…) to be run first.

Parameters:

x (ndarray) – The point at which the objective function is evaluated.

Returns:

obj – The value of the objective function at x.

Return type:

list

post()

Solver-specific post-processing. Mainly used to delete references added during initialization so that the garbage collector can free the memory.

pre(functions, x0)

Solver-specific pre-processing; functions split in two lists: - self.smoothFuns : functions involved in gradient steps - self.nonSmoothFuns : functions involved in proximal steps

Parameters:
  • functions (list) – list of convex functions to minimize

  • x0 (ndarray) – initial weight vector

solve(functions, x0)

Solve an planOptimization problem whose objective function is the sum of some convex functions.

Parameters:
  • functions (list) – list of convex functions to minimize (objects must implement the “pyopti.functions.func.eval” and/or pyopti.functions.func.prox methods, required by some solvers).

  • x0 (ndarray) – initial weight vector

Returns:

result – The result of the planOptimization. The keys are:

sollist

The solution.

solverstr

The name of the solver.

critstr

The termination criterion.

niterint

The number of iterations.

timefloat

The time of the planOptimization.

objectivelist

The value of the objective function at each iteration.

Return type:

dict

opentps.core.processing.planOptimization.solvers.sparcling module

Module contents