Skip to content

Commit

Permalink
Update docs for rotated SOC and exp cone
Browse files Browse the repository at this point in the history
  • Loading branch information
metab0t committed Jul 4, 2024
1 parent 0a5623c commit 17bc2d7
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 1 deletion.
1 change: 1 addition & 0 deletions docs/source/changelog.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Changelog

## Unreleased change
- Add rotated second-order cone and exponential cone support for COPT and Mosek

## 0.2.5
- Fix `add_linear_constraint` of HiGHS optimizer to consider the constant term in expression correctly
Expand Down
34 changes: 33 additions & 1 deletion docs/source/constraint.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,12 +115,44 @@ vars = [model.add_variable() for i in range(N)]
con = model.add_second_order_cone_constraint(vars)
```

```{py:function} model.add_second_order_cone_constraint(variables, [name=""])
Some optimizers (COPT, Mosek) support another form of second-order cone constraint called as rotated second-order cone constraint, which is defined as:

$$
variables=(t_{1},t_{2},x) \in \mathbb{R}^{N} : 2 t_1 t_2 \ge \lVert x \rVert_2^2
$$

```{py:function} model.add_second_order_cone_constraint(variables, [name="", rotated=False])
add a second order cone constraint to the model
:param variables: the variables of the constraint, can be a list of variables
:param str name: the name of the constraint, optional
:param bool rotated: whether the constraint is a rotated second-order cone constraint, optional
:return: the handle of the constraint
```

## Exponential Cone Constraint
It is defined as:

$$
variables=(t,s,r) \in \mathbb{R}^{3} : t \ge s \exp(\frac{r}{s}), s \ge 0
$$

The dual form is:

$$
variables=(t,s,r) \in \mathbb{R}^{3} : t \ge -r \exp(\frac{s}{r} - 1), r \le 0
$$

Currently, only COPT(after 7.1.4), Mosek support exponential cone constraint. It can be added to the model using the `add_exp_cone_constraint` method of the `Model` class.

```{py:function} model.add_exp_cone_constraint(variables, [name="", dual=False])
add a second order cone constraint to the model
:param variables: the variables of the constraint, can be a list of variables
:param str name: the name of the constraint, optional
:param bool dual: whether the constraint is dual form of exponential cone, optional
:return: the handle of the constraint
```

Expand Down
2 changes: 2 additions & 0 deletions docs/source/copt.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ model = copt.Model(env)
-
* - <project:#model.add_second_order_cone_constraint>
-
* - <project:#model.add_exp_cone_constraint>
-
* - <project:#model.add_sos_constraint>
-

Expand Down
2 changes: 2 additions & 0 deletions docs/source/mosek.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ model = mosek.Model(env)
-
* - <project:#model.add_second_order_cone_constraint>
-
* - <project:#model.add_exp_cone_constraint>
-
* - <project:#model.add_sos_constraint>
-

Expand Down

0 comments on commit 17bc2d7

Please sign in to comment.