• 大小: 4.64KB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2024-05-09
  • 语言: Python
  • 标签: python  py  算法  

资源简介

帝国竞争算法python实现

资源截图

代码片段和文件信息

import numpy as np
import parameters as param

class Country:

    def __init__(self representation):
        self.colonies = []
        self.representation = representation  #np.array length
        self.makespan = self._calculateCost()


    #CALCULATORS
    def _calculateCost(self):
        ETC = param.ETC
        return np.sum(np.multiply(ETC.Tself.representation))

    #GETTERS

    def isColony(self):
        return False

    def isImperialist(self):
        return not self.isColony(self)

    def getRepresentation(self):
        return self.representation

    def getCost(self):
        return self.makespan

    def getTimeFitness(self):
        return None

    #SETTERS

    def setRepresentation(selfrepresentation):
        self.representation = representation
        self._calculateCost()

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2017-10-25 02:19  imperialist-competitive-algorithm-master\
     文件         488  2017-10-25 02:19  imperialist-competitive-algorithm-master\config.txt
     文件         813  2017-10-25 02:19  imperialist-competitive-algorithm-master\country.py
     文件        1141  2017-10-25 02:19  imperialist-competitive-algorithm-master\empire.py
     文件        7941  2017-10-25 02:19  imperialist-competitive-algorithm-master\ica.py
     文件         656  2017-10-25 02:19  imperialist-competitive-algorithm-master\parameters.py
     文件         351  2017-10-25 02:19  imperialist-competitive-algorithm-master\util_functions.py

评论

共有 条评论