Code Monkey home page Code Monkey logo

ga_knapsack's Introduction

Table of Contents

GA_Knapsack

ナップザック問題の遺伝的アルゴリズムの最適化に際し,GAを用いて最適化した.

ポケモンの手持ちを6体としたとき,限界重量の中で,人気ランキングを最大化する.という条件だ.

コードの解説

遺伝子は,バイナリ表現型ではなく,6つのポケモンを辞書を内包したリストで持っている.

突然変異は,評価ランキングの上から保存している.

交叉は,一点交叉.

DEAPライブラリは使ってはいない.

実行環境

python2

データについて

buzzfeed https://www.buzzfeed.com/awesomer/the-definitive-ranking-of-the-original-151-pokemon?utm_term=.mw5M9Og2P#.mcaQE5bGP

データの入れ方

リストでコード内に直接記述している.

これは良くない.

結果の例

  • 1500
Generation1499: 888 197.0 [(147, 4), (147, 4), (150, 90.5), (150, 90.5), (147, 4), (147, 4)]

参考

https://github.com/DEAP/deap http://testpy.hatenablog.com/entry/2017/01/28/185219

ga_knapsack's People

Contributors

padawansato avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.