solveSubProblemVariableZ

Method of discreteTimeMdss.

Solve one coupled subproblem for its continuous unknowns and its binary signals.

Source: src/simulator/@discreteTimeMdss/solveSubProblemVariableZ.m

What is solved

A coupled subproblem is a block of equations from the solving order that must be solved jointly. Its unknowns are some continuous signals w=[xk+1,s;ys]w=[\,x_{k+1,s};\, y_s] (successor states and algebraic variables) and some binary signals zsz_s. Let

nz=the number of binary signals in this subproblem. n_z = \text{the number of binary signals in this subproblem.}

The block must satisfy its equality rows and stay inequality-feasible:

Fs=Φeq,sm(w,zs)=0,Gs=Φineq,sm(w,zs)0, F_s = \Phi_{\mathrm{eq},s}\, m(w, z_s) = 0, \qquad G_s = \Phi_{\mathrm{ineq},s}\, m(w, z_s) \le 0,

where Φ=Φc+Φ+1Φ1\Phi=\Phi_c+\Phi_{+1}-\Phi_{-1} is the parameter-matrix split and mm 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).

Algorithm

Each binary can only be 00 or 11, so there are 2nz2^{n_z} possible binary vectors. The method enumerates all of them, ordered by ascending Hamming distance to the current zz (fewest switched bits first, since a mode usually changes as little as possible):

z(k){0,1}nz,k=1,,2nz. z^{(k)} \in \{0,1\}^{n_z},\qquad k = 1,\dots,2^{n_z}.

For each candidate z(k)z^{(k)}:

1. Fold z(k)z^{(k)} into mm (the binaries are now known), leaving a continuous-only solve for ww.

2. Solve the block’s equality rows Fs(w)=Φeq,sm(w)=0F_s(w)=\Phi_{\mathrm{eq},s}\,m(w)=0 for ww, according to the block’s type flag.

Linear (type = -1): FsF_s is affine, Fs=Aw+bF_s = A\,w + b, solved by w=A1bw=-A^{-1}b, with

A:,j=Φeq,s[(tjfj+cj)m],b=Φeq,s[mj(1|cj|)(1tj)]. A_{:,j} = \Phi_{\mathrm{eq},s}\big[(t_j - f_j + c_j)\odot m\big], \qquad b = \Phi_{\mathrm{eq},s}\Big[m\odot\textstyle\prod_j (1-|c_j|)(1-t_j)\Big].

Nonlinear (type = 0): lsqnonlin (Levenberg–Marquardt) drives Fs(w)0F_s(w)\to 0 using the analytic product-rule Jacobian.

3. Check inequality feasibility. The candidate is accepted as soon as

maxi(Gs)i<ε, \max_i (G_s)_i < \sqrt{\varepsilon},

and its xk+1,s,ys,z(k)x_{k+1,s}, y_s, z^{(k)} are written out.

(tj,fj,cjt_j, f_j, c_j are the true/false/continuous structure rows of unknown jj.) 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.

Inputs / outputs

[xp, y, z, G, F, EqXUZ] = solveSubProblemVariableZ(sys, solvingOrderSubProblem, EqXUZ, xpInit, yInit, y0, zInit) — returns the updated successor-state row xp (xk+1x_{k+1}), algebraic row y, binary row z, the subproblem inequality/equality function values G, F, and the running monomial vector EqXUZ (mm).

See also

discreteTimeMdss · solveStepBruteForce · msim


MyToolbox Documentation | Generated automatically by CI/CD pipeline