@@ -59,37 +59,45 @@ Convex.jl. Let's say you're adding the new function $f$.
59
59
60
60
## Fixing the guts
61
61
62
- If you want to do a more major bug fix, you may need to understand how
63
- Convex.jl thinks about conic form. To do this, start by reading [ the
64
- Convex.jl paper] ( http://arxiv.org/pdf/1410.4821.pdf ) . You may find our
65
- [ JuliaCon 2014 talk] ( https://www.youtube.com/watch?v=SoI0lEaUvTs&t=128s )
62
+ If you want to do a more major bug fix, you may need to understand how Convex.jl
63
+ thinks about conic form.
64
+
65
+ To do this, start by reading [ the Convex.jl paper] ( http://arxiv.org/pdf/1410.4821.pdf ) .
66
+
67
+ You may find our [ JuliaCon 2014 talk] ( https://www.youtube.com/watch?v=SoI0lEaUvTs&t=128s )
66
68
helpful as well; you can find the Jupyter notebook presented in the talk
67
69
[ here] ( https://github.com/JuliaCon/presentations/tree/master/CVX ) .
68
70
69
- Convex has been updated several times over the years however, so older information
70
- may be out of date. Here is a brief summary of how the package works (as of July 2023).
71
-
72
- 1 . A ` Problem{T} ` struct is created by putting together an objective function and constraints.
73
- This forms a tree of sorts, in which variables and constants are the leaves, and atoms form the
74
- intermediate branches. Here ` T ` refers to the numeric type of the problem. Variables and constants don't have such a type, and can
75
- be used in multiple problems with different types. We only have the final type when we have
76
- constructed the problem itself at the end.
77
- 2 . When we go to ` solve! ` a problem, we first load it into a MathOptInterface (MOI) model.
78
- To do so, we need to traverse the problem and apply our extended formulations. This occurs
79
- via ` conic_form! ` . We construct a ` Context{T} ` associated to the problem, which holds an MOI
80
- model, and progressively load it by applying ` conic_form! ` to each object's children and then itself.
81
- For variables outputs of ` conic_form! ` are of types: ` SparseTape{T} ` or ` ComplexTape{T} ` ,
82
- depending on the sign variable. Likewise for constant, the outputs of ` conic_form! ` are either ` Vector{T} `
83
- or ` ComplexStructOfVec{T} ` . Here a ` Tape ` refers to a lazy sequence of sparse affine
84
- operators that will be applied to a vector of variables. The central computational task of Convex
85
- is to compose this sequence of operators (and thus enact it's extended formulations). For atoms,
86
- ` conic_form! ` generally either creates a new object using Convex' primitives (for example, another problem)
87
- and calls ` conic_form! ` on that, or, when that isn't possible, calls ` operate ` to
88
- manipulate the tape objects themselves (for example, to add a new operation to the composition).
89
- We try to minimize the amount of ` operate ` methods and defer to existing primitives when possible.
90
- ` conic_form! ` can also create new constraints and add them directly to the model. It is easy
91
- to create constraints of the form "vector-affine-function-in-cone" for any of MOI's many supported cones;
92
- these constraints do not need to be exposed at the level of Convex itself as ` Constraint ` objects, although they can be.
71
+ Convex has been updated several times over the years however, so older
72
+ information may be out of date. Here is a brief summary of how the package works
73
+ (as of July 2023).
74
+
75
+ 1 . A ` Problem{T} ` struct is created by putting together an objective function
76
+ and constraints. The problem is an expression graph, in which variables and
77
+ constants are the leaf nodes, and atoms form the intermediate nodes. Here ` T `
78
+ refers to the numeric type of the problem that all data coefficients will be
79
+ coerced to when we pass the data to a solver.
80
+ 2 . When we go to ` solve! ` a problem, we first load it into a MathOptInterface
81
+ (MOI) model. To do so, we traverse the ` Problem ` and apply our extended
82
+ formulations. This occurs via ` conic_form! ` . We construct a ` Context{T} `
83
+ associated to the problem, which holds an MOI model, and progressively load
84
+ it by applying ` conic_form! ` to each object's children and then itself. For
85
+ variables, ` conic_form! ` returns ` SparseTape{T} ` or ` ComplexTape{T} ` ,
86
+ depending on the sign variable. Likewise for constants, ` conic_form! ` returns
87
+ either ` Vector{T} ` or ` ComplexStructOfVec{T} ` . Here a ` Tape ` refers to a lazy
88
+ sequence of sparse affine operators that will be applied to a vector of
89
+ variables. The central computational task of Convex is to compose this
90
+ sequence of operators (and thus enact it's extended formulations). For atoms,
91
+ ` conic_form! ` generally either creates a new object using Convex' primitives
92
+ (for example, another problem) and calls ` conic_form! ` on that, or, when that
93
+ isn't possible, calls ` operate ` to manipulate the tape objects themselves
94
+ (for example, to add a new operation to the composition). We try to minimize
95
+ the amount of ` operate ` methods and defer to existing primitives when possible.
96
+ ` conic_form! ` can also create new constraints and add them directly to the
97
+ model. It is easy to create constraints of the form "vector-affine-function-in-cone"
98
+ for any of MOI's many supported cones; these constraints do not need to be
99
+ exposed at the level of Convex itself as ` Constraint ` objects, although they
100
+ can be.
93
101
3 . Once we have filled our ` Context{T} ` , we go to solve it with MOI. Then we
94
102
recover the solution status and values of primal and dual variables, and
95
103
populate them using dictionaries stored in the ` Context ` .
0 commit comments