Assume that we have an optimization problem with the objective $$\min_{w} \sum_{j}^{n}\sum_{i}^{n_t} \left( \hat{T}_j(t_i) - T(t_i, w) \right)^2 + c . \| w \|_1$$ where $w \in [ 0, 1 ]$ and $c$ is a constant. $\hat{T}_j(t_i)$ and $T(t_i, w)$ are computed using heat equation with initial value: $$\begin{array}{rlll} T_t(t,x) + L_w . T(t,x) & = & F(t,x) , \\ % T(0,t) & = & T(1,t) = 0 & \\ T(x,0) & = & T_0 . \end{array}$$ $F(t,x)$ is given and $L_w$ is the weighted Laplacian of a graph $G=(V,E)$ and $$L_w(G):= \sum_{ij \in E} w_{ij} E_{ij}$$ It should be added that $\hat{T}_j(t_i)$ is obtained from above equations by fixing an arbitrary $w$, but for $T(t_i, w)$ is changing in each time step.
You optimize over a binary variable (which seems to be a binary matrix, right?)? And you want the gradient of the objective with respect to this binary variable $w$? Better relax to $w_{ij}\in[0,1]$ or so. Also: What do you mean by "but for $T(t_i,w)$ is changing in each time step"? –  Dirk Aug 1 '14 at 20:51
@Dirk you're right. the relaxed variable $w$ would be better. I have modified my question, now. well because in each step $w$ would be changed to a new one then from the equation the heat $T(t_i, w)$ would change, too. Maybe if I say that $T(t_i, w)$ is updating in each step, rather would be better. –  Royeh Aug 1 '14 at 22:42