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

BVProblem with constraints #3323

Open
wants to merge 57 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
9733460
init
vyudu Nov 22, 2024
d95e4a7
Merge remote-tracking branch 'origin/master' into MTK
vyudu Nov 22, 2024
b3da813
up
vyudu Dec 1, 2024
86c82ce
Merge remote-tracking branch 'origin/master' into MTK
vyudu Dec 1, 2024
4affeac
up
vyudu Dec 1, 2024
a3429ea
up
vyudu Dec 1, 2024
f751fbb
up
vyudu Dec 2, 2024
a9fdfd6
up
vyudu Dec 3, 2024
a9f2106
up
vyudu Dec 4, 2024
18fdd5f
up
vyudu Dec 13, 2024
9d65a33
fixing create_array
vyudu Dec 16, 2024
999ec30
revert Project.toml
vyudu Dec 16, 2024
9226ad6
Up
vyudu Dec 16, 2024
0cb4893
Merge remote-tracking branch 'origin/master' into MTK
vyudu Dec 16, 2024
67d8164
formatting
vyudu Dec 16, 2024
25988f3
up
vyudu Dec 17, 2024
bb28d4f
up
vyudu Dec 17, 2024
b2bf7c0
fix
vyudu Dec 17, 2024
3751c2a
up
vyudu Dec 20, 2024
ef1f089
up
vyudu Jan 8, 2025
d23d6f7
Merge remote-tracking branch 'origin/master' into MTK
vyudu Jan 8, 2025
2a25200
extend BVProblem for constraint equations
vyudu Jan 9, 2025
50504ab
adding tests
vyudu Jan 11, 2025
5d082ab
up
vyudu Jan 11, 2025
b83e003
refactor the bc creation function
vyudu Jan 14, 2025
db5eb66
up
vyudu Jan 14, 2025
e802946
test update
vyudu Jan 15, 2025
e74e047
fix
vyudu Jan 15, 2025
86d4144
test more solvers:
vyudu Jan 17, 2025
ec386fe
Refactor constraints
vyudu Jan 28, 2025
90ce80d
refactor tests
vyudu Jan 28, 2025
a15c670
fix sym validation
vyudu Jan 28, 2025
c6ef04a
remove file
vyudu Jan 28, 2025
7878225
up
vyudu Jan 28, 2025
5bcfdff
up
vyudu Jan 28, 2025
0493b5d
remove lines
vyudu Jan 28, 2025
1d32b6e
up
vyudu Jan 28, 2025
2b3ca96
up
vyudu Jan 28, 2025
0324522
fix typo
vyudu Jan 28, 2025
2a079be
Fix setter
vyudu Jan 28, 2025
d70a470
fix
vyudu Jan 28, 2025
37092f1
lower tol
vyudu Jan 29, 2025
e5eb8bd
fix Project.toml
vyudu Jan 29, 2025
2ae79ae
revert to OrdinaryDiffEq
vyudu Jan 30, 2025
8ae2803
merge master
vyudu Feb 3, 2025
13a242c
update to use updated codegen
vyudu Feb 3, 2025
2fcb9c9
up
vyudu Feb 3, 2025
25b56d7
working codegen
vyudu Feb 4, 2025
c35b797
revert to OrdinaryDiffEqDefault
vyudu Feb 4, 2025
25e84db
use MIRK
vyudu Feb 4, 2025
e6a6932
up
vyudu Feb 4, 2025
5e5c24c
revert to OrdinaryDiffEq
vyudu Feb 4, 2025
5338d4f
tests passing
vyudu Feb 4, 2025
810d4fa
remove problematic tests, codegen assumes MTKParameters
vyudu Feb 4, 2025
6740b8c
test fix
vyudu Feb 4, 2025
603c894
Update src/systems/diffeqs/odesystem.jl
ChrisRackauckas Feb 10, 2025
b10a4a6
Merge branch 'master' into BVP-with-constraints
ChrisRackauckas Feb 10, 2025
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
Prev Previous commit
Next Next commit
up
vyudu committed Jan 28, 2025
commit 2b3ca96d23f0010609867f6586449aa7dd9c6ddb
1 change: 1 addition & 0 deletions src/systems/diffeqs/odesystem.jl
Original file line number Diff line number Diff line change
@@ -369,6 +369,7 @@ function ODESystem(eqs, iv; constraints = Equation[], kwargs...)
algevars = setdiff(allunknowns, diffvars)

consvars = OrderedSet()
constraintsystem = nothing
if !isempty(constraints)
constraintsystem = process_constraint_system(constraints, allunknowns, new_ps, iv)
for st in get_unknowns(constraintsystem)

Unchanged files with check annotations Beta

β = 1e-6
R0 = 1000
R = 9000
Ue(t) = 0.1 * sin(200 * π * t)

Check warning on line 96 in test/scc_nonlinear_problem.jl

GitHub Actions / Spell Check with Typos

"Ue" should be "Use" or "Due".
function transamp(out, du, u, p, t)
g(x) = 1e-6 * (exp(x / 0.026) - 1)
y1, y2, y3, y4, y5, y6, y7, y8 = u
out[1] = -Ue(t) / R0 + y1 / R0 + C[1] * du[1] - C[1] * du[2]

Check warning on line 101 in test/scc_nonlinear_problem.jl

GitHub Actions / Spell Check with Typos

"Ue" should be "Use" or "Due".
out[2] = -Ub / R + y2 * 2 / R - (α - 1) * g(y2 - y3) - C[1] * du[1] + C[1] * du[2]
out[3] = -g(y2 - y3) + y3 / R + C[2] * du[3]
out[4] = -Ub / R + y4 / R + α * g(y2 - y3) + C[3] * du[4] - C[3] * du[5]
return (expr, true, true)
# other singleton symbolic variables
elseif !iscall(expr)
@warn "Automatic conversion of if statments to events requires use of a limited conditional grammar; see the documentation. Skipping due to $expr"

Check warning on line 88 in src/systems/if_lifting.jl

GitHub Actions / Spell Check with Typos

"statments" should be "statements".
return (expr, true, true) # error case => conservative assumption is that both true and false have to be evaluated
elseif operation(expr) == Base.:(|) # OR of two conditions
a, b = arguments(expr)
(@rule ifelse(false, (~x), (~y)) => (~y))])))
"""
If lifting converts (nested) if statements into a series of continous events + a logically equivalent if statement + parameters.

Check warning on line 408 in src/systems/if_lifting.jl

GitHub Actions / Spell Check with Typos

"continous" should be "continuous".
Lifting proceeds through the following process:
* rewrite comparisons to be of the form eqn [op] 0; subtract the RHS from the LHS
ap_idx = analysis_point_index(ap_sys, tf.ap)
ap_idx === nothing &&
error("Analysis point $(nameof(tf.ap)) not found in system $(nameof(sys)).")
# get the anlysis point

Check warning on line 513 in src/systems/analysis_points.jl

GitHub Actions / Spell Check with Typos

"anlysis" should be "analysis".
ap_sys_eqs = copy(get_eqs(ap_sys))
ap = ap_sys_eqs[ap_idx].rhs
ap_idx = analysis_point_index(ap_sys, tf.ap)
ap_idx === nothing &&
error("Analysis point $(nameof(tf.ap)) not found in system $(nameof(sys)).")
# modified quations

Check warning on line 567 in src/systems/analysis_points.jl

GitHub Actions / Spell Check with Typos

"quations" should be "equations".
ap_sys_eqs = copy(get_eqs(ap_sys))
@set! ap_sys.eqs = ap_sys_eqs
ap = ap_sys_eqs[ap_idx].rhs
# Keyword Arguments
- `system_modifier`: a function which takes the modified system and returns a new system
with any required further modifications peformed.

Check warning on line 879 in src/systems/analysis_points.jl

GitHub Actions / Spell Check with Typos

"peformed" should be "performed".
"""
function open_loop(sys, ap::Union{Symbol, AnalysisPoint}; system_modifier = identity)
ap = only(canonicalize_ap(sys, ap))