博客
关于我
Objective-C实现遗传算法(附完整源码)
阅读量:797 次
发布时间:2023-02-22

本文共 2293 字,大约阅读时间需要 7 分钟。

Objective-C??????

#import           #define POP_SIZE 10          @interface Solution : NSObject          @end          @implementation Solution              + (NSArray *)solveProblem:(id)problem {                  // ??????????????????                  return nil;              }          @end          int main(int argc, char **argv) {              // ????????????????????              NSPopulation *population = [NSPopulation populationWithPopSize:POP_SIZE];              [population setFitnessFunction:^float(id pop, id individual) {                  // ?????????????????                  return 0; // ??????              }];              [population setSelectionOperator:^id(id pop, id a, id b) {                  // ??????????????                  return nil; // ???????              }];              [population setCrossoverOperator:^id(id pop, id a, id b) {                  // ??????????????                  return nil; // ????????              }];              [population setMutationOperator:^id(id pop, id individual) {                  // ??????????????                  return nil; // ????????              }];              // ????????              [population evolve];              // ????              return 0;          }            

?????????????????????????????????????????????????????????????????????????

?????

- `#import

`????Objective-C????????????????? - `#define POP_SIZE 10`?????????? - `@interface Solution : NSObject`???????????????NSObject? - `@implementation Solution`??????????????? - `+ (NSArray *)solveProblem:(id)problem`?????????????????????????? - `int main(int argc, char **argv)`????????????????????

?????

???????????????????????????? - ??????????? roulette wheel selection ? tournament selection? - ?????????????????????? - ?????????????????????????

?????

??????????????????????????? - ?????? - ?????? - ???????

?????

?????????????????? - ??????????????????????????????????? - ???????????????????????????? - ?????????????????????

转载地址:http://wnsfk.baihongyu.com/

你可能感兴趣的文章
Objective-C实现设置文件最后修改时间(附完整源码)
查看>>
Objective-C实现设置静态IP地址和网关(附完整源码)
查看>>
Objective-C实现设置默认音频设备(附完整源码)
查看>>
Objective-C实现访问SQL实例(附完整源码)
查看>>
Objective-C实现误差逆传播算法(附完整源码)
查看>>
Objective-C实现读写bmp文件 (附完整源码)
查看>>
Objective-C实现读写CSV文件(附完整源码)
查看>>
Objective-C实现读写INI文件(附完整源码)
查看>>
Objective-C实现读写json文件实例(附完整源码)
查看>>
Objective-C实现读写wav音频文件(附完整源码)
查看>>
Objective-C实现读写二进制文件(附完整源码)
查看>>
Objective-C实现读写蓝牙串口(附完整源码)
查看>>
Objective-C实现读写锁(附完整源码)
查看>>
Objective-C实现调度器(附完整源码)
查看>>
Objective-C实现调节笔记本屏幕亮度(附完整源码)
查看>>
Objective-C实现调节系统音量(与任务栏音量同步)(附完整源码)
查看>>
Objective-C实现责任链模式(附完整源码)
查看>>
Objective-C实现质因数算法(附完整源码)
查看>>
Objective-C实现贪婪合并排序算法(附完整源码)
查看>>
Objective-C实现费马检测算法(附完整源码)
查看>>