Skip to main content
. 2018 Jan 4;8(1):3. doi: 10.3390/metabo8010003
Algorithm 4 Simulated annealing core improvement algorithm.
  •   1:

    Function AnnealCore(genomeScaleModel, InitialCoreReactionSet, AnnealingSchedule, minimumOverlap, maximumSize, currencyMetaboliteSet):

  •   2:

     currentSet = InitialCoreReactionSet

  •   3:

     oldBoundaryFluxes = LimitFluxToCore(genomeScaleModel, currentSet, currencyMetaboliteSet)

  •   4:

     oldEnergy = ∑ oldBoundaryFluxes

  •   5:

     for temperature in AnnealingSchedule:

  •   6:

      newSet = MoveCore(genomeScaleModel, currentSet, InitialCoreReactionSet, minimumOverlap, maximumSize)

  •   7:

      newBoundaryFluxes = LimitFluxToCore(genomeScaleModel, newset, currencyMetaboliteSet)

  •   8:

      newEnergy = ∑ newBoundaryFluxes

  •   9:

      if newEnergy < oldEnergy:

  • 10:

       currentSet = newSet

  • 11:

      else if Exp(oldEnergynewEnergytemperature)>Rand(0,1): # here Rand returns a random floating point number between 0 and 1

  • 12:

       currentSet = newSet

  • 13:

      oldEnergy = newEnergy

  • 14:

     return currentSet

  • 15:

  • 16:

    Function MoveCore(genomeScaleModel, currentSet, InitialCoreReactionSet, minimumOverlap, maximumSize):

  • 17:

     if (Rand(0,1) > 0.5) or (length(currentSet) ≥ maximumSize): # here Rand returns a random floating point number between 0 and 1

  • 18:

      randomReaction = selectRandomElement(currentSet)

  • 19:

      newCore = currentSet.remove(randomReaction)

  • 20:

      if IsConnectedComponent(newCore, genomeScaleModel): # check if all reactions are connected to each other

  • 21:

       overlap = length(InitialCoreReactionSet.intersection(newCore))/length (InitialCoreReactionSet)

  • 22:

       if overlap ≥ minimumOverlap:

  • 23:

        return newCore

  • 24:

       else:

  • 25:

        return currentSet

  • 26:

      else:

  • 27:

       return currentSet

  • 28:

     else:

  • 29:

      boundaryReactionSet = CoreBoundary(genomeScaleModel, currentSet, currencyMetaboliteSet)

  • 30:

      return currentSet.add(selectRandomElement(boundaryReactionSet))