naginterfaces.library.opt.handle_solve_socp_ipm¶
- naginterfaces.library.opt.handle_solve_socp_ipm(handle, x=None, u=None, uc=None, monit=None, data=None, io_manager=None)[source]¶
handle_solve_socp_ipm
is a solver from the NAG optimization modelling suite for large-scale Second-order Cone Programming (SOCP) problems. It is based on an interior point method (IPM).Note: this function uses optional algorithmic parameters, see also:
handle_opt_set()
,handle_opt_get()
.For full information please refer to the NAG Library document for e04pt
https://support.nag.com/numeric/nl/nagdoc_30.2/flhtml/e04/e04ptf.html
- Parameters
- handleHandle
The handle to the problem. It needs to be initialized (e.g., by
handle_init()
) and to hold a problem formulation compatible withhandle_solve_socp_ipm
. It must not be changed between calls to the NAG optimization modelling suite.- xNone or float, array-like, shape , optional
The input of is reserved for future releases of the NAG Library and it is ignored at the moment.
- uNone or float, array-like, shape , optional
Note: if , holds Lagrange multipliers (dual variables) for the bound constraints and linear constraints. If , will not be referenced.
The input of is reserved for future releases of the NAG Library and it is ignored at the moment.
- ucNone or float, array-like, shape , optional
Note: if , holds Lagrange multipliers (dual variables) for second-order cones as defined by
handle_set_group()
. If , will not be referenced.The input of is reserved for future releases of the NAG Library and it is ignored at the moment.
- monitNone or callable monit(handle, rinfo, stats, data=None), optional
Note: if this argument is None then a NAG-supplied facility will be used.
is provided to enable you to monitor the progress of the optimization.
It is invoked at the end of every th iteration where is given by the option ‘SOCP Monitor Frequency’ (the default is , is not called).
- Parameters
- handleHandle
The handle to the problem as provided on entry to
handle_solve_socp_ipm
. It may be used to query the model during the solve, and extract the current approximation of the solution byhandle_set_get_real()
.- rinfofloat, ndarray, shape
Error measures and various indicators at the end of the current iteration as described in .
- statsfloat, ndarray, shape
Solver statistics at the end of the current iteration as described in , however, elements , , , and refer to the quantities in the last iteration rather than accumulated over all iterations through the whole algorithm run.
- dataarbitrary, optional, modifiable in place
User-communication data for callback functions.
- dataarbitrary, optional
User-communication data for callback functions.
- io_managerFileObjManager, optional
Manager for I/O in this routine.
- Returns
- xfloat, ndarray, shape
The final values of the variables .
- ufloat, ndarray, shape
The final values of the variables .
- ucfloat, ndarray, shape
The final values of the variables .
- rinfofloat, ndarray, shape
Error measures and various indicators of the algorithm (see Algorithmic Details for details) as given in the table below:
Value of the primal objective.
Value of the dual objective.
Flag indicating the system formulation used by the solver, : augmented system, : normal equation.
Factorization type, : Cholesky, : Bunch–Parlett.
–
Not referenced in this solver.
Relative primal infeasibility, see Convergence-optimal termination.
Relative duality gap, see Convergence-optimal termination.
Relative dual infeasibility, see Convergence-optimal termination.
Accuracy, see Convergence-optimal termination.
, see [equation].
, see [equation].
Step length.
–
Reserved for future use.
- statsfloat, ndarray, shape
Solver statistics as given in the table below. Note that times are measured in seconds, see option ‘Stats Time’.
Number of iterations.
Not referenced.
Total number of iterative refinements performed.
Value of the perturbation added to the diagonal in the normal equation formulation or the augmented system formulation.
Total number of factorizations performed.
Total time spent in the solver.
Time spent in the presolve phase.
Time spent in the last iteration.
Total time spent factorizing the system matrix.
Total time spent backsolving the system matrix.
Not referenced.
Time spent in the initialization phase.
Number of nonzeros in the system matrix.
Number of nonzeros in the system matrix factor.
Maximum error of the backsolve.
Number of columns in considered dense by the solver.
Number of conic constraints considered dense by the solver.
–
Reserved for future use.
- Other Parameters
- ‘Defaults’valueless
This special keyword may be used to reset all options to their default values. Any argument value given with this keyword will be ignored.
- ‘Infinite Bound Size’float
Default
This defines the ‘infinite’ bound in the definition of the problem constraints. Any upper bound greater than or equal to will be regarded as (and similarly any lower bound less than or equal to will be regarded as ). Note that a modification of this option does not influence constraints which have already been defined; only the constraints formulated after the change will be affected.
Constraint: .
- ‘Monitoring File’int
Default
If , the unit number for the secondary (monitoring) output. If set to , no secondary output is provided. The following information is output to the unit:
a listing of the options;
problem statistics, the iteration log, and the final status as set by ‘Monitoring Level’;
the solution if set by ‘Print Solution’.
Constraint: .
- ‘Monitoring Level’int
Default
This argument sets the amount of information detail that will be printed by the solver to the secondary output. The meaning of the levels is the same as with ‘Print Level’.
Constraint: .
- ‘Print File’int
Default
If , the unit number for the primary output of the solver. If , the primary output is completely turned off independently of other settings. The default value is the advisory message unit number at the time of the options initialization, e.g., at the initialization of the handle. The following information is output to the unit:
a listing of options if set by ‘Print Options’;
problem statistics, the iteration log, and the final status from the solver as set by ‘Print Level’;
the solution if set by ‘Print Solution’.
Constraint: .
- ‘Print Level’int
Default
This argument defines how detailed information should be printed by the solver to the primary output.
Output
No output from the solver
Only the final status and the primal and dual objective value
Problem statistics, one line per iteration showing the progress of the solution with respect to the convergence measures, final status and statistics
As level but each iteration line is longer, including step lengths and errors
As level but further details of each iteration are presented
Constraint: .
- ‘Print Options’str
Default
If , a listing of options will be printed to the primary output.
Constraint: or .
- ‘Print Solution’str
Default
If , the final values of the primal variables are printed on the primary and secondary outputs.
If or , in addition to the primal variables, the final values of the dual variables are printed on the primary and secondary outputs.
Constraint: , , or .
- ‘SOCP Factorization Method’str
Default
If the value of ‘SOCP System Formulation’ is ‘AUGMENTED SYSTEM’, then this parameter controls whether Harwell packages ‘MA86’ or ‘MA97’ is used for the sparse linear algebra factorization. Note that if the option value ‘SOCP System Formulation’ is set to ‘AUTO’ or ‘NORMAL EQUATIONS’, then specifying ‘MA86’ with this option will allow the solver to use this package in the case that the solver switches to the augmented system formulation.
Constraint: or .
- ‘SOCP Iteration Limit’int
Default
The maximum number of iterations to be performed by
handle_solve_socp_ipm
. Setting the option too low might lead to = 22.Constraint: .
- ‘SOCP Monitor Frequency’int
Default
This argument defines the frequency of how often function is called. If , the solver calls at the end of every th iteration. If it is set to , the function is not called at all.
Constraint: .
- ‘SOCP Presolve’str
Default
This argument allows you to reduce the level of presolving of the problem or turn it off completely. If the presolver is turned off, the solver will try to handle the problem as given by you. In such a case, the presence of fixed variables or linear dependencies in the constraint matrix can cause numerical instabilities to occur. In normal circumstances, it is recommended to use the full presolve which is the default.
Constraint: , or .
- ‘SOCP Scaling’str
Default
This argument controls the type of scaling to be applied on the constraint matrix before solving the problem. More precisely, the scaling procedure will try to find diagonal matrices and such that the values in are of a similar order of magnitude. The solver is less likely to run into numerical difficulties when the constraint matrix is well scaled.
Constraint: , or .
- ‘SOCP Stop Tolerance’float
Default
This argument sets the value which is the tolerance for the convergence measures in the stopping criteria, see Stopping Criteria.
Constraint: .
- ‘SOCP Stop Tolerance 2’float
Default
This argument sets the additional tolerance used in the stopping criteria, see Stopping Criteria.
Constraint: .
- ‘SOCP System Formulation’str
Default
As described in Solving the KKT System,
handle_solve_socp_ipm
can internally work either with the normal equations formulation [equation] or with the augmented system [equation] and [equation]. A brief discussion of advantages and disadvantages is presented in [equation]. Setting the option value to ‘AUTO’ leaves the decision to the solver based on the structure of the constraints. This will typically lead to the normal equations formulation unless there are many dense columns or the system is significantly cheaper to factorize as the augmented system. Note that in some cases even if the solver might switch the formulation through the computation to the augmented system due to numerical instabilities or computational cost.Constraint: , , , or .
- ‘Stats Time’str
Default
This argument allows you to turn on timings of various parts of the algorithm to give a better overview of where most of the time is spent. This might be helpful for a choice of different solving approaches. It is possible to choose between CPU and wall clock time. Choice ‘YES’ is equivalent to ‘WALL CLOCK’.
Constraint: , , or .
- ‘Task’str
Default
This argument specifies the required direction of the optimization. If , the objective function (if set) is ignored and the algorithm stops as soon as a feasible point is found with respect to the given tolerance. If no objective function is set, ‘Task’ reverts to ‘FEASIBLE POINT’ automatically.
Constraint: , or .
- ‘Time Limit’float
Default
A limit to the number of seconds that the solver can use to solve one problem. If during the convergence check this limit is exceeded, the solver will terminate with = 23.
Constraint: .
- Raises
- NagValueError
- (errno )
has not been initialized.
- (errno )
does not belong to the NAG optimization modelling suite, has not been initialized properly or is corrupted.
- (errno )
has not been initialized properly or is corrupted.
- (errno )
This solver does not support the model defined in the handle.
- (errno )
The problem is already being solved.
- (errno )
On entry, , expected .
Constraint: must match the current number of variables of the model in the .
- (errno )
On entry, .
does not match the size of the Lagrangian multipliers for constraints.
The correct value is either or .
- (errno )
On entry, .
does not match the size of the Lagrangian multipliers for constraints.
The correct value is for no constraints.
- (errno )
On entry, .
does not match the size of the Lagrangian multipliers for second-order cone constraints.
The correct value is either or .
- (errno )
On entry, .
does not match the size of the Lagrangian multipliers for second-order cone constraints.
when there are no second-order cone constraints.
- (errno )
The problem was found to be primal infeasible.
- (errno )
The problem was found to be dual infeasible.
- Warns
- NagAlgorithmicWarning
- (errno )
Suboptimal solution.
- NagAlgorithmicMajorWarning
- (errno )
Maximum number of iterations exceeded.
- (errno )
The solver terminated after the maximum time allowed was exceeded.
- (errno )
No progress, stopping early.
- NagCallbackTerminateWarning
- (errno )
User requested termination during a monitoring step.
- Notes
handle_solve_socp_ipm
solves a large-scale SOCP optimization problem in the following formwhere is a Cartesian product of quadratic (second-order type) cones and -dimensional real space, and is the number of decision variables. Here , , and are -dimensional vectors, is an sparse matrix, and and are -dimensional vectors. Note that partitions subsets of variables into quadratic cones and each can be either a quadratic cone or a rotated quadratic cone. These are defined as follows:
Quadratic cone:
Rotated quadratic cone:
handle_solve_socp_ipm
solves SOCP problems stored as a handle. The handle points to an internal data structure which defines the problem and serves as a means of communication for functions in the NAG optimization modelling suite. First, the problem handle is initialized by callinghandle_init()
. Then some of the functionshandle_set_group()
,handle_set_linobj()
,handle_set_qconstr()
,handle_set_qconstr_fac()
,handle_set_quadobj()
,handle_set_simplebounds()
orhandle_set_linconstr()
may be called to formulate the quadratic cones, linear objective function, quadratic objective function, quadratic constraints, bounds of the variables, and the block of linear constraints, respectively. Alternatively, the whole model can be loaded from a file byhandle_read_file()
. When the handle is no longer needed,handle_free()
should be called to destroy it and deallocate the memory held within. See the E04 Introduction for more details about the NAG optimization modelling suite.The solver method can be modified by various options (see Other Parameters) which can be set by
handle_opt_set()
andhandle_opt_set_file()
anytime between the initialization of the handle and a call to the solver. Once the solver has finished, options may be modified for the next solve. The solver may be called repeatedly with various options.The option ‘Task’ may be used to switch the problem to maximization or to ignore the objective function and find only a feasible point.
Several options may have significant impact on the performance of the solver. Even if the defaults were chosen to suit the majority of problems, it is recommended that you experiment in order to find the most suitable set of options for a particular problem, see Algorithmic Details and Other Parameters for further details.
Structure of the Lagrangian Multipliers
The algorithm works internally with estimates of both the decision variables, denoted by , and the Lagrangian multipliers (dual variables), denoted by for bound and linear constraints, and for quadratic cone constraints.
If the simple bounds have been defined (
handle_set_simplebounds()
was successfully called), the first elements of belong to the corresponding Lagrangian multipliers, interleaving a multiplier for the lower and the upper bound for each . If any of the bounds were set to infinity, the corresponding Lagrangian multipliers are set to and may be ignored.Similarly, the following elements of belong to multipliers for the linear constraints (if
handle_set_linconstr()
has been successfully called). The organization is the same, i.e., the multipliers for each constraint for the lower and upper bounds are alternated and zeros are used for any missing (infinite bound) constraints.If convex quadratic constraints have been defined successfully by
handle_set_qconstr()
orhandle_set_qconstr_fac()
, denote the number of such constraints as , then the following elements of belong to multipliers for the convex quadratic constraints. The organization is the same as linear constraints.Some solvers merge multipliers for both lower and upper inequality into one element whose sign determines the inequality. Negative multipliers are associated with the upper bounds and positive with the lower bounds. An equivalent result can be achieved with this storage scheme by subtracting the upper bound multiplier from the lower one. This is also consistent with equality constraints.
Finally, the elements of are the corresponding Lagrangian multipliers for the variables in the quadratic cone constraints that have been defined by
handle_set_group()
. All multipliers are stored next to each other in array in the same order as the cone constraints were defined byhandle_set_group()
. For example, if the first cone constraint contains variables , , and the second cone constraint contains variables , , , , then the dimension of array must be and the first elements are the corresponding Lagrangian multipliers for the cone composed of , , , followed by elements that are the corresponding Lagrangian multipliers for the cone of , , , .
- References
Alizadeh, F and Goldfarb, D, 2003, Second-order cone programming, Mathematical programming (95(1)), 3–51
Andersen, E D, Roos, C and Terlaky, T, 2003, On implementing a primal-dual interior-point method for conic quadratic optimization, Mathematical programming (95(2)), 249–277
Goldfarb, D and Scheinberg, K, 2005, Product-form Cholesky factorization in interior point methods for second-order cone programming, Mathematical programming (103(1)), 153–179
Goldman, A J and Tucker, A W, 1956, Theory of linear programming, Linear inequalities and related systems (38), 53–97
Hogg, J D and Scott, J A, 2010, An indefinite sparse direct solver for large problems on multicore machines, RAL Technical Report. RAL-TR-2010-011
Hogg, J D and Scott, J A, 2011, HSL MA97: a bit-compatible multifrontal code for sparse symmetric systems, RAL Technical Report. RAL-TR-2011-024
HSL, a collection of Fortran codes for large-scale scientific computation, http://www.hsl.rl.ac.uk/
Karypis, G and Kumar, V, 1998, A fast and high quality multilevel scheme for partitioning irregular graphs, SIAM J. Sci. Comput. (20(1)), 359–392
Lobo, M S, Vandenberghe, L, Boyd, S and Levret, H, 1998, Applications of second-order cone programming, Linear Algebra and its Applications (284(1-3)), 193–228
Lustig, I J, Marsten, R E and Shanno, D F, 1992, On implementing Mehrotra’s predictor–corrector interior-point method for linear programming, SIAM J. Optim. (2(3)), 435–449
Mehrotra, S, 1992, On the implementation of a primal-dual interior point method, SIAM J. Optim. (2), 575–601
Nesterov, Y E and Todd, M J, 1997, Self-scaled barriers and interior-point methods for convex programming, Mathematics of Operations research (22(1)), 1–42
Nesterov, Y E and Todd, M J, 1998, Primal-dual interior-point methods for self-scaled cones, SIAM J. Optim. (8(2)), 324–364
Nocedal, J and Wright, S J, 2006, Numerical Optimization, (2nd Edition), Springer Series in Operations Research, Springer, New York
Sturm, J F, 2002, Implementation of Interior Point Methods for Mixed Semidefinite and Second Order Cone Optimization Problems, Optimization Methods and Software (17(6)), 151–171
Xu, X, Hung, P-F and Ye, Y, 1996, A simplified homogeneous and self-dual linear programming algorithm and its implementation, Annals of Operations Research (62(1)), 151–171