Code Monkey home page Code Monkey logo

ilc1.tsp's Introduction

TP 4A 2020-21: The traveling salesman problem (TSP) with genetic algorithm

Questions

  1. Fork this github repository (2 points)
  2. Run the project
  3. Comment the 3 classes: City, Population & Tour (3 points)
  4. Commit your changes and check-it into github
  5. On github, make a pull request (1 point)
  6. Complete the next section: "Analyze IADT functions" into this file (2 points)
  7. Commit your changes (commit README.md)
  8. On github, update your pull request (1 point)
  9. Make tests defined into section: "Functions to test now" (call your test functions using the rule: GIVEN_WHEN_THEN) (10 points)
  10. Check the test coverage with the Jacoco coverage report provided into: /target/site/jacoco/index.html
  11. Commit your changes
  12. On github, update your pull request (1 point)
  13. that ends

Analyze IADT functions

Hereafter, for each classes give function to be tested. Remember that all functions does not have to be tested, some code can be checked by a simple inspection or an analyse, another code can be validated by definition (rules, etc) the others function can be tecsted by unit tests, integration tests or validation tests (IADT: Inspect, Analyse, Define, Test).

Validation Mode Why ? When ?
I: Inspect No test needed, just a simple static test (visual) on a subset of classes (commentaries, indentation, etc.)
A: Analyze Not easy to test but the algorithm is well know and can be check by a static analyze
D: Def/Dem You can Demonstrate the function or by Definition the function needs not test (generate code, call functions, etc.)
T: Test the function can be easily test

Class City

Function I A D T Comment
distanceToCity T A tester
getX D Accesseur
getY D Accesseur
toString I surcharge de fonction , fonction basique

Class Tour

Function I A D T Comment
containsCity D Recherche dans un tableau
getCity D Accesseur
getDistance T A tester
getFitness D Accesseur
setCity D appel à une fonction
tourSize D appel à une fonction
toString I surcharge de fonction , fonction basique

Class Population

Function I A D T Comment
getFittest T A tester
getTour D Accesseur
populationSize D Accesseur
saveTour D Fonction simple

Functions to test now

Class City

public double distanceTo(City city)

Class Tour

public int getDistance()

Class GA

public static Population evolvePopulation(Population pop)

Tricks & tips

  • Start with simple classes (models, libraries, etc) at the end make test into complex classes (classes with multiple relations)
  • Never test auto generate code
  • Never test creator (its a design problem)
  • Use @Test before each testFunction !
  • You can test a function than throws an exception with the argument: expected
@Test(expected=Exception.class)

Documentation

http://www.theprojectspot.com/tutorial-post/applying-a-genetic-algorithm-to-the-travelling-salesman-problem/5

ilc1.tsp's People

Contributors

mortpo avatar cfranccyrille 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.