# Alignment of multiple elements with indentation

I'm trying to typeset an optimization problem that uses variable conditioned constraints (vif) in combination with normal constraints. My current syntax (of a part of the problem) is

\begin{align*}
\max \sum_{i \in I} z_i \\
\text{subject to} \\
x_i^0 &= x_i^{\text{start}}  &&\forall i \in I, \\
l_i^t + r_i^t + c_i^t &= 1  &&\forall t = 0,...,N-1, i \in I, \\
\text{vif } v_i^t = 1 \text{ then} \\
x_j^t - x_i^t &\leq \epsilon \\
\text{else} \\
x_j^t - x_i^t &\geq \epsilon + \hat{\epsilon}\\
\text{end} &&&\forall t=0,...,N-1, i,j \in I: i < j, \\
k_i^t &= \sum_{j \in I \setminus \{i\}} v_{\min(i,j),max(i,j)}+1+c_i^t  &&\forall t=0,...,N-1, i \in I, \\
\end{align*}


which displays

I would like to have the else and the end aligned to the left (like the vif is already) while maintaining the slight indent for the line underneath the vif. If I try to put an ampersand in front of the else or end however, I cannot manage to align the other equations around the = or \geq signs properly. A satisfactory result would look roughly like this (I edited the picture)

How can such indentation be achieved while keeping the constraints aligned in this way?

One quick fix is to make the two lines for if and else have the same width as that for the line \text{vif } v_i^t = 1 \text{ then}. You can use makebox for this. calc package is also required to allow \widthof to calculate the width automatically.

\documentclass[12pt]{article}
\usepackage{amsmath}
\usepackage{calc}
\begin{document}

\newcommand{\adjleft}[1]{\makebox[\widthof{$\text{vif } v_i^t = 1 \text{ then}$}][l]{#1}}

\begin{align*}
\max \sum_{i \in I} z_i \\
\text{subject to} \\
x_i^0 &= x_i^{\text{start}}  &&\forall i \in I, \\
l_i^t + r_i^t + c_i^t &= 1  &&\forall t = 0,...,N-1, i \in I, \\
\text{vif } v_i^t = 1 \text{ then} \\
x_j^t - x_i^t &\leq \epsilon \\