A "viscosity" solution of ODE arising from switching systems $\newcommand{\d}[1]{\underline{\mathrm{#1}}}$
$\color{red}{\d{Setting}}$
Let $f : \mathbb R \to \{0,1\}$ be a function and let $x_0 \in (0,1)$. I have two fixed distinct real numbers $A_0,A_1$ and define $g(x) = A_{f(x)}x$. Basically, $f$ assigns to each $x$ a number $A_0$ or $A_1$, and then we get $g(x)$ by multiplying by $A$.

Consider the initial value problem
$$
\dot{W}(x) = g(W(x)) \quad W(0) = x_0
$$

for what $f$ can I assert existence and uniqueness of $W$ as a "solution" for any initial point $x_0$? I'd like existence and uniqueness only till $f$ exists $[0,1]$ for the first time.
$\color{blue}{\d{Motivation}}$
This arises in the notion of switching linear systems. Imagine a system where a particle is at a point initially, say the particle is a feather. At every point in the space, there is a fan, which blows in a certain direction, and dictates a local behaviour of the motion of the feather like a linear ODE. Now we find when the feather has a unique valid movement in this configuration.
Apart from feathers in fans, my particular application is in epidemic theory, where the trajectory of a epidemic can be controlled with an on-off switch, with different linear dynamics in the on and off case.
$\color{fuchsia}{\d{Example}}$
Of course, if $f$ is constant then the solution exists as a strong solution, and is unique given the initial condition. Let's take a first non-trivial example. Fix a $y \in (0,1)$ and let $f(x) = -1$ if $x < y$ and $f(x) = 1$ otherwise.
Now, let $x_0$ be any point. Note that the Lipschitz continuity condition fails for $f$ at $y$, in fact even continuity fails. So I'm not expecting a strong solution anyway : a solution to this won't even be differentiable, looking at the behaviour at $y$.
However, I'd like to think that a solution of some kind exists as follows : say for example that $x_0 < y$. Then , by using the existence/uniqueness theorem for $(0,y)$ I can get the solution on this interval, which will be $W(z) = e^{-z} + (x_0-1)$. This solution, by continuity of the weak solution, will fix a unique value at $y$ i.e. $W(y) = e^{-y} + (x_0-1)$. Then, using the uniqueness/existence condition in $[y,1]$ we get an extension of the solution to $[0,1]$, uniquely (I can write down the explicit answer but that's not important). We call this solution as $W$.
I read up the notion of a viscosity solution which matches heavily with my construction (For the definition, see here or see Fleming and Soner, chapter 2). I can't go for a weak solution, since that just neglects the role of $y$ in the above construction, and you can just work piecewise. I'd like the pieces to be "joined together" continuously, and a viscosity solution is ensured continuous by construction.
$\color{green}{\d{Questions}}$

*

*According to Wikipedia , a viscosity solution seems to be defined only for certain forms of PDE that arise from the HJB. I believe that this falls in that category of "degenerate elliptic" PDE because it is a first order PDE so the condition is vacuous, but I need confirmation on this one because the switching and discontinuity of $g$ is getting to me.


*Is the function I wrote above the unique viscosity solution of the ODE described? I'd like an easy way to see that it is, but the definitions are getting to me. Let me try : so the situation is $V(0) = x_0$ and $$F(x, V(x), \dot{V}(x)) = \begin{cases}
\dot{V}(x) - V(x) & x \geq y \\
\dot{V}(x) + V(x) & x < y
\end{cases} $$
To check that the $W$ constructed is a sub and super solution we only need to see the point $y$ since at the other points differentiability is present. If $\phi$ is differentiable at $y$ and $\phi \geq W$ in a neighbourhood of $y$ then $\phi(t) - \phi(y) \geq W(t) - W(y)$ for all $t$ in a neighbourhood of $y$. Now we can divide by $y$ and let $t \to u$ from left and right and get that $|y| \geq \phi'(y)$, so $W$ is a subsolution. We should get $W$ being a super solution symmetrically : if $\phi \leq W$ in a neighbourhood of $y$ then the inequalities reverse which basically leads to the reverse conclusion $|y| \leq \phi'(y)$ and we are done. (Kindly point out casual errors, I don't expect any)


*If $f$ has only finitely many points of discontinuity then I expect a unique viscosity solution to exist. How can I be expected to work if $f$ had infinitely many points of discontinuity? Or at a limit point of the discontinuities? Could the solution be definable in the viscous sense here and be unique?
Essentially, I'm trying to find the largest class of $f$ for which I can find a viscosity solution. I need the class to be large enough because I want a minimizer of a certain functional of that class, which I can't really study unless I know something about this class.
 A: In control theory, one generally recognizes 2 different cases.

*

*The switchings are somehow spaced in time, either because there is some timing scheme or device, or because the continuous trajectories move away from the discontinuities of the right-hand side of the differential equation, which define the switching surfaces. In this case existence is not really a problem, because the solutions in each interval where Lipschitz conditions hold can be patched together, final condition of one interval to initial condition of the next.


*Switchings occur with infinite frequency, because trajectories on both sides of the switching surfaces lead back towards it. In this case the switching surfaces are called "sliding modes" and are studied under the label VSS, for variable structure systems. Classical solutions do not exist, and the concept employed is often called a Filippov solution, after the author of a monograph titled "Differential Equations with Discontinuous Righthand Sides".
I hope this is helpful, although it's not a very formal answer. You may be on to a good point about the connection with viscosity solutions. Those are used in a different context, partial differential equations, and I'm not sure how the 2 things relate.
(I have to add that in my opinion sliding modes do not often lead to realistic models of physical phenomena or useful control design methods. This is the personal opinion of an engineer, and many researchers disagree.)
