How to use the osqp._osqp function in osqp

To help you get started, we’ve selected a few osqp examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github oxfordcontrol / osqp-python / module / utils.py View on Github external
def linsys_solver_str_to_int(settings):
        linsys_solver_str = settings.pop('linsys_solver', '')
        if not isinstance(linsys_solver_str, str):
            raise TypeError("Setting linsys_solver " +
                            "is required to be a string.")
        linsys_solver_str = linsys_solver_str.lower()
        if linsys_solver_str == 'qdldl':
            settings['linsys_solver'] = _osqp.constant('QDLDL_SOLVER')
        elif linsys_solver_str == 'mkl pardiso':
            settings['linsys_solver'] = _osqp.constant('MKL_PARDISO_SOLVER')
        # Default solver: QDLDL
        elif linsys_solver_str == '':
            settings['linsys_solver'] = _osqp.constant('QDLDL_SOLVER')
        else:   # default solver: QDLDL
            warn("Linear system solver not recognized. " +
                 "Using default solver QDLDL.")
            settings['linsys_solver'] = _osqp.constant('QDLDL_SOLVER')
        return settings
github oxfordcontrol / osqp-python / module / interface.py View on Github external
if l is not None:
            if not isinstance(l, np.ndarray):
                raise TypeError("l must be numpy.ndarray, not %s" %
                                type(l).__name__)
            elif len(l) != m:
                raise ValueError("l must have length m")
            # Convert values to -OSQP_INFTY
            l = np.maximum(l, -_osqp.constant('OSQP_INFTY'))
        if u is not None:
            if not isinstance(u, np.ndarray):
                raise TypeError("u must be numpy.ndarray, not %s" %
                                type(u).__name__)
            elif len(u) != m:
                raise ValueError("u must have length m")
            # Convert values to OSQP_INFTY
            u = np.minimum(u, _osqp.constant('OSQP_INFTY'))
        if Ax is None:
            if len(Ax_idx) > 0:
                raise ValueError("Vector Ax has not been specified")
        else:
            if len(Ax_idx) > 0 and len(Ax) != len(Ax_idx):
                raise ValueError("Ax and Ax_idx must have the same lengths")
        if Px is None:
            if len(Px_idx) > 0:
                raise ValueError("Vector Px has not been specified")
        else:
            if len(Px_idx) > 0 and len(Px) != len(Px_idx):
                raise ValueError("Px and Px_idx must have the same lengths")
        if q is None and l is None and u is None and Px is None and Ax is None:
            raise ValueError("No updatable data has been specified")

        # update linear cost
github oxfordcontrol / osqp-python / module / utils.py View on Github external
def linsys_solver_str_to_int(settings):
        linsys_solver_str = settings.pop('linsys_solver', '')
        if not isinstance(linsys_solver_str, str):
            raise TypeError("Setting linsys_solver " +
                            "is required to be a string.")
        linsys_solver_str = linsys_solver_str.lower()
        if linsys_solver_str == 'qdldl':
            settings['linsys_solver'] = _osqp.constant('QDLDL_SOLVER')
        elif linsys_solver_str == 'mkl pardiso':
            settings['linsys_solver'] = _osqp.constant('MKL_PARDISO_SOLVER')
        # Default solver: QDLDL
        elif linsys_solver_str == '':
            settings['linsys_solver'] = _osqp.constant('QDLDL_SOLVER')
        else:   # default solver: QDLDL
            warn("Linear system solver not recognized. " +
                 "Using default solver QDLDL.")
            settings['linsys_solver'] = _osqp.constant('QDLDL_SOLVER')
        return settings

osqp

OSQP: The Operator Splitting QP Solver

Apache-2.0
Latest version published 28 days ago

Package Health Score

79 / 100
Full package analysis