Skip to content

Commit

Permalink
fix various stuff in docs
Browse files Browse the repository at this point in the history
  • Loading branch information
exaexa committed Sep 16, 2023
1 parent 972cc2f commit 787a64c
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 12 deletions.
2 changes: 1 addition & 1 deletion docs/src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@

```@autodocs
Modules = [ConstraintTrees]
Pages = ["ConstraintTrees.jl"]
Pages = ["src/ConstraintTrees.jl"]
```
2 changes: 1 addition & 1 deletion docs/src/metabolic-modeling.jl
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ sum(C.value.(values(c.fluxes)))
# To demonstrate, let's make a small system with 2 variables.
system = C.allocate_variables(keys = [:x, :y])

# To add an affine element to a [`Value`](@ref), simply add it as a `Real`
# To add an affine element to a `Value`, simply add it as a `Real`
# number, as in the linear transformations below:
system =
:original_coords^system *
Expand Down
11 changes: 6 additions & 5 deletions docs/src/quadratic-optimization.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
#
# In this example we demonstrate the use of quadratic constraints and values.
# We assume that the reader is already familiar with the construction of
# [`ConstraintTree`](@ref)s; if not, it is advisable to read the previous part
# `ConstraintTree`s; if not, it is advisable to read the previous part
# of the documentation first.
#
# In short, quadratic values and constraints are expressed similarly as other
# contents of the constraint trees using types [`QValue`](@ref) and
# [`QConstraint`](@ref), which are quadratic alikes of the linear
# [`Value`](@ref) and [`Constraint`](@ref).
# contents of the constraint trees using types `QValue` and
# `QConstraint`, which are quadratic alikes of the linear
# `Value` and `Constraint`.
#
# ## Working with quadratic values and constraints
#
Expand Down Expand Up @@ -58,7 +58,7 @@ point = C.allocate_variables(keys = [:x, :y])
ellipse_system = C.make_constraint_tree(
:point => point,
:in_area => C.QConstraint(
qvalue = squared(point.x.value / 2) + squared(10.0 - point.y.value),
qvalue = squared(point.x.value) / 4 + squared(10.0 - point.y.value),
bound = (-Inf, 1.0),
),
);
Expand Down Expand Up @@ -127,6 +127,7 @@ function optimized_vars(cs::C.ConstraintTree, objective::Union{C.Value,C.QValue}
add_constraint.(values(c))
end
add_constraint(cs)
JuMP.set_silent(model)
JuMP.optimize!(model)
JuMP.value.(model[:x])
end
Expand Down
33 changes: 28 additions & 5 deletions docs/src/reference.md
Original file line number Diff line number Diff line change
@@ -1,30 +1,53 @@

# Reference

## Values (linear combinations of variables)
## Values

### Linear and affine values

```@autodocs
Modules = [ConstraintTrees]
Pages = ["src/value.jl"]
```

### Quadratic values

```@autodocs
Modules = [ConstraintTrees]
Pages = ["value.jl"]
Pages = ["src/qvalue.jl"]
```

## Constraints

```@autodocs
Modules = [ConstraintTrees]
Pages = ["constraint.jl"]
Pages = ["src/bound.jl"]
```

### Linear and affine constraints

```@autodocs
Modules = [ConstraintTrees]
Pages = ["src/constraint.jl"]
```

### Quadratic constraints

```@autodocs
Modules = [ConstraintTrees]
Pages = ["src/qconstraint.jl"]
```

## Constraint trees

```@autodocs
Modules = [ConstraintTrees]
Pages = ["constraint_tree.jl"]
Pages = ["src/constraint_tree.jl"]
```

## Solution trees

```@autodocs
Modules = [ConstraintTrees]
Pages = ["solution.jl"]
Pages = ["src/solution_tree.jl"]
```

0 comments on commit 787a64c

Please sign in to comment.