# Solution Evaluation

*The detailed description of the Challenge 2 Solution Evaluation is in Appendix D of the *Problem Formulation.

### Solution Evaluation Algorithm

- Check solution file format against the specification in Appendix C of the Problem Formulation. If a solution file is formatted incorrectly, then the solution is deemed infeasible and evaluation terminates.
- Read solution input variables
*x*, and^{on}_{gk}, x^{sw}_{ek}, x^{sw}_{fk}, x^{st}_{hak}, x^{st}_{fk}, theta_{ik}, q_{jk}, p_{gk}, q_{gk}*t*from the solution files._{jk} - Round integer input variables
*x*and^{st}_{hak}, x^{sw}_{ek}, x^{sw}_{fk}, x^{st}_{fk},*x*to the nearest integer values.^{on}_{gk} - Check domains of integer input variables, i.e. Equations (42), (44), (45), (55) to (57) and (77). If any violation > 0 is found, then the solution is deemed infeasible and evaluation terminates.
- Compute generator start up and shut down variables
*x*and^{su}_{gk}*x*from Equations (78) to (80).^{sd}_{gk} - Check constraints on generator start up and shut down variables, i.e. Equations (85) to (88). If any violation > 0 is found, then the solution is deemed infeasible and evaluation terminates.
- Check simple bounds on continuous input variables
*v*and_{ik}*t*i.e. Equations (29), (30) and (37). If any violation >_{jk},*epsilon*is found, or any*t*_{jk }< 0, then the solution is deemed infeasible and evaluation terminates. - Compute load real and reactive power consumption variables
*p*and_{ik}*q*from Equations (38) and (39)._{ik} - Check simple inequality constraints for load ramping, generator bounds, and generator ramping, i.e. Equations (40), (41) and (81) to (84). If any violation >
*epsilon*is found, or any*p*< 0, then the solution is deemed infeasible and evaluation terminates._{gk} - Compute switched shunt susceptance variables
*b*from Equation (43).^{cs}_{hk} - Compute transformer tap ratio and phase shift variables
*tau*and_{fk}*theta*from Equations (58) to (61)._{fk} - Compute transformer impedance correction variables
*eta*from Equations (66) and (67)._{fk} - Compute transformer series conductance and susceptance variables
*g*and_{fk}*b*from Equations (62) to (65)._{fk} - Compute line and transformer real and reactive power flow variables
*p*and^{o}_{ek}, p^{d}_{ek}, q^{o}_{ek}, q^{d}_{ek}, p^{o}_{fk}, p^{d}_{fk}, q^{o}_{fk},*q*from Equations (46) to (49) and (68) to (71).^{d}_{fk} - Compute minimal bus real and reactive power imbalance variables
*p*, and^{+}_{ik}, p^{-}_{ik}, q^{+}_{ik}*q*from Equations (31) to (36).^{-}_{ik} - Compute minimal line and transformer rating exceedance variables
*s*, and^{+}_{ek}*s*from Equations (50) to (54) and (72) to (76).^{+}_{fk} - Compute bus imbalance block variables
*p*and minimal bus objective variables^{+}_{ikn}, p^{-}_{ikn}, q^{+}_{ikn}, q^{-}_{ikn}*z*from Equations (3) to (12)._{ik} - Compute load block variables
*p*and minimal load objective variables_{jkn}*z*from Equations (13) to (16)._{jk} - Compute line rating exceedance block variables
*s*and maximal line objective variables^{+}_{enk}*z*from Equations (17) to (20)._{ek} - Compute transformer rating exceedance block variables
*s*and maximal transformer objective variables^{+}_{fnk}*z*from Equations (21) to (24)._{fk} - Compute generator real power block variables
*p*and maximal generator objective variables_{gnk}*z*from Equations (25) to (28)._{gk} - Compute case objective variables
*z*from Equation (2)._{k} - Compute total objective variable
*z*from Equation (1). - Return infeasibility indicator and total objective value
*z*.

Numbers in parenthesis correspond to the appropriate equations in the Problem Formulation document.

If the solution is infeasible, set *z = z ^{inf}.*

### Solution Evaluation Source Code

The python Solution Evaluation source code is available on GitHub: https://github.com/GOCompetition/C2DataUtilities

This code can be used as a template for reading the input files and to calculate *z ^{inf}. *It is also used to insure that the datasets are consistent with the problem formulation and have consistent formats. Most of the changes are related to insuring the datasets are consistent with the problem formulation.

The most recent commit was May 20, 2021. See the repo History (main) and History2 (utilities) for details of the changes.