Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,6 @@ Manifest.toml

# VSCode
.vscode/

# random test of some new things
trial/
12 changes: 9 additions & 3 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "Interesso"
uuid = "6fc4ee9f-0a6c-4ef5-81c0-9afe0a8161a6"
authors = ["astroEduardo <72969764+astroEduardo@users.noreply.github.com> and contributors"]
version = "0.1.0"
authors = ["astroEduardo <72969764+astroEduardo@users.noreply.github.com> and contributors"]

[deps]
DynOptInterface = "6c38235a-427b-4736-80fa-cf75909744ec"
Expand All @@ -10,9 +10,15 @@ Ipopt = "b6b21f68-93f8-5de0-b562-5493be1d77c9"
MathOptInterface = "b8f27783-ece8-5eb3-8dc8-9495eed66fee"
OrderedCollections = "bac558e1-5e72-5ebc-8fee-abe8a469f55d"

[weakdeps]
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"

[extensions]
InteressoPlots = "Plots"

[compat]
MathOptInterface = "1.31"
julia = "1.6"
MathOptInterface = ">=1.38"
julia = ">=1.6"

[extras]
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[//]: Logo
<p align="center">
<img
src="./docs/src/assets/logo256px.svg"
src="./docs/src/assets/logo.svg"
width=256px
>
</p>
Expand Down
210 changes: 85 additions & 125 deletions docs/src/assets/logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
69 changes: 69 additions & 0 deletions example/aly_chan.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
function aly_chan(
model::Interesso.Optimizer;
starts::Interesso.WSS=Interesso.WSS{DOI.AbstractDynamicSolution}()
)

MOI.empty!(model)

## Time as a phase
t = DOI.add_phase(model)
MOI.add_constraint(model, DOI.Initial(t), MOI.EqualTo(0.0))
MOI.add_constraint(model, DOI.Final(t), MOI.EqualTo(π/2))

## Input Dynamic Variable
@variable(model, u, t)
MOI.add_constraint(model, u, MOI.Interval(-1.0, 1.0))

## State Dynamic Variables
@variable(model, x, t)
@variable(model, v, t)
@variable(model, cost, t)

## Boundary Conditions
MOI.add_constraint(model, DOI.Initial(x), MOI.EqualTo(0.0))
MOI.add_constraint(model, DOI.Initial(v), MOI.EqualTo(1.0))
MOI.add_constraint(model, DOI.Initial(cost), MOI.EqualTo(0.0))

# # Starts

## Differential Equations

MOI.add_constraint(
model,
DOI.ExplicitDifferentialFunction(
v,
NDF(:+, Any[u], t),
),
MOI.EqualTo(0.0),
)

MOI.add_constraint(
model,
DOI.ExplicitDifferentialFunction(
x,
NDF(:+, Any[v], t),
),
MOI.EqualTo(0.0),
)

MOI.add_constraint(
model,
DOI.ExplicitDifferentialFunction(
cost,
NDF(:-, [
NDF(:*, [0.5, NDF(:^, [v, 2.0], t)], t),
NDF(:*, [0.5, NDF(:^, [x, 2.0], t)], t),
], t)
),
MOI.EqualTo(0.0),
)

## Objective Function
MOI.set(model, MOI.ObjectiveSense(), MOI.MIN_SENSE)
obj_fun = DOI.NonlinearBoundaryFunction(:+, [DOI.Final(cost)])
MOI.set(model, MOI.ObjectiveFunction{typeof(obj_fun)}(), obj_fun)

Interesso.warmstart!(model, starts)

return nothing
end
Loading