\def\xmin{0}%
\def\xmax{5}%
\def\ymin{0}%
\def\ymax{4}%

\def\xga{0}
\def\yga{0}
\def\xgb{4}
\def\ygb{3}
\def\xgc{1}
\def\ygc{3}
\def\xgd{3}
\def\ygd{0}

\def\xra{2}
\def\yra{0}
\def\xrb{1}
\def\yrb{1}
\def\xrc{1}
\def\yrc{3}

\begin{figure}[tb]
\subfloat{ %[$K=8$]{
\hspace{-0.5cm}
\trimbox{-0.2cm 0.0cm 0.0cm 0.4cm}{ 
\centering
\begin{tikzpicture}[scale=0.70]
    \foreach \i [evaluate=\i as \xcoord using int(1+\i)] in {\xmin,...,\xmax} {
        \draw [thick,gray] (\i,\ymin) -- (\i,\ymax) 
        node [below] at (\i + 0.5,\ymin) {\ifthenelse{\i<\xmax}{\xcoord}{}};
    }
    \foreach \i [evaluate=\i as \ycoord using int(1+\i)] in {\ymin,...,\ymax} {
        \draw [thick,gray] (\xmin,\i) -- (\xmax,\i) 
        node [left] at (\xmin,\i + 0.5) {\ifthenelse{\i<\ymax}{\ycoord}{}};
    }

\draw[OliveGreen, very thick, fill=green, opacity=0.5] (1,3) rectangle (2,4);
\draw[OliveGreen, very thick, fill=green, opacity=0.5] (4,0) rectangle (5,1);

\draw[purple, very thick, fill=red, opacity=0.5] (0,0) rectangle (1,1);
\draw[purple, very thick, fill=red, opacity=0.5] (0,3) rectangle (1,4);
\draw[purple, very thick, fill=red, opacity=0.5] (1,0) rectangle (2,1);
\draw[purple, very thick, fill=red, opacity=0.5] (3,0) rectangle (4,1);
\draw[purple, very thick, fill=red, opacity=0.5] (3,3) rectangle (4,4);
\draw[purple, very thick, fill=red, opacity=0.5] (4,3) rectangle (5,4);

\draw[Dandelion, very thick, fill=yellow, opacity=0.5] (0,1) rectangle (1,2);

\draw[->,thick,dashed] (0,2.5) -- (5.0,2.5);
\draw[-,thick,dashed] (5,1.5) -- (1.80,1.5);
\draw[->,thick,dashed] (1.20,1.5) -- (0,1.5);
\draw[->,dashed,thick,orange] (2.5,0.80) -- (2.5,2.5) -- (4.5,2.5) -- (4.5,0.5);
\draw[->,dashed,thick,blue] (1.5,1.80) -- (1.5,3.5);

\node[fill, color=orange, opacity=0.5, rectangle, draw, radius=0.25, inner sep=6pt, label={}, scale=0.75] at (\xra+0.5,\yra+0.5) (ra) {\small \color{black} \textbf{1}};
\node[fill, color=blue, opacity=0.5, rectangle, draw, radius=0.25, inner sep=6pt, label={}, scale=0.75] at (\xrb+0.5,\yrb+0.5) (rb) {\small \color{black} \textbf{2}};

\node at (2.5,4.5) {{\scriptsize NE ($K=8$)}};

\end{tikzpicture}

\hspace{-0.2cm}

\centering
\begin{tikzpicture}[scale=0.70]
    \foreach \i [evaluate=\i as \xcoord using int(1+\i)] in {\xmin,...,\xmax} {
        \draw [thick,gray] (\i,\ymin) -- (\i,\ymax) 
        node [below] at (\i + 0.5,\ymin) {\ifthenelse{\i<\xmax}{\xcoord}{}};
    }
    \foreach \i [evaluate=\i as \ycoord using int(1+\i)] in {\ymin,...,\ymax} {
        \draw [thick,gray] (\xmin,\i) -- (\xmax,\i) 
        node [left] at (\xmin,\i + 0.5) {\ifthenelse{\i<\ymax}{\ycoord}{}};
    }

\draw[OliveGreen, very thick, fill=green, opacity=0.5] (1,3) rectangle (2,4);
\draw[OliveGreen, very thick, fill=green, opacity=0.5] (4,0) rectangle (5,1);

\draw[purple, very thick, fill=red, opacity=0.5] (0,0) rectangle (1,1);
\draw[purple, very thick, fill=red, opacity=0.5] (0,3) rectangle (1,4);
\draw[purple, very thick, fill=red, opacity=0.5] (1,0) rectangle (2,1);
\draw[purple, very thick, fill=red, opacity=0.5] (3,0) rectangle (4,1);
\draw[purple, very thick, fill=red, opacity=0.5] (3,3) rectangle (4,4);
\draw[purple, very thick, fill=red, opacity=0.5] (4,3) rectangle (5,4);

\draw[Dandelion, very thick, fill=yellow, opacity=0.5] (0,1) rectangle (1,2);

\draw[->,thick,dashed] (0,2.5) -- (5.0,2.5);
\draw[-,thick,dashed] (5,1.5) -- (1.80,1.5);
\draw[->,thick,dashed] (1.20,1.5) -- (0,1.5);

\draw[->,dashed,thick,orange] (2.5,0.80) -- (2.5,3.5) -- (1.5,3.5);

\draw[->,dashed,thick,blue] (1.20,1.5) -- (0.5,1.5) -- (0.5,2.5) -- (1.5,2.5) -- (4.5,2.5) -- (4.5,0.5);


\node[fill, color=orange, opacity=0.5, rectangle, draw, radius=0.25, inner sep=6pt, label={}, scale=0.75] at (\xra+0.5,\yra+0.5) (ra) {\small \color{black} \textbf{1}};
\node[fill, color=blue, opacity=0.5,, rectangle, radius=0.25, inner sep=6pt, label={}, scale=0.75] at (\xrb+0.5,\yrb+0.5) (rb) {\small \color{black} \textbf{2}};

\node at (2.5,4.5) {{\scriptsize NE-FSI ($K=8$)}};

\end{tikzpicture}
}
}
\\
\subfloat{ %[$K=6$]{
\hspace{-0.5cm}
\trimbox{-0.2cm 0.0cm 0.0cm 0.4cm}{ 
\centering
\begin{tikzpicture}[scale=0.70]
    \foreach \i [evaluate=\i as \xcoord using int(1+\i)] in {\xmin,...,\xmax} {
        \draw [thick,gray] (\i,\ymin) -- (\i,\ymax) 
        node [below] at (\i + 0.5,\ymin) {\ifthenelse{\i<\xmax}{\xcoord}{}};
    }
    \foreach \i [evaluate=\i as \ycoord using int(1+\i)] in {\ymin,...,\ymax} {
        \draw [thick,gray] (\xmin,\i) -- (\xmax,\i) 
        node [left] at (\xmin,\i + 0.5) {\ifthenelse{\i<\ymax}{\ycoord}{}};
    }

\draw[OliveGreen, very thick, fill=green, opacity=0.5] (1,3) rectangle (2,4);
\draw[OliveGreen, very thick, fill=green, opacity=0.5] (4,0) rectangle (5,1);

\draw[purple, very thick, fill=red, opacity=0.5] (0,0) rectangle (1,1);
\draw[purple, very thick, fill=red, opacity=0.5] (0,3) rectangle (1,4);
\draw[purple, very thick, fill=red, opacity=0.5] (1,0) rectangle (2,1);
\draw[purple, very thick, fill=red, opacity=0.5] (3,0) rectangle (4,1);
\draw[purple, very thick, fill=red, opacity=0.5] (3,3) rectangle (4,4);
\draw[purple, very thick, fill=red, opacity=0.5] (4,3) rectangle (5,4);

\draw[Dandelion, very thick, fill=yellow, opacity=0.5] (0,1) rectangle (1,2);

\draw[->,thick,dashed] (0,2.5) -- (5.0,2.5);
\draw[-,thick,dashed] (5,1.5) -- (1.80,1.5);
\draw[->,thick,dashed] (1.20,1.5) -- (0,1.5);

\draw[->,dashed,thick,orange] (2.5,0.80) -- (2.5,3.5) -- (1.5,3.5);

%\draw[->,dashed,thick,blue] (1.20,1.5) -- (0.5,1.5) -- (0.5,2.5) -- (1.5,2.5) -- (1.5, 3.5);
\node at (0.5,1.5) {\color{blue}{\transparent{0.5} $\bigstar$}};
\node at (1.5,2.5) {\color{blue}{\transparent{0.5} $\bigstar$}};
\node at (2.5,3.5) {\color{blue}{\transparent{0.5} $\bigstar$}};
\node at (2.5,1.5) {\color{blue}{\transparent{0.5} $\bigstar$}};
\node at (3.5,2.5) {\color{blue}{\transparent{0.5} $\bigstar$}};

% \draw[fill=blue, opacity=0.5] (1,2) rectangle (2,3);
% \draw[fill=blue, opacity=0.5] (2,3) rectangle (3,4);
% \draw[fill=blue, opacity=0.5] (3,2) rectangle (4,3);
% \draw[fill=blue, opacity=0.5] (2,1) rectangle (3,2);

\node[fill, color=orange, opacity=0.5, rectangle, draw, radius=0.25, inner sep=6pt, label={}, scale=0.75] at (\xra+0.5,\yra+0.5) (ra) {\small \color{black} \textbf{1}};
\node[fill, color=blue, opacity=0.5, rectangle, draw, radius=0.25, inner sep=6pt, label={}, scale=0.75] at (\xrb+0.5,\yrb+0.5) (rb) {\small \color{black} \textbf{2}};

\node at (2.5,4.5) {{\scriptsize CE ($K=6$)}};

\end{tikzpicture}

\hspace{-0.2cm}

\centering
\begin{tikzpicture}[scale=0.70]
    \foreach \i [evaluate=\i as \xcoord using int(1+\i)] in {\xmin,...,\xmax} {
        \draw [thick,gray] (\i,\ymin) -- (\i,\ymax) 
        node [below] at (\i + 0.5,\ymin) {\ifthenelse{\i<\xmax}{\xcoord}{}};
    }
    \foreach \i [evaluate=\i as \ycoord using int(1+\i)] in {\ymin,...,\ymax} {
        \draw [thick,gray] (\xmin,\i) -- (\xmax,\i) 
        node [left] at (\xmin,\i + 0.5) {\ifthenelse{\i<\ymax}{\ycoord}{}};
    }

\draw[OliveGreen, very thick, fill=green, opacity=0.5] (1,3) rectangle (2,4);
\draw[OliveGreen, very thick, fill=green, opacity=0.5] (4,0) rectangle (5,1);

\draw[purple, very thick, fill=red, opacity=0.5] (0,0) rectangle (1,1);
\draw[purple, very thick, fill=red, opacity=0.5] (0,3) rectangle (1,4);
\draw[purple, very thick, fill=red, opacity=0.5] (1,0) rectangle (2,1);
\draw[purple, very thick, fill=red, opacity=0.5] (3,0) rectangle (4,1);
\draw[purple, very thick, fill=red, opacity=0.5] (3,3) rectangle (4,4);
\draw[purple, very thick, fill=red, opacity=0.5] (4,3) rectangle (5,4);

\draw[Dandelion, very thick, fill=yellow, opacity=0.5] (0,1) rectangle (1,2);

\draw[->,thick,dashed] (0,2.5) -- (5.0,2.5);
\draw[-,thick,dashed] (5,1.5) -- (1.80,1.5);
\draw[->,thick,dashed] (1.20,1.5) -- (0,1.5);

\draw[->,dashed,thick,orange] (2.5,0.80) -- (2.5,2.5) -- (4.5,2.5) -- (4.5,0.5);

\draw[->,dashed,thick,blue] (1.20,1.5) -- (0.5,1.5) -- (0.5,2.5) -- (1.5,2.5) -- (1.5, 3.5);

\node[fill, color=orange, opacity=0.5, rectangle, draw, radius=0.25, inner sep=6pt, label={}, scale=0.75] at (\xra+0.5,\yra+0.5) (ra) {\small \color{black} \textbf{1}};
\node[fill, color=blue, opacity=0.5, rectangle, draw, radius=0.25, inner sep=6pt, label={}, scale=0.75] at (\xrb+0.5,\yrb+0.5) (rb) {\small \color{black} \textbf{2}};

\node at (2.5,4.5) {{\scriptsize CE-FSI ($K=6$)}};

\end{tikzpicture}
}
}
\caption{Strategies for the automated parking example.}
\label{fig:parking}
\end{figure}