Computing Engine


The computing engines in Portfolio Probe for random portfolios and for portfolio optimization mostly share the same basic elements. The algorithm is described as “genetic” but it really consists of three types of algorithms:

  • genetic
  • simulated annealing
  • greedy

Some people would categorize it as a hybrid heuristic algorithm.


Genetic algorithms mimic the evolutionary process of living beings. There is a population of solutions, a mating process that produces new solutions based on combinations of the parent solutions, and a death process that determines which solutions remain in the population. The original genetic algorithm was egregiously inefficient, but algorithms that don’t try so hard to match biological systems can work well.

simulated annealing

The basic idea of simulated annealing is to take random steps away from the best solution and move to a better solution if one is found. The search proceeds from around the new best solution. (A real description of simulated annealing is more complicated, but this description is quite accurate for what is done in Portfolio Probe.  Technically what is described, and used in Portfolio Probe, is local search.)


The idea of greedy algorithms is that you move the solution to be as good as possible locally without worrying about the global implications. It can be proved for some problems that a greedy algorithm gets you to the global optimum. Portfolio optimization is not one of those problems.

One of the greedy algorithms used in Portfolio Probe is nicknamed “polishing”. This process tries to improve the amount of one particular asset in the trade while changing all of the others by roughly equal amounts in order to maintain the monetary constraints.

random portfolios

It is unlikely to be obvious what is being optimized when a random portfolio is being generated. A function is created that has a (positive) penalty for each constraint that is broken — the more the constraint is broken, the larger the penalty. A random portfolio is generated by minimizing that function. The minimum possible value is zero, meaning that all constraints are satisfied. Once a solution is found with zero penalties, that solution is saved as a random portfolio.


Some sort of random algorithm is mandatory for generating random portfolios. Advantages of this approach for portfolio optimization include:



Whatever the constraints and the utility, a genetic algorithm can cope.

Related blog posts