applications of optimization can be done at two level. it can be used to find the optimal location for placing the TCR. Next is to find out the amount of compensation required. several researchers have published many papers employing several optimization algorithms for addressing these problems. THD can be Incorporated in the constraints of optimization problem and this can be used in the algorithms like PSO, GA, etc..
As you are working on optimization, you need.......
(1) frame your cost function first with various variable to decide cost of every parameters eg. cost of TCR, power loss cost, any other benefits in terms of cost..etc...
(2) use some of constraints for your cost function like voltage profile, THD ( You can add depending your application)
(3) use one of intelligent system like ANN, Fuzzy, GA, PSO,....
(4) find out various objective functions of your decided cost function. consider this as input to "intelligent tool" and find the best solutions like Place of TCR and Size......
(5) now draft a proper algorithm/s, sequence of coding accordingly and find the solutions to print/plot .
You need to give thought for your work in this directions....