pip install cec2005real==0.1
我这么做失败了。于是我选择把项目下载下来安装
git clone https://github.com/dmolina/cec2005real.git cd cec2005real pip install cpython # 你需要Microsoft Visual C++ Build Tools,对于python3.5以上,可以通过这个链接安装:http://go.microsoft.com/fwlink/?LinkId=691126 。
python setup.py install
遇到错误,这个包应该是不知道windows下的microsoft vc编译安装。
使用另一个工具包optproblems.
pip install optproblems
其使用参考链接见:https://ls11-www.cs.tu-dortmund.de/people/swessing/optproblems/doc/cec2005.html
参考使用程序:
#导入包 import optproblems import optproblems.cec2005 #初始化函数 f1 = optproblems.cec2005.F1(10) #10是输入的个体的维度,这里意味着接受的输入是1x10维的个体 indv = optproblems.base.Individual([11,12,13,14,15,90,17,18,19,20]) #设定需要评估的个体 f1.evaluate(indv) print(indv.objective_values)#个体值