Optimization Software for mathematical models with (arg) min/max in constraints With context of a college student timetable and course selection, I’m formulating a function that counts holes (the empty blocks of hour when there is no class) limited by the first course of the day trip and the last one. This will be use in a integer programming software to compare schedules.
Given...
The following indexes, variable X and constant T

α: Day; from 1, 2, 3, .. to a
β: Hour, its a unit of a block of hour; from 1, 2, 3 .. to b
i: Section of course; from 1, 2, 3, .. to n 
j: Course; from 1, 2, 3, .. to m 

\begin{equation*}
X_{ij} := \begin{cases}
1, & \text{Section}  & \textit{i} & \text{of the course}& \textit{j}  & \text{is part of the solution}  ,\\
0, & \text{Section}  & \textit{i} & \text{of the course}& \textit{j}  & \text{is not part of the solution}
\end{cases}
\end{equation*}
\begin{equation*}
T_{ij}^{(αβ)} := \begin{cases}
1, & \text{Section}  & \textit{i} & \text{of the course}& \textit{j}  & \text{is given in the block of hour} & \textit{$\alpha$} & \text{of the day}  & \textit{$\beta$},\\
0, & \text{Section}  & \textit{i} & \text{of the course}& \textit{j}  & \text{is not given in the block of hour} & \textit{$\alpha$} & \text{of the day}  & \textit{$\beta$}
\end{cases}
\end{equation*}

And the mentioned function
\begin{equation*}
FA1(\alpha)= 
\begin{cases}
0, \qquad \text{if}  \sum_{i=1}^n \sum_{j=1}^m \sum_{β=1}^b X_{ij}T_{ij}^{(\alpha\beta)} = 0\\
\max(\beta) +1 - \min(\beta) - \sum_{i=1}^n \sum_{j=1}^m \sum_{β=1}^b X_{ij}T_{ij}^{(\alpha\beta)}; \text{ where } X_{ij}T_{ij}^{(\alpha\beta)}=1, \qquad \text{otherwise}
\end{cases}
\end{equation*}
\begin{equation*}\text{Maybe, other way to model it is using argmax function to get the indexes when}\ X_{ij}T_{ij}^{(\alpha\beta)}=1\text{:} \end{equation*}
\begin{equation*}
\DeclareMathOperator*{\argmax}{arg\,max}
FA1(\alpha) = 
\begin{cases}
0, \qquad \text{if}  \sum_{i=1}^n \sum_{j=1}^m \sum_{β=1}^b X_{ij}T_{ij}^{(\alpha\beta)} = 0\\
\max(\argmax_{β}(X_{ij}T_{ij}^{(\alpha\beta)})) +1 - \min(\argmax_{β}(X_{ij}T_{ij}^{(\alpha\beta)})) - \sum_{i=1}^n \sum_{j=1}^m \sum_{β=1}^b X_{ij}T_{ij}^{(\alpha\beta)}, \qquad \text{otherwise}
\end{cases}
\end{equation*}
So, I'm trying to get the start and the end of the day trip that is the first and last blocks of hour to substract all the blocks of hour with class to get the count.
Which optimization software(s) for mathematical models can I use? And how can I formulate it?
I was looking for a IP software as Lingo, but I think the algorithms  of integer programming (usually based on relax methods) may not support this function for a constraint.
For a future work, I'm planning to formulate a function like the presented that omits a set of continuous holes of a determinated minimum size, it´s because a student in that in a particular set of continuous holes of a determinated minimum size could go home and come back. 
 A: I'm going to change up notation to simplify things a bit (or at least reduce my typing). What follows is for a particular student on a particular day; you'll need to add subscripts, superscripts or runes for student and day. Also, I'm going to use a single subscript ($i$) to represent both section and course (so, for instance, $i=17$ might be section 3 of History of Slovakian Banking).
For parameters, let $B_i$ be the time block in which section $i$ starts and $E_i \ge B_i$ be the time block in which it ends. The variables will be as follows:


*

*$s\ge 0$ will be the time the student starts;

*$f\ge 0$ will be the time the student finishes;

*$y\ge 0$ will be the number of empty slots in the student's schedule that day; and

*$x_i\in \{0,1\}$ will be 1 if the student takes section $i$ and 0 if not.


All but the last variable are continuous. There are three constraints:


*

*$s\le B_i x_i\,\forall i$;

*$f\ge E_i x_i\, \forall i$; and

*$y=f-s+1-\sum_i \left(E_i-B_i+1\right)x_i$.


This works if the objective function minimizes the number of empty blocks. Otherwise, the solver could hypothetically make $f$ larger than necessary or $s$ smaller than necessary. In that case, you need more elements to the model. For instance, you could have additional binary variables signaling whether section $i$ is the first or last section of the day for the student, along with modified constraints defining $s$ and $f$.
