Austin Schuh | 9049e20 | 2022-02-20 17:34:16 -0800 | [diff] [blame] | 1 | .. _c_interface: |
| 2 | |
| 3 | C |
| 4 | ===== |
| 5 | |
| 6 | |
| 7 | |
| 8 | |
| 9 | .. _C_main_API: |
| 10 | |
| 11 | Main solver API |
| 12 | --------------- |
| 13 | |
| 14 | The main C API is imported from the header :code:`osqp.h` and provides the following functions |
| 15 | |
| 16 | |
| 17 | .. doxygenfunction:: osqp_setup |
| 18 | |
| 19 | .. doxygenfunction:: osqp_solve |
| 20 | |
| 21 | .. doxygenfunction:: osqp_cleanup |
| 22 | |
| 23 | |
| 24 | .. _C_sublevel_API: |
| 25 | |
| 26 | Sublevel API |
| 27 | ------------ |
| 28 | Sublevel C API is also imported from the header :code:`osqp.h` and provides the following functions |
| 29 | |
| 30 | Warm start |
| 31 | ^^^^^^^^^^ |
| 32 | OSQP automatically warm starts primal and dual variables from the previous QP solution. If you would like to warm start their values manually, you can use |
| 33 | |
| 34 | .. doxygenfunction:: osqp_warm_start |
| 35 | |
| 36 | .. doxygenfunction:: osqp_warm_start_x |
| 37 | |
| 38 | .. doxygenfunction:: osqp_warm_start_y |
| 39 | |
| 40 | |
| 41 | .. _c_cpp_update_data : |
| 42 | |
| 43 | Update problem data |
| 44 | ^^^^^^^^^^^^^^^^^^^ |
| 45 | Problem data can be updated without executing the setup again using the following functions. |
| 46 | |
| 47 | .. doxygenfunction:: osqp_update_lin_cost |
| 48 | |
| 49 | .. doxygenfunction:: osqp_update_lower_bound |
| 50 | |
| 51 | .. doxygenfunction:: osqp_update_upper_bound |
| 52 | |
| 53 | .. doxygenfunction:: osqp_update_bounds |
| 54 | |
| 55 | .. doxygenfunction:: osqp_update_P |
| 56 | |
| 57 | .. doxygenfunction:: osqp_update_A |
| 58 | |
| 59 | .. doxygenfunction:: osqp_update_P_A |
| 60 | |
| 61 | |
| 62 | |
| 63 | .. _c_cpp_data_types : |
| 64 | |
| 65 | Data types |
| 66 | ---------- |
| 67 | |
| 68 | The most basic used datatypes are |
| 69 | |
| 70 | * :code:`c_int`: can be :code:`long` or :code:`int` if the compiler flag :code:`DLONG` is set or not |
| 71 | * :code:`c_float`: can be a :code:`float` or a :code:`double` if the compiler flag :code:`DFLOAT` is set or not. |
| 72 | |
| 73 | |
| 74 | |
| 75 | The relevant structures used in the API are |
| 76 | |
| 77 | Data |
| 78 | ^^^^ |
| 79 | |
| 80 | .. doxygenstruct:: OSQPData |
| 81 | :members: |
| 82 | |
| 83 | The matrices are defined in `Compressed Sparse Column (CSC) format <https://people.sc.fsu.edu/~jburkardt/data/cc/cc.html>`_ using zero-based indexing. |
| 84 | |
| 85 | .. doxygenstruct:: csc |
| 86 | :members: |
| 87 | |
| 88 | Settings |
| 89 | ^^^^^^^^ |
| 90 | |
| 91 | .. doxygenstruct:: OSQPSettings |
| 92 | :members: |
| 93 | |
| 94 | Solution |
| 95 | ^^^^^^^^ |
| 96 | |
| 97 | .. doxygenstruct:: OSQPSolution |
| 98 | :members: |
| 99 | |
| 100 | Info |
| 101 | ^^^^^ |
| 102 | |
| 103 | .. doxygenstruct:: OSQPInfo |
| 104 | :members: |
| 105 | |
| 106 | Workspace |
| 107 | ^^^^^^^^^ |
| 108 | |
| 109 | .. doxygenstruct:: OSQPWorkspace |
| 110 | :members: |
| 111 | |
| 112 | |
| 113 | Scaling |
| 114 | ^^^^^^^ |
| 115 | |
| 116 | .. doxygenstruct:: OSQPScaling |
| 117 | :members: |
| 118 | |
| 119 | Polish |
| 120 | ^^^^^^ |
| 121 | .. doxygenstruct:: OSQPPolish |
| 122 | :members: |
| 123 | |
| 124 | |
| 125 | |
| 126 | .. TODO: Add sublevel API |
| 127 | .. TODO: Add using your own linear system solver |