@@ -10,11 +10,13 @@ is added for each factor present in the ODE, each factor is then replaced with a
1010for constructing intervals/relaxations, then a new ODESystem is created.
1111
1212
13- apply_transform(IntervalTransform(), odes) should create a 2*nx dimension system of differential equations with rhs equal to f(du, u, p ,t)
14- from the original with rhs f(dx, x, p, t) which when solved furnishes interval bound of x(p,t) from an exist system of ODEs.
13+ apply_transform(IntervalTransform(), odes) should create a 2*nx dimension system of differential
14+ equations with rhs's equal to f(du, u, p ,t) from the original with rhs's f(dx, x, p, t) which
15+ when solved furnishes interval bounds of x(p,t) from an existing system of ODEs.
1516
16- apply_transform(McCormickIntervalTransform(), odes) should create a 4*nx dimension system of differential equations with rhs equal to f(du, u, p ,t)
17- from the original with rhs f(dx, x, p, t) which when solved furnishes relaxations of x(p,t)
17+ apply_transform(McCormickIntervalTransform(), odes) should create a 4*nx dimension system of
18+ differential equations with rhs's equal to f(du, u, p ,t) from the original with rhs's
19+ f(dx, x, p, t) which when solved furnishes relaxations of x(p,t)
1820
1921```
2022# Sample ODESystem from Modeling Toolkit
@@ -67,28 +69,50 @@ new_prob_p = remake(new_prob, p=pnew)
6769```
6870
6971=#
70- function apply_transform (t:: T , sys, u0, p, args... ) where T<: AbstractTransform
71-
72- assigments = Assignment[]
73- for eqn in equations (sys)
74- binarize! (eqn)
75- factor! (eqn, assigments)
72+ function apply_transform (t:: T , prob:: ODESystem ) where T<: AbstractTransform
73+
74+ assignments = Assignment[]
75+ for eqn in prob. eqs
76+ # Flesh out the original RHS
77+ current = length (assignments)
78+ factor! (toexpr (eqn. rhs), assignments= assignments)
79+
80+ # If new equations were added, stick on the original LHS to the last point
81+ # in assignments by stealing its RHS from the last item and taking its place
82+ if length (assignments) > current
83+ push! (assignments, Assignment (toexpr (eqn. lhs), assignments[end ]. rhs))
84+ deleteat! (assignments, length (assignments)- 1 )
85+ end
7686 end
7787
88+ # new_assignments = AssignmentPair[]
7889 new_assignments = Assignment[]
7990 for a in assignments
80- zn = var_names (t, zstr (a))
81- xn = var_names (t, xstr (a))
91+ zn = var_names (t, zstr (a)) # LHS
92+ xn = var_names (t, xstr (a)) # RHS(1)
93+
94+ first = zn[1 ]
95+ second = zn[2 ]
96+
97+ # Define the zn's as variables
98+ @variables $ first $ second
8299 if isone (arity (a))
83100 targs = (t, op (a), zn... , xn... )
84101 else
85102 targs = (t, op (a), zn... , xn... , var_names (t, ystr (a))... )
86103 end
87- add! (new_assignments, transform_rule (targs... ))
104+ println (" targs: $targs " )
105+
106+ # push!(new_assignments, transform_rule(targs...))
107+ new = transform_rule (targs... )
108+ push! (new_assignments, new. l)
109+ push! (new_assignments, new. u)
88110 end
89111
112+ @named new_sys = ODESystem (new_eqs)
90113 # Form ODE system from new assignments
91114 # CSE - MTK.structural_simplify()
92115
93- return new_assignments
116+ # Figure out a way to give the new ODE system the proper parameters, variables, etc.
117+ return the_new_ODE_System
94118end
0 commit comments