We have one job $i$ and one machine. Let $\mathbf{x}_i=[x_{i,1},x_{i,2},\ldots,x_{i,T}]$ be a binary vector where $x_{i,t}=1\iff$ job $i$ is scheduled at time $t$. Let $u$ be a positive number. I would like to find the idle intervals of length $u$ or more. An interval $k=\{s,s+1,\ldots,s'\}$ is idle if $x_{i,s}=x_{i,s+1}=\cdots=x_{i,s'}=0$. The length of the interval $k=\{s,s+1,\ldots,s'\}$ is $l_k:=s'-s+1$. An idle interval $k$ of length $l_k$, is associated a weight $w_k$. The objective is to minimize the summation $\sum_{k}w_k$, e.g., if $w_k=1$ for all $k$, then the objective is to minimize the number of idle intervals.
For example, for $\mathbf{x}_i=[1,0,0,0,0,1,0,0,0,1]$, then, we have two idle intervals; one of length $4$ (say, with weight $2$) and one of length $3$ (say, with weight $1$). Thus, we count the objective as $3$.
How can I write the objective using the variable $\mathbf{x}_i$ in linear formulation? In other words, how to find the idles intervals using $\mathbf{x}_i$?