Method of continuousTimeMdss.
Solve one coupled subproblem for its continuous unknowns and its binary signals.
Source:
src/simulator/@continuousTimeMdss/solveSubProblemVariableZ.m
A coupled subproblem is a block of equations from the solving order that cannot be solved one variable at a time and must be solved jointly. Its unknowns are some continuous signals (state derivatives and algebraic variables) and some binary signals . Let
The block must satisfy its equality rows and stay inequality-feasible:
where
is the parameter-matrix split and
is the norm-1 monomial vector — the running product obtained by folding
each known signal value into the columns of the structure matrix (the
update rule is described on solveStepBruteForce).
Each binary can only be or , so there are possible binary vectors. The method enumerates all of them, ordered by ascending Hamming distance to the current (the vector closest to the incumbent — fewest switched bits — is tried first, because a mode usually changes as little as possible):
For each candidate :
1. Fold into (the binaries are now known), which leaves a continuous-only solve for .
2. Solve the block’s equality rows
for
,
according to the block’s type flag.
Linear (type = -1):
is affine in
,
,
solved by
,
with
Nonlinear (type = 0): lsqnonlin
(Levenberg–Marquardt) drives
using the analytic product-rule Jacobian
.
3. Check inequality feasibility. The candidate is accepted as soon as
and its are written out.
(
are the true/false/continuous structure rows of unknown
.)
If no binary vector yields a feasible solution, a
No Solution found warning is raised.
This method is called by solveStepBruteForce
whenever a coupled subproblem contains binary signals.
| Argument | Description |
|---|---|
sys |
The continuousTimeMdss simulation object (carries the
mdss model and solver constants). |
solvingOrderSubProblem |
The solving-order rows of this block
[varIdx, eqIdx, type, subset, subproblem]. |
EqXUZ |
The running monomial vector , with all upstream blocks already folded in. |
xpInit |
Initial values / guess for the block’s state derivatives. |
yInit |
Initial values / guess for the block’s algebraic variables. |
y0 |
Algebraic seed used to start the nonlinear solve. |
zInit |
Current binary values (the reference for the nearest-first enumeration order). |
| Output | Description |
|---|---|
xp |
Solved state derivatives . |
y |
Solved algebraic variables. |
z |
The accepted binary combination. |
G |
Inequality function values. |
F |
Equality function values. |
EqXUZ |
The monomial vector updated with the solved block. |
continuousTimeMdss
· solveStepBruteForce
· solveSubProblemFixZ
· msim
MyToolbox Documentation | Generated automatically by CI/CD pipeline