Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Alt models #209

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
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
9 changes: 5 additions & 4 deletions src/onepass.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# onepass
# todo:
# - write code = ... then _wrap(code) for all p_...
# - cannot call solve if problem not fully defined (dynamics not defined...)
# - doc: explain projections wrt to t0, tf, t; (...x1...x2...)(t) -> ...gensym1...gensym2... (most internal first)
# - test non autonomous cases
Expand Down Expand Up @@ -67,13 +68,13 @@ Foo
```
"""
parse!(p, ocp, e; log=false) = begin
#

p.lnum = p.lnum + 1
p.line = string(e)
for a ∈ keys(p.aliases)
e = subs(e, a, p.aliases[a])
end
#

@match e begin
# aliases
:( $a = $e1 ) =>
Expand All @@ -84,7 +85,7 @@ parse!(p, ocp, e; log=false) = begin
:( [$names] ∈ R^$n, state ) => p_state!(p, ocp, a, n; components_names=names, log)
:( ($names) ∈ R^$m, control ) => p_control!(p, ocp, a, m; components_names=names, log)
:( [$names] ∈ R^$m, control ) => p_control!(p, ocp, a, m; components_names=names, log)
_ => p_alias!(p, ocp, a, e1; log) # alias
_ => p_alias!(p, ocp, a, e1; log) # alias
end
# variable
:( $v ∈ R^$q, variable ) => p_variable!(p, ocp, v, q; log)
Expand Down Expand Up @@ -486,4 +487,4 @@ macro def(ocp, e, log=false)
catch ex
:( throw($ex) ) # can be caught by user
end
end
end
Loading