Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7790815
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T21:42:09+00:00 2026-06-01T21:42:09+00:00

Question after BIG edition : I need to built a ranking using genetic algorithm,

  • 0

Question after BIG edition :

I need to built a ranking using genetic algorithm, I have data like this :

P(a>b)=0.9
P(b>c)=0.7
P(c>d)=0.8
P(b>d)=0.3

now, lets interpret a,b,c,d as names of football teams, and P(x>y) is probability that x wins with y. We want to build ranking of teams, we lack some observations P(a>d),P(a>c) are missing due to lack of matches between a vs d and a vs c.
Goal is to find ordering of team names, which the best describes current situation in that four team league.

If we have only 4 teams than solution is straightforward, first we compute probabilities for all 4!=24 orderings of four teams, while ignoring missing values we have :

P(abcd)=P(a>b)P(b>c)P(c>d)P(b>d)

P(abdc)=P(a>b)P(b>c)(1-P(c>d))P(b>d)

…

P(dcba)=(1-P(a>b))(1-P(b>c))(1-P(c>d))(1-P(b>d))

and we choose the ranking with highest probability. I don’t want to use any other fitness function.

My question :

As numbers of permutations of n elements is n! calculation of probabilities for all
orderings is impossible for large n (my n is about 40). I want to use genetic algorithm for that problem.

Mutation operator is simple switching of places of two (or more) elements of ranking.

But how to make crossover of two orderings ?

Could P(abcd) be interpreted as cost function of path ‘abcd’ in assymetric TSP problem but cost of travelling from x to y is different than cost of travelling from y to x, P(x>y)=1-P(y<x) ? There are so many crossover operators for TSP problem, but I think I have to design my own crossover operator, because my problem is slightly different from TSP. Do you have any ideas for solution or frame for conceptual analysis ?

The easiest way, on conceptual and implementation level, is to use crossover operator which make exchange of suborderings between two solutions :

CrossOver(ABcD,AcDB) = AcBD

for random subset of elements (in this case ‘a,b,d’ in capital letters) we copy and paste first subordering – sequence of elements ‘a,b,d’ to second ordering.

Edition : asymetric TSP could be turned into symmetric TSP, but with forbidden suborderings, which make GA approach unsuitable.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T21:42:10+00:00Added an answer on June 1, 2026 at 9:42 pm

    It’s definitely an interesting problem, and it seems most of the answers and comments have focused on the semantic aspects of the problem (i.e., the meaning of the fitness function, etc.).

    I’ll chip in some information about the syntactic elements — how do you do crossover and/or mutation in ways that make sense. Obviously, as you noted with the parallel to the TSP, you have a permutation problem. So if you want to use a GA, the natural representation of candidate solutions is simply an ordered list of your points, careful to avoid repitition — that is, a permutation.

    TSP is one such permutation problem, and there are a number of crossover operators (e.g., Edge Assembly Crossover) that you can take from TSP algorithms and use directly. However, I think you’ll have problems with that approach. Basically, the problem is this: in TSP, the important quality of solutions is adjacency. That is, abcd has the same fitness as cdab, because it’s the same tour, just starting and ending at a different city. In your example, absolute position is much more important that this notion of relative position. abcd means in a sense that a is the best point — it’s important that it came first in the list.

    The key thing you have to do to get an effective crossover operator is to account for what the properties are in the parents that make them good, and try to extract and combine exactly those properties. Nick Radcliffe called this “respectful recombination” (note that paper is quite old, and the theory is now understood a bit differently, but the principle is sound). Taking a TSP-designed operator and applying it to your problem will end up producing offspring that try to conserve irrelevant information from the parents.

    You ideally need an operator that attempts to preserve absolute position in the string. The best one I know of offhand is known as Cycle Crossover (CX). I’m missing a good reference off the top of my head, but I can point you to some code where I implemented it as part of my graduate work. The basic idea of CX is fairly complicated to describe, and much easier to see in action. Take the following two points:

    abcdefgh
    cfhgedba
    
    1. Pick a starting point in parent 1 at random. For simplicity, I’ll just start at position 0 with the “a”.

    2. Now drop straight down into parent 2, and observe the value there (in this case, “c”).

    3. Now search for “c” in parent 1. We find it at position 2.

    4. Now drop straight down again, and observe the “h” in parent 2, position 2.

    5. Again, search for this “h” in parent 1, found at position 7.

    6. Drop straight down and observe the “a” in parent 2.

    7. At this point note that if we search for “a” in parent one, we reach a position where we’ve already been. Continuing past that will just cycle. In fact, we call the sequence of positions we visited (0, 2, 7) a “cycle”. Note that we can simply exchange the values at these positions between the parents as a group and both parents will retain the permutation property, because we have the same three values at each position in the cycle for both parents, just in different orders.

    8. Make the swap of the positions included in the cycle.

    Note that this is only one cycle. You then repeat this process starting from a new (unvisited) position each time until all positions have been included in a cycle. After the one iteration described in the above steps, you get the following strings (where an “X” denotes a position in the cycle where the values were swapped between the parents.

    cbhdefga
    afcgedbh
    X X    X
    

    Just keep finding and swapping cycles until you’re done.

    The code I linked from my github account is going to be tightly bound to my own metaheuristics framework, but I think it’s a reasonably easy task to pull the basic algorithm out from the code and adapt it for your own system.

    Note that you can potentially gain quite a lot from doing something more customized to your particular domain. I think something like CX will make a better black box algorithm than something based on a TSP operator, but black boxes are usually a last resort. Other people’s suggestions might lead you to a better overall algorithm.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I edited this question after i found a solution... i need to understand why
This is a big-picture question... but I also have details on the problem I
I'm doing some math with really big numbers (I'm using Python, but this question
I'm using sqlalchemy. The question is simple, but I have a big problem, because
I came across this question after searching for a ODBC or JDBC. To my
(creating a separate question after comments on this: Javascript redeclared global variable overrides old
After reading this question , i saw the answer by Naveen containing a link
After reading and commenting on this question PHP Library for Keeping your site index
After taking a look at this SO question and doing my own research, it
After thinking about This Question and giving an answer to it I wanted to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.