Skip to content

Commit

Permalink
minor change
Browse files Browse the repository at this point in the history
  • Loading branch information
luk036 committed Oct 11, 2024
1 parent 57780e3 commit 9c90dab
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 2 deletions.
12 changes: 12 additions & 0 deletions notes.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
## Cutting Plane Feasibility Algorithm

```python
def cutting_plane_feas(omega, space, options=Options()):
for niter in range(options.max_iters):
cut = omega.assess_feas(space.xc()) # query the oracle at space.xc()
if cut is None: # feasible solution obtained
return space.xc(), niter
status = space.update_bias_cut(cut) # update space
if status != CutStatus.Success or space.tsq() < options.tolerance:
return None, niter
return None, options.max_iters
```

This code defines a function called cutting_plane_feas which implements a cutting plane algorithm for finding a feasible point in a convex set. The purpose of this algorithm is to solve a feasibility problem, which means finding a point that satisfies certain constraints.

The function takes three inputs:
Expand Down
25 changes: 25 additions & 0 deletions src/ellalgo/cutting_plane.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,28 @@
"""
Cutting Plane Algorithm Implementation
This code implements various cutting plane algorithms, which are optimization techniques used to solve convex optimization problems. The main purpose of these algorithms is to find optimal or feasible solutions within a given search space.
The code defines several functions that take different inputs:
1. cutting_plane_feas: Takes an oracle (a function that assesses feasibility), a search space, and options.
2. cutting_plane_optim: Takes an optimization oracle, a search space, an initial best value (gamma), and options.
3. cutting_plane_optim_q: Similar to cutting_plane_optim, but for quantized discrete optimization problems.
4. bsearch: Performs a binary search using an oracle and an interval.
These functions generally output a solution (if found), the best value achieved, and the number of iterations performed.
The algorithms work by iteratively refining the search space. They start with an initial point and ask the oracle to assess it. The oracle either confirms the point is feasible/optimal or provides a "cut" - information about how to improve the solution. The search space is then updated based on this cut, and the process repeats until a solution is found or the maximum number of iterations is reached.
An important concept in these algorithms is the "cut". A cut is like a hint that tells the algorithm which parts of the search space to exclude, helping it focus on more promising areas. The search space is continuously shrunk based on these cuts until a solution is found or the space becomes too small.
The code also includes a BSearchAdaptor class, which adapts a feasibility oracle to work with the binary search algorithm. This allows the binary search to be used in solving certain types of optimization problems.
Throughout the code, there's a focus on handling different types of problems (feasibility, optimization, discrete optimization) and different types of search spaces. The algorithms are designed to be flexible and work with various problem types.
In summary, this code provides a toolkit for solving different types of optimization problems using cutting plane methods. It's designed to be adaptable to various problem types and to efficiently search for solutions by iteratively refining the search space based on feedback from problem-specific oracles.
"""

import copy
from typing import Any, MutableSequence, Optional, Tuple, Union

Expand Down
4 changes: 2 additions & 2 deletions src/ellalgo/oracles/lmi_oracle.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ class LMIOracle(OracleFeas):
This oracle solves the following feasibility problem:
find x
s.t. (B − F * x) ⪰ 0
| find x
| s.t. (B − F * x) ⪰ 0
"""

Expand Down

0 comments on commit 9c90dab

Please sign in to comment.