osqp / osqp-python

Python interface for OSQP

Home Page:https://osqp.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Wrap generated C code with tiny python functionalities

bstellato opened this issue · comments

Main idea:

  • Generate setup.py similarly to pre-1.0 versions
  • Wrap these functionalities with new pybind11-based code
    static PyMethodDef PYTHON_EXT_NAME_methods[] = {
    {"solve", (PyCFunction)OSQP_solve, METH_NOARGS, "Solve QP"},
    {"update_lin_cost", (PyCFunction)OSQP_update_lin_cost, METH_VARARGS, "Update linear cost"},
    {"update_lower_bound", (PyCFunction)OSQP_update_lower_bound, METH_VARARGS, "Update lower bound"},
    {"update_upper_bound", (PyCFunction)OSQP_update_upper_bound, METH_VARARGS, "Update upper bound"},
    {"update_bounds", (PyCFunction)OSQP_update_bounds, METH_VARARGS, "Update bounds"},
    #if EMBEDDED != 1
    {"update_P", (PyCFunction)OSQP_update_P, METH_VARARGS, "Update matrix P"},
    {"update_A", (PyCFunction)OSQP_update_A, METH_VARARGS, "Update matrix A"},
    {"update_P_A", (PyCFunction)OSQP_update_P_A, METH_VARARGS, "Update matrices P and A"},
    #endif
    {NULL, NULL, 0, NULL}
    };
    The update ones are combined now.
  • Simplify solution structure as in
    return Py_BuildValue("OOiid", x, y, (&workspace)->info->status_val,
    (&workspace)->info->iter, solve_time);
  • Compile python wrapper as in the pre-1.0 version

This is complete now in develop-1.0