@@ -6,12 +6,35 @@ using SymbolicUtils.Code
6
6
using IfElse
7
7
using DocStringExtensions
8
8
9
- # TODO : Need to import Assignment and other stuff probably
10
- # Check out the functionality in ModelingToolkit.jl and Symbolics.jl
11
-
9
+ """
10
+ AbstractTransform
11
+
12
+ An abstract type holding possible transform options. Current options are:
13
+ - `IntervalTransform`: Only lower/upper bounds, results in 2x as many expressions/equations
14
+ (in simple cases)
15
+ - `McCormickIntervalTransform`: Lower/upper bounds and convex/concave relaxations, results in
16
+ 4x as many expressions/equations (in simple cases)
17
+ """
12
18
abstract type AbstractTransform end
13
19
14
- # ADD documentation for generic function here
20
+ """
21
+ transform_rule(::AbstractTransform, ::Equation)
22
+ transform_rule(::AbstractTransform, ::Vector{Equation})
23
+ transform_rule(::AbstractTransform, ::ModelingToolkit.ODESystem)
24
+ transform_rule(::AbstractTransform, ::Num)
25
+
26
+ Apply the desired transformation to a given expression, equation, set of equations, or ODESystem.
27
+ If the `AbstractTransform` is an `IntervalTransform`, all symbols are split into lower and upper
28
+ bounds, and the number of expressions/equations is initially doubled. `SourceCodeMcCormick` uses
29
+ the auxiliary variable method, so factorable expressions may be separated into multiple expressions
30
+ through auxiliary variables. If a `McCormickIntervalTransform` is used, all symbols are split into
31
+ lower and upper bounds and convex and concave relaxations. The number of expressions/equations
32
+ will thus be initially multiplied by 4, though additional expressions with auxiliary variables will
33
+ appear if the expression's complexity warrants it.
34
+
35
+ In either case, `shrink_eqs` can be used to progressively substitute expressions into one another
36
+ to eliminate auxiliary variables and shrink the total number of equations.
37
+ """
15
38
function transform_rule end
16
39
17
40
@@ -25,5 +48,5 @@ export apply_transform, extract_terms, genvar, genparam, get_name,
25
48
factor!, binarize!, pull_vars, shrink_eqs, convex_evaluator,
26
49
all_evaluators
27
50
28
-
51
+
29
52
end
0 commit comments