<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">\documentclass[a4paper, 12pt]{article}

\newcommand{\bold}{\textbf}

\usepackage[english]{babel}
\usepackage{amsmath}
\usepackage{tikz}
\usepackage{indentfirst}

\begin{document}

\newcommand{\q2}{\quad\quad}

\title{\Large{\bold{Moontorio}}}
\author{Matei Adriel}
\date {}

\maketitle

\section{Example 1}

Solve the following factory:

\vspace*{20pt}
\begin{figure}[h]
\centering
\begin{tikzpicture}[shorten &gt;=1pt, auto, node distance={30mm}, 
  main/.style = {draw, rectangle}]

\node[main] (3) {$consumer_1$};
\node[main] (1) [above left of=3] {$provider_1$};
\node[main] (2) [below left of=3] {$provider_2$};
\node[main] (4) [right of=2] {$consumer_2$};

\draw[-&gt;] (1) edge node{$p_1$} (3);
\draw[-&gt;] (2) edge node{$p_2$} (3);
\draw[-&gt;] (2) edge node{$p_3$} (4); 

\end{tikzpicture}
\caption{Factory} 
\label{fig:Factory}
\end{figure}

Generating the constraints: 
\begin{figure}[h]
\centering

\begin{equation}
  p_1(t) &lt; provider_1(t)
\end{equation}

\begin{equation}
  p_3(t) &lt; consumer_2(t)
\end{equation}

\begin{equation}
\begin{split}
  \begin{cases}
    \begin{cases}
      p_2(t) &amp;&lt; \displaystyle\frac{consumer_1(t)}{2}\\
      p_1(t) &amp;&lt; consumer_1(t) - p_2(t)
    \end{cases}
    \ ,&amp;\;\mbox{if } p_1(t) \geq p_2(t)\\\\
    \begin{cases}
      p_1(t) &amp;&lt; \displaystyle\frac{consumer_1(t)}{2}\\
      p_2(t) &amp;&lt; consumer_1(t) - p_1(t)
    \end{cases}
    \ ,&amp;\;\mbox{if } p_1(t) &lt; p_2(t)
  \end{cases}
\end{split}
\end{equation}

\begin{equation}
\begin{split}
  \begin{cases}
    \begin{cases}
      p_3(t) &amp;&lt; \displaystyle\frac{provider_2(t)}{2}\\
      p_2(t) &amp;&lt; provider_2(t) - p_3(t)
    \end{cases}
    \ ,&amp;\;\mbox{if } p_2(t) \geq p_3(t)\\\\
    \begin{cases}
      p_2(t) &amp;&lt; \displaystyle\frac{provider_2(t)}{2}\\
      p_3(t) &amp;&lt; provider_2(t) - p_3(t)
    \end{cases}
    \ ,&amp;\;\mbox{if } p_2(t) &lt; p_3(t)
  \end{cases}
\end{split}
\end{equation}

\caption{Constraints}
\label{fig:Constraints}
\end{figure}

\end{document}
</pre></body></html>