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

  • Home
  • SEARCH
  • 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 5843761
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T12:11:57+00:00 2026-05-22T12:11:57+00:00

I have to do a project which using a genetic algorithm solves the subset

  • 0

I have to do a project which using a genetic algorithm solves the subset sum problem. Unfortunately, when coding the algorithm I found a big problem …

My algorithm:

  • as long as no solution was found and the number of steps is smaller than steps do:
  • calculate the probability and then distribution function for each chromosome
  • perform selection (roulette)
  • select n chromosomes to be crossed
  • perform the crossing (the crossing point is selected randomly)
  • select m chromosomes to mutation
  • perform mutations
  • if you found a solution then stop

(Algorithm was taken from the book “Genetic Algorithms + Data Structures = Evolution Programs, Chapter 2 “)
Variables such as population size, amount of data, scope of data collection, number of steps, the number of mutations (in step), the number of crossings (in a step) is set rigidly in the program options.

The problem is that after a certain (relatively small) number of steps in the population all the chromosomes are identical. The problem illustrates this graph:
http://imageshack.us/m/96/7693/wykresb.png

What I’m doing wrong? How to fix it?
Thanks in advance.

Edit:

Here You can find logs from my app:
http://paste.pocoo.org/show/391318/

I think that roulette is not the best solution (as deong said). Mutations also need to improve.

  • 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-05-22T12:11:58+00:00Added an answer on May 22, 2026 at 12:11 pm

    I had a similar problem before, I wish it s the same as your’s

    First, you need to check (using any measuring metric) if chromosome A is better than chromosome B. This let you have a strict order of the chromosomes of your population and be able to sort your population.

    Then, when you produce a new chromosome (either by mutation or crossover) you may be producing a chromosome that already exist in your population. Make sure not to include this in your population list.

    In other words, make sure your list always contains different chromosomes and always sorted from best to worst !

    Note:
    The genetic algorithms I work with are usually like this (this is the most general algorithm and most used):

    • create P different chromosomes and
      add them to list Pop;

      1. while (no optimal solution is found && number of iteration < LIM)
      2. create new chromosomes using crossover, mutation or any other
        methods;
      3. add the created chromosome to list Pop
      4. sort the list Pop (from best-fit to worst-fit)
      5. select the first P different chromosomes and discard all other
        from Pop.
      6. end while
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a project which is source controlled using Subversion and VisualSVN. Since the
I have a Silverlight Project which passes data using the Data Contract to a
I have a MS Project file which I am using the Primary Interop Assemblies
I have a rather large (freeware) project written with Delphi 2007 which is using
I have a .net 1.1 project in VS.Net 2003 (using C#) in which I
We have a git project which has quite a big history. Specifically, early in
I have a project which I build using SCons (and MinGW/gcc depending on the
I have an ASP.net project which involves using a custom IHttpModule. This module will
For a project using LINQ to Entities 4.0, I have a setting in which
Using Visual Studio 2010 C++. I have a project which uses MFC and I

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.