Coder Social home page Coder Social logo

Help with GA about mha-tsp HOT 5 CLOSED

thieu1995 avatar thieu1995 commented on August 23, 2024
Help with GA

from mha-tsp.

Comments (5)

thieu1995 avatar thieu1995 commented on August 23, 2024

@fatihmuaddib ,

Have you installed the lastest version of mealpy==2.4.0 ?

I add the code and results for GA here:
https://github.com/thieu1995/MHA-TSP/blob/main/04_ga_tsp_basic.py

For GA, it has so many strategies and parameters you can turn to get a better results.
You can check the document here: https://mealpy.readthedocs.io/en/latest/pages/models/mealpy.evolutionary_based.html#module-mealpy.evolutionary_based.GA

For example:

model2 = BaseGA(problem_dict1, epoch, pop_size, pc, pm, selection="tournament", k_way=0.4, crossover="multi_points")

model3 = BaseGA(problem_dict1, epoch, pop_size, pc, pm, crossover="one_point", mutation="scramble")

model4 = BaseGA(problem_dict1, epoch, pop_size, pc, pm, crossover="arithmetic", mutation_multipoints=True, mutation="swap")

model5 = BaseGA(problem_dict1, epoch, pop_size, pc, pm, selection="roulette", crossover="multi_points")

model6 = BaseGA(problem_dict1, epoch, pop_size, pc, pm, selection="random", mutation="inversion")

model7 = BaseGA(problem_dict1, epoch, pop_size, pc, pm, crossover="arithmetic", mutation="flip")

Best regards,

from mha-tsp.

thieu1995 avatar thieu1995 commented on August 23, 2024

@fatihmuaddib ,

Sorry my bad tho. I have checked my code again and see that I'm still using WOA model instead of GA model.
After test with GA model for this particular problem (TSP). It is also show the error like you've got.

I have to check the code in Mealpy library and found a problem. I forgot to call the function amend_position after the mutation_process. Therefor, for this discrete problem, GA model can't be used.

I will fix in the new version of Mealpy. You should try algorithms instead of GA. There is like 150 other algorithms you can test with.

Best regards,

from mha-tsp.

fatihmuaddib avatar fatihmuaddib commented on August 23, 2024

Well good to know it wasn't my lack of skill. And while it is a great tool to play with meta heuristics. I do have a dead line to use GA. I'll switch to MATLAB for now.

from mha-tsp.

thieu1995 avatar thieu1995 commented on August 23, 2024

@fatihmuaddib ,

Have you check the latest version of Mealpy. I've fixed the problem in GA.

from mha-tsp.

fatihmuaddib avatar fatihmuaddib commented on August 23, 2024

Thanks for the awesome work!

from mha-tsp.

Related Issues (2)

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.