You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fixed some errors in negative-valued multiplication, and added unit testing to cover the different cases. Also added some unit testing for addition/subtraction, though it could be simplified.
Copy file name to clipboardExpand all lines: README.md
+115-2Lines changed: 115 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,106 @@
1
1
# SourceCodeMcCormick.jl
2
+
3
+
This package is an experimental approach to use source-code transformation to apply McCormick relaxations
4
+
to symbolic functions for use in deterministic global optimization. While packages like `McCormick.jl`
5
+
take set-valued McCormick objects and utilize McCormick relaxation rules to overload standard math operations,
6
+
`SourceCodeMcCormick.jl` aims to interpret symbolic expressions, apply McCormick transformations, and
7
+
return a new symbolic expression representing those relaxations. This functionality is designed to be
8
+
used for both algebraic and dynamic systems.
9
+
2
10
Experimental Approach to McCormick Relaxation Source-Code Transformation for Differential Inequalities
3
11
4
-
The purpose of this package is to transform a `ModelingToolkit` ODE system with factorable equations into a new `ModelingToolkit` ODE system with interval or McCormick relaxations applied. E.g.:
12
+
## Algebraic Systems
13
+
14
+
For a given algebraic equation or system of equations, `SourceCodeMcCormick` is designed to provide
15
+
symbolic transformations that represent the lower/upper bounds and convex/concave relaxations of the
16
+
provided equation(s). Most notably, `SourceCodeMcCormick` uses this symbolic transformation to
17
+
generate "evaluation functions" which, for a given expression, return the lower/upper bounds and
18
+
convex/concave relaxations of an expression. E.g.:
19
+
20
+
```
21
+
using SourceCodeMcCormick, Symbolics
22
+
23
+
@variables x
24
+
to_compute = x*(15+x)^2
25
+
x_lo_eval, x_hi_eval, x_cv_eval, x_cc_eval, order = all_evaluators(to_compute)
26
+
```
27
+
28
+
Here, the outputs marked `_eval` are the evaluation functions for the lower bound (`lo`), upper
29
+
bound (`hi`), convex underestimator (`cv`), and concave overestimator (`cc`) of the `to_compute`
30
+
expression. The inputs to each of these functions are described by the `order` vector, which
31
+
in this case is `[x_cc, x_cv, x_hi, x_lo]`.
32
+
33
+
There are several important benefits of using these functions. First, they are fast. Normally,
34
+
applying McCormick relaxations takes some time as the relaxation depends on the provided bounds
35
+
and relaxation values of the input(s), but also on the form of the expression itself. Packages
36
+
like `McCormick.jl` use control flow to quickly determine the form of the relaxations and provide
37
+
McCormick objects of the results, but because the forms of the expressions are not known *a priori*,
38
+
this control flow takes time to process. In contrast, `SourceCodeMcCormick` effectively hard-codes
39
+
the relaxations for a specific, pre-defined function into the evaluation functions, making it
where `x_lo < x_cv < x < x_cc < x_hi`. This new system of ODEs is generated using GPU-compatible language--i.e., any decision points in the form of the resulting equation based on some terms being positive or negative are handled by IfElse.ifelse statements and/or min/max evaluations. By using only these types of expressions, multiple trajectories of the resulting ODE system can be solved simultaneously on a GPU, such as by using `DiffEqGPU` in the SciML ecosystem.
142
+
where `x_lo < x_cv < x < x_cc < x_hi`. Only addition is shown in this example, as other operations
143
+
can appear very expansive, but the same operations available for algebraic systems are available
144
+
for dynamic systems as well. As with the algebraic evaluation functions, equations created by
145
+
`SourceCodeMcCormick` are GPU-ready--multiple trajectories of the resulting ODE system at
146
+
different points and with different state/parameter bounds can be solved simultaneously using
147
+
an `EnsembleProblem` in the SciML ecosystem, and GPU hardware can be applied for these solves
148
+
using `DiffEqGPU.jl`.
149
+
150
+
## Limitations
151
+
152
+
Currently, as proof-of-concept, `SourceCodeMcCormick` can only handle functions with
153
+
addition (+), subtraction (-), multiplication (\*), powers of 2 (^2), natural base
154
+
exponentials (exp), and minimum/maximum (min/max) expressions. Future work will include
0 commit comments