Skip to content

Commit

Permalink
add CVXPY interface to documentation and add update function to getti…
Browse files Browse the repository at this point in the history
…ng started
  • Loading branch information
RSchwan committed May 24, 2024
1 parent d7fa707 commit b6711d5
Show file tree
Hide file tree
Showing 5 changed files with 104 additions and 0 deletions.
16 changes: 16 additions & 0 deletions docs/interfaces/CVXPY/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
title: CVXPY
layout: default
nav_order: 5
parent: Interfaces
---

Since [CVXPY](https://www.cvxpy.org/) 1.4, PIQP is a supported solver.

To use PIQP as the solver, solve your problem with

```python
problem.solve(solver=PIQP)
```

For more detailed information and options see the [CVXPY documentation](https://www.cvxpy.org/tutorial/solvers/index.html).
25 changes: 25 additions & 0 deletions docs/interfaces/c_cpp/getting_started_c.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ data->G = piqp_csc_matrix(data->m, data->n, G_nnz, G_p, G_i, G_x);

`piqp_csc_matrix(...)` is a helper function allocating a `piqp_csc` struct and filling its fields accordingly.

{: .note }
Every member in `data`, except `P` and `c`, is optional and may be `NULL`.

## Settings

To set custom settings, a `piqp_settings` struct has to be instantiated and the default settings have to be set:
Expand Down Expand Up @@ -131,3 +134,25 @@ The result of the optimization can be obtained from the `work->result` struct. M

{: .warning }
Timing information like `work->result->info.run_time` is only measured if `settings->compute_timings` is set to `1`.

## Efficient Problem Updates

Instead of creating a new solver object everytime it's possible to update the problem directly using

```c
// dense interface
piqp_update_dense(&work, P, c, A, b, G, h, x_lb, x_ub);
// or sparse interface
piqp_update_sparse(&work, P, c, A, b, G, h, x_lb, x_ub);
```
with a subsequent call to
```c
piqp_status status = piqp_solve(work);
```

This allows the solver to internally reuse memory and factorizations speeding up subsequent solves. Similar to the `piqp_setup_*` functions, all parameters are optional and `NULL` may be passed instead.

{: .warning }
Note the dimension and sparsity pattern of the problem are not allowed to change when calling the `piqp_update_*` functions.
22 changes: 22 additions & 0 deletions docs/interfaces/c_cpp/getting_started_cpp.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ We can now set up the problem using
solver.setup(P, c, A, b, G, h, x_lb, x_ub);
```

{: .note }
Every variable except `P` and `c` are optional and `laopt::nullopt` may be passed.

The data is internally copied, and the solver initializes all internal data structures.

Now, the problem can be solver using
Expand All @@ -119,3 +122,22 @@ The result of the optimization can be obtained from the `solver.result()` object

{: .warning }
Timing information like `solver.result().info.run_time` is only measured if `solver.settings().compute_timings` is set to `true`.

## Efficient Problem Updates

Instead of creating a new solver object everytime it's possible to update the problem directly using

```c++
solver.update(P, c, A, b, G, h, x_lb, x_ub);
```

with a subsequent call to

```c++
piqp::Status status = solver.solve();
```

This allows the solver to internally reuse memory and factorizations speeding up subsequent solves. Similar to the `setup` function, all parameters are optional and `laopt::nullopt` may be passed instead.

{: .warning }
Note the dimension and sparsity pattern of the problem are not allowed to change when calling the `update` function.
19 changes: 19 additions & 0 deletions docs/interfaces/matlab/getting_started.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,3 +83,22 @@ The result of the optimization are directly returned. More specifically, the mos

{: .warning }
Timing information like `result.info.run_time` is only measured if `compute_timings` is set to `true`.

## Efficient Problem Updates

Instead of creating a new solver object everytime it's possible to update the problem directly using

```matlab
solver.update('P', P_new, 'A', A_new, 'b', b_new, ...);
```

with a subsequent call to

```matlab
result = solver.solve()
```

This allows the solver to internally reuse memory and factorizations speeding up subsequent solves.

{: .warning }
Note the dimension and sparsity pattern of the problem are not allowed to change when calling the `update` function.
22 changes: 22 additions & 0 deletions docs/interfaces/python/getting_started.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ We can now set up the problem using
solver.setup(P, c, A, b, G, h, x_lb, x_ub)
```

{: .note }
Every variable except `P` and `c` are optional and `None` may be passed.

The data is internally copied, and the solver initializes all internal data structures.

Now, the problem can be solver using
Expand All @@ -96,3 +99,22 @@ The result of the optimization can be obtained from the `solver.result` object.

{: .warning }
Timing information like `solver.result.info.run_time` is only measured if `solver.settings.compute_timings` is set to `true`.

## Efficient Problem Updates

Instead of creating a new solver object everytime it's possible to update the problem directly using

```python
solver.update(P, c, A, b, G, h, x_lb, x_ub)
```

with a subsequent call to

```python
status = solver.solve()
```

This allows the solver to internally reuse memory and factorizations speeding up subsequent solves. Similar to the `setup` function, all parameters are optional and `None` may be passed instead.

{: .warning }
Note the dimension and sparsity pattern of the problem are not allowed to change when calling the `update` function.

0 comments on commit b6711d5

Please sign in to comment.