# The Color Mix Problem
## 3 Hybrid Genetic Algorithm for the Solution of the Color Mix Problem
### Crossover Procedure
Thus, if the best solution stays unchanged for more than \(idle\_iter\_limit=\gamma\tau\) iterations, then the tabu list is wiped out and the search is reset to the one of the \"second\" solutions in \(SM\) (here, \(\tau\) denotes the number of iterations of the TS algorithm, and \(\gamma\) is a futile (idle) iterations limit factor in such a way that \(1\leq\gamma\tau\leq\tau\)). The overall TS process is finished as soon as the maximum number of TS iterations, \(\tau\), have been executed. The pseudo-code of the tabu search algorithm is shown in Algorithm 6. After finishing the tabu search procedure, the obtained solution is subjected to perturbation, which is described in the next section. ```
// pseudocode of the tabu search algorithm // input: \(B\), \(n\), \(m\), \(m_{1}\), \(p\), \(z\), \(c_{1}\), \(c_{2}\), \(c_{3}\) // output: \(p^{\bullet}\), \(z^{\bullet}\), \(c_{1}^{\bullet}\), \(c_{2}^{\bullet}\), \(c_{3}^{\bullet}\) // parameters: \(\tau\), \(h\), \(\alpha\), \(\beta\), \(idle\_iter\_limit\) begin  clear tabu list \(TabuList\); clear hash table \(HashTable\); \(p^{\bullet}\gets p\); \(z^{\bullet}\gets z\); \(c_{1}^{\bullet}\gets c_{1}\); \(c_{2}^{\bullet}\gets c_{2}\); \(c_{3}^{\bullet}\gets c_{3}\); \(q\gets 0\); \(q^{\prime}\gets 0\); \(SM\_Size\gets 0\);  do \(\Delta^{\prime}_{min}\leftarrow\infty\); \(\Delta^{\prime\prime}_{min}\leftarrow\infty\); \(\Delta^{\prime\prime}_{min}\leftarrow\infty\); \(\Delta^{\prime\prime}_{min}\Delta^{\prime\prime}_{min}x^{\prime\prime},x^{ \prime\prime},x^{\prime\prime\prime},flag^{\prime\prime}\leftarrow\textbf{ Neighbourhood\_Search}(0,m_{1},m,n,q,p,z,z^{\bullet},c_{1},\"1\")\); \(\Delta^{\prime\prime}_{min}x^{\prime\prime}_{min}x^{\prime\prime},x^{ \prime\prime\prime},x^{\prime\prime\prime},flag^{\prime\prime}\leftarrow \textbf{Neighbourhood\_Search}(m_{1},m,m,n,q,p,z,z^{\bullet},c_{2},\"2\")\); \(\Delta^{\prime\prime}_{min}x^{\prime\prime}_{min}x^{\prime\prime},x^{ \prime\prime\prime},x^{\prime\prime\prime},flag^{\prime\prime}\leftarrow \textbf{Neighbourhood\_Search}(0,m_{1},m_{1},m,q,p,z,z^{\bullet},c_{3},\"3\")\);  if \((\Delta^{\prime}_{min}\
eq\infty)\)\(SM(SM\_Size)\gets p,z+\Delta^{\prime\prime}_{min},c_{1},c_{2},c_{3},v\",w\",flag\"\); \(SM\_Size\gets SM\_Size+1\) endif; if \((\Delta^{\prime}_{min}\
eq\infty)\) \(p\leftarrow\phi(p,v^{\prime},w^{\prime})\); recalculate \(c_{1},c_{2},c_{3}\) depending on \(v^{\prime},w^{\prime},flag^{\prime}\); \(TabuList(p(v^{\prime}),p(w^{\prime}))\gets q+h\); \(TabuList(p(w^{\prime}),p(v^{\prime}))\gets q+h\); \(z\gets z+\Delta^{\prime}_{min}\); \(HashTable(z)\leftarrow\) FALSE; if \((z^{\bullet}>z)\)\(p^{\bullet}\gets p\); \(z^{\bullet}\gets z\); \(c_{1}^{\bullet}\gets c_{1}\); \(c_{2}^{\bullet}\gets c_{2}\); \(c_{3}^{\bullet}\gets c_{3}\); \(q^{\prime}\gets q\) endif  endif
```

**Algorithm 6**Tabu_Search```
if\((q-q^{\prime}>\mathit{idle\_iter\_limit}\ \wedge\ q<\tau-\mathit{idle\_iter\_limit})\)  clear tabu list TabuList; \(p,z,c_{1},c_{2},c_{3},v^{\prime\prime},w^{\prime\prime},flag^{\prime\prime} \gets SM(\mathbf{Random}(\beta\times SM\_Size,SM\_Size))\) ; \(p\leftarrow\phi(p,v^{\prime\prime},w^{\prime\prime})\) ; recalculate \(c_{1}\), \(c_{2}\), \(c_{3}\) depending on \(v^{\prime\prime},w^{\prime\prime},flag^{\prime\prime}\); \(\mathit{TabuList}(p(v^{\prime\prime}),p(w^{\prime\prime}))\gets q+h\); \(\mathit{TabuList}(p(w^{\prime\prime}),p(v^{\prime\prime}))\gets q+h\); \(\mathit{HashTable}(z)\leftarrow\mathrm{FALSE}\) ; \(q^{\prime}\gets q\) end;; \(q\gets q+1\) while\((q\
eq\tau)\) end. ```  
**Algorithm 7** Neighbourhood_Search  
Notes. 1. \(\tau\) denotes the total number of iterations. 2. \(h\) denotes the tabu tenure (prohibition period). 3. \(\mathit{idle\_iter\_limit}\) denotes the limit of idle search iterations (we used \(\mathit{idle\_iter\_limit}=\max\{3,0.2\tau\}\)). 4. \(SM\) denotes the secondary memory for archiving \"second\" solutions, i.e., solutions that are left second after the evaluation of the neighbourhood \(\Theta_{1}\); \(SM\_Size\) denotes the size of the secondary memory. 5.