anchor.diff:  foldzip([], _, Acc) -> Acc;
   foldzip(_, [], Acc) -> Acc;
   foldzip([HA|TA], [HB|TB], Acc) ->
  -    foldzip(TA, TB, Acc + dot(HA,HB)).
  +    foldzip(TA, TB, Acc + dot(HA, HB)).
   
   dot(X, X) -> 1;
   dot(_, _) -> -1.
  
positive.code: energy(Solution) ->
      L = length(Solution),
      Cs = [foldzip(drop(Solution, K), Solution)
          || K <- lists:seq(1, L-1)],
      E = lists:foldl(fun (X, Acc) -> X*X + Acc end, 0, Cs),
      L*L*0.5/E.
  
  
  -spec recombination(solution(), solution(), sim_params()) -> {solution(), solution()}.
  recombination(S1, S2, _SP) ->
      lists:unzip([recombination_features(F1, F2) || {F1, F2} <- lists:zip(S1, S2)]).
  
  %% @doc Chooses a random order between the two initial features.
  -spec recombination_features(float(), float()) -> {float(), float()}.
  
negative.code:     end.
  
  best_flipped(Solution) ->
      FlippedSols = lists:map(fun (I) -> flip_nth(Solution, I) end,
                              lists:seq(1, length(Solution))),
      First = hd(FlippedSols),
      InitAcc = {First, energy(First)},
      GetBest = fun (S, {AccSol, AccE}) ->
                        E = energy(S),
                        case E > AccE of
                            true -> {S, E};
                            _ -> {AccSol, AccE}
                        end
                end,
      lists:foldl(GetBest, InitAcc, FlippedSols).
  
  flip_nth(Sol, N) ->
  