NSGA(非支配排序遗传算法).NSGA-II(带精英策略的快速非支配排序遗传算法),都是基于遗传算法的多目标优化算法,是基于pareto最优解讨论的多目标优化. 在官网: http://www.iitk.ac.in/kangal/codes.shtml 可以下载到  NSGA-II  的C语言版源码,下载最新版后打开如下: 其中,nsga2r.c  为主文件,打开后找到核心代码,如下: ; i<=ngen; i++) { selection (parent_pop, child_pop); m…
遗传算法中的交叉操作是 对NSGA-II  源码分析的  最后一部分, 这一部分也是我 从读该算法源代码和看该算法论文理解偏差最大的  函数模块. 这里,首先提一下,遗传算法的  交叉操作.变异操作都是需要设定概率的, 即交叉概率和变异概率. 假设种群个体 大小为  popsize ,  那么交叉操作需要进行 popsize/2 次 ,   变异操作需要进行 popsize 次, 其中每次操作的时候都需要随机生成一个随机数来与给定的概率进行判断,若小于给定的概率则继续执行否则退出该操作. 如果继…
/* Test problem definitions */ # include <stdio.h> # include <stdlib.h> # include <math.h> # include "global.h" # include "rand.h" # define sch1 /* # define sch2 */ /* # define fon */ /* # define kur */ /* # define po…
/* Routines for storing population data into files */ # include <stdio.h> # include <stdlib.h> # include <math.h> # include "global.h" # include "rand.h" /* Function to print the information of a population in a file…
/* Crowding distance computation routines */ # include <stdio.h> # include <stdlib.h> # include <math.h> # include "global.h" # include "rand.h" /* Routine to compute crowding distance based on ojbective function valu…
This is the Readme file for NSGA-II code. About the Algorithm--------------------------------------------------------------------------NSGA-II: Non-dominated Sorting Genetic Algorithm - II Please refer to the following paper for details about the alg…
遗传算法的变异操作 /* Mutation routines */ # include <stdio.h> # include <stdlib.h> # include <math.h> # include "global.h" # include "rand.h" /* Function to perform mutation in a population */ void mutation_pop (population *p…
/* Domination checking routines */ # include <stdio.h> # include <stdlib.h> # include <math.h> # include "global.h" # include "rand.h" /* Routine for usual non-domination checking It will return the following values 1…
tourselect.c  文件中共有两个函数: selection (population *old_pop, population *new_pop) individual* tournament (individual *ind1, individual *ind2) 首先,第一个函数代码如下: /* Routine for tournament selection, it creates a new_pop from old_pop by performing tournament se…
/* Nond-domination based selection routines */ # include <stdio.h> # include <stdlib.h> # include <math.h> # include "global.h" # include "rand.h" /* Routine to perform non-dominated sorting */ void fill_nondominated_…
/* Rank assignment routine */ # include <stdio.h> # include <stdlib.h> # include <math.h> # include "global.h" # include "rand.h" /* Function to assign rank and crowding distance to a population of size pop_size*/ voi…
/* Routines for randomized recursive quick-sort */ # include <stdio.h> # include <stdlib.h> # include <math.h> # include "global.h" # include "rand.h" /* Randomized quick sort routine to sort a population based on a p…
种群解码函数  decode_pop  为包装函数, 核心调用函数为  decode_ind  , 对每个个体进行解码. /* Routines to decode the population */ # include <stdio.h> # include <stdlib.h> # include <math.h> # include "global.h" # include "rand.h" /* Function to d…
这部分比较简单,具体的函数数值计算是需要调用设定的目标函数的,此部分一个不能忽略的问题是  超出限制条件的处理 , 故对此加以解释. 首先是包装函数, 核心操作调用  evaluate_ind  实现. /* Routine for evaluating population members */ # include <stdio.h> # include <stdlib.h> # include <math.h> # include "global.h&qu…
/* A custom doubly linked list implemenation */ # include <stdio.h> # include <stdlib.h> # include <math.h> # include "global.h" # include "rand.h" /* Insert an element X into the list at location specified by NODE */…
/* Routine for mergeing two populations */ # include <stdio.h> # include <stdlib.h> # include <math.h> # include "global.h" # include "rand.h" /* Routine to merge two populations into one */ void merge(population *pop…
在一个月前,我就已经介绍了yolo目标检测的原理,后来也把tensorflow实现代码仔细看了一遍.但是由于这个暑假事情比较大,就一直搁浅了下来,趁今天有时间,就把源码解析一下.关于yolo目标检测的原理请参考前面一篇文章:第三十五节,目标检测之YOLO算法详解. 一 准备工作 在讲解源码之前,我们需要做一些准备工作: 下载源码,本文所使用的yolo源码来源于网址:https://github.com/hizhangp/yolo_tensorflow 下载训练所使用的数据集,我们仍然使用以VOC…
目标检测:nms源码解析 原理:选定一个阈值,例如为0.3,然后将所有3个窗口(bounding box)按照得分由高到低排序.选中得分最高的窗口,遍历计算剩余的2窗口与该窗口的IOU,如果IOU大于阈值0.3,则窗口删除(保留得分高的窗口),再从剩余的窗口中选得分最高的,重复该过程,直到所有窗口都被计算过. import cv2 import numpy as np import random def nms(dets, thresh): print(dets) x1 = dets[:, 0]…
[源码解析] 深度学习流水线并行Gpipe(1)---流水线基本实现 目录 [源码解析] 深度学习流水线并行Gpipe(1)---流水线基本实现 0x00 摘要 0x01 概述 1.1 什么是GPipe 1.2 挑战 0x02 并行机制 2.1 机制分类与权衡 2.1.1 数据并行 2.1.2 模型并行 2.1.3 流水线并行 2.2 如何使用 0x03 Pytorch 手动指定并行方式 3.1 基础知识 3.2 特点 3.3 基本用法 3.4 将模型并行化应用于现有模块 3.5 通过流水线输入…
Spring介绍 Spring(http://spring.io/)是一个轻量级的Java 开发框架,同时也是轻量级的IoC和AOP的容器框架,主要是针对JavaBean的生命周期进行管理的轻量级容器,可以单独使用,也可以和Struts框架,MyBatis框架等组合使用. IoC介绍 IoC是什么 Ioc—Inversion of Control,即“控制反转”,不是什么技术,而是一种设计思想.在Java开发中,Ioc意味着将你设计好的对象交给容器控制,而不是传统的在你的对象内部直接控制.如何理…
EventBus源码阅读记录 repo地址: greenrobot/EventBus EventBus的构造 双重加锁的单例. static volatile EventBus defaultInstance; public static EventBus getDefault() { if (defaultInstance == null) { synchronized (EventBus.class) { if (defaultInstance == null) { defaultInsta…
最难读的Theano代码 这份LSTM代码的作者,感觉和前面Tutorial代码作者不是同一个人.对于Theano.Python的手法使用得非常娴熟. 尤其是在两重并行设计上: ①LSTM各个门之间并行 ②Mini-batch让多个句子并行 同时,在训练.预处理上使用了诸多技巧,相比之前的Tutorial,更接近一个完整的框架,所以导致代码阅读十分困难. 本文旨在梳理这份LSTM代码的脉络. 数据集:IMDB Large Movie Review Dataset 来源 该数据集是来自Stanfo…
概要 这一章,我们对TreeSet进行学习.我们先对TreeSet有个整体认识,然后再学习它的源码,最后再通过实例来学会使用TreeSet.内容包括:第1部分 TreeSet介绍第2部分 TreeSet数据结构第3部分 TreeSet源码解析(基于JDK1.6.0_45)第4部分 TreeSet遍历方式第5部分 TreeSet示例 转载请注明出处:http://www.cnblogs.com/skywang12345/admin/EditPosts.aspx?postid=3311268 第1部…
现在,热修复的具体实现方案开源的也有很多,原理也大同小异,本篇文章以Nuwa为例,深入剖析.  Nuwa的github地址 https://github.com/jasonross/Nuwa 以及用于hotpatch生成的gradle插件地址 https://github.com/jasonross/NuwaGradle 而Nuwa的具体实现是根据QQ空间的热修复方案来实现的.安卓App热补丁动态修复技术介绍.在阅读本篇文章之前,请先阅读该文章. 从QQ空间终端开发团队的文章中可以总结出要进行热…
TreeMap是基于红黑树结构实现的一种Map,要分析TreeMap的实现首先就要对红黑树有所了解.      要了解什么是红黑树,就要了解它的存在主要是为了解决什么问题,对比其他数据结构比如数组,链表,Hash表等树这种结构又有什么优点.   1.二叉查询树.红黑树介绍      以下为个人理解,有误请拍砖...        下面我尽可能用通俗易懂的语言,简单总结一下数组,链表,Hash表以及树的优缺点.      1.数组,优点:(1)随机访问效率高(根据下标查询),(2)搜索效率较高(可…
1.TreeMap介绍 TreeMap是一个通过红黑树实现有序的key-value集合. TreeMap继承AbstractMap,也即实现了Map,它是一个Map集合 TreeMap实现了NavigableMap接口,它支持一系列的导航方法, TreeMap实现了Cloneable接口,它可以被克隆 TreeMap introduction:A Red-Black tree based NavigableMap implementation. The map is sorted accordi…
ModelFactory主要是两个职责: 1. 初始化model 2. 处理器执行后将modle中相应参数设置到SessionAttributes中 我们来看看具体的处理逻辑(直接充当分析目录): 1. 初始化model 1.1 解析类上使用的sessionAttributres,将获取参数合并到mavContainer中 1.2 执行注解了@ModelAttribute的方法,并将结果同步到Model 参数名的生成规则:@ModelAttribute中定义的value > 方法的返回类型决定(…
jQuery2.x源码解析(构建篇) jQuery2.x源码解析(设计篇) jQuery2.x源码解析(回调篇) jQuery2.x源码解析(缓存篇) jQuery这个类库最为核心重要的功能就是DOM操作了.DOM是由w3c制定的为HTML和XML文档编写的应用程序接口,全称叫做W3C DOM,它使得开发者能够修改html和xml的内容和展现方式,将网页与脚本或编程语言连接起来. 但是标准在各个浏览器中的实现是不一样的,同时DOM发展也是循序渐进的,不断地增加新的api,因此各个浏览器乃至各个版…
前言 在spring jdbcTemplate 事务,各种诡异,包你醍醐灌顶!最后遗留了一个问题:spring是怎么样保证事务一致性的? 当然,spring事务内容挺多的,如果都要讲的话要花很长时间,而本片博客的主旨是解决上一篇博客遗留的问题,那么我们把问题细化下来, 就是spring如何保证一个事务中的jdbc connection是同一个? 没有事务 如若没有事务,这个很好理解,可以理解成spring只是对我们一般的jdbc操作进行了一些封装,减少了我们的代码量 1.一般写法 代码中的Con…
1,今天和大家一起从底层看看Handle的工作机制是什么样的,那么在引入之前我们先来了解Handle是用来干什么的 handler通俗一点讲就是用来在各个线程之间发送数据的处理对象.在任何线程中,只要获得了另一个线程的handler,则可以通过 handler.sendMessage(message)方法向那个线程发送数据.基于这个机制,我们在处理多线程的时候可以新建一个thread,这个thread拥有UI线程中的一个handler.当thread处理完一些耗时的操作后通过传递过来的handl…