2

I'm working on my Final year project where I'm developing a Genetic Algorithm for timetable optimization. It's going fairly well at the minute as I am producing random chromosome's representing my classes timetable. I have my function fitness function designed as well as potential constraint, at the minute I am stuck on the actual weighting of my constraints.

I'm using the following function as my fitness function:

1/1 + (Ci*Wci)

As in Ci being the amount of violations for constraint i and Wci being the weighting for constraint i.

Obviously I need to weight the hard constraints higher than the soft constraint.

I was wondering has any1 used this technique before and is there a range recommended to for these weight values?

Melo1991
  • 375
  • 1
  • 3
  • 7

1 Answers1

0

If you just add the penalty to an individual's current fitness value there's a catch in that the algorithm might optimize the solution without minimizing the penalties. If the algorithm can reduce the fitness value to a higher degree than the penalty the solution becomes better. In using penalties you should direct the search towards the feasible region in addition to optimizing the quality.

I would suggest to assume a constant, but very bad fitness value for all infeasible solutions to which you add the amount of constraint violation. E.g. the individual with the worst objective in your current population could be a sufficient base value. This has the advantage that you bring together all of the solutions in one order: Infeasible solutions would be compared against each other only in how much they violate the constraints, all feasible solutions would be compared against how well they are and in the global scale there would be feasibility vs infeasibility.

If you don't do this, then you're mixing infeasible and feasible solutions throughout the range of your qualities.

Edit: I also think there's something wrong with your fitness function. You're probably missing parentheses.

Andreas
  • 6,447
  • 2
  • 34
  • 46
  • It depends on your problem and the details of the way your algorithm works. Optimal and near-optimal solutions are usually located near constraint boundaries, and it can sometimes be effective to approach them from the infeasible side. Your approach will essentially prevent any infeasible solutions from making it into the population (provide feasible solutions can be found). This might be good, as you say, but it also might be harmful. – deong Nov 21 '12 at 15:39
  • @deong Thanks for your advice. I hope I explained myself well enough, as you can see my solution would rate the prefect solution at 1, therefore i'm trying to optimize the score toas close to 1 as possible. I'm a bit lost with this infeasible side of things, surely I am trying to get rid of any infeasible solutions straight away? – Melo1991 Nov 21 '12 at 15:50
  • @DonAndre I tried to email you I think I found your email address ?? – Melo1991 Nov 21 '12 at 15:50
  • It's true that this depends on the problem, but it's not true that this would prevent infeasible solutions altogether. In a GA if a child is infeasible it is part of the next generation and thus of the next mating pool. The way I arranged the fitness values however would make it less likely for infeasible solutions to get selected for mating, but it would not be impossible, just less possible than the worst feasible individual. I have experienced cases where the algorithm converged to local optima in the infeasible region if the penalty was only an additive to the solution's fitness value. – Andreas Nov 21 '12 at 19:10
  • Sorry, I didn't receive an e-mail. – Andreas Nov 21 '12 at 19:18
  • Ok I think I understand where you're coming from, So in your professional opinion would you advise to continue with current fitness function i am using? Iwas thinking instead of using the roulette wheel of chance method of selection for the next generation I could use a way of finding the highest possible value an infeasible solution could hold and eliminating any solution under that and repopulating my population with children out of the feasible solutions, does this make sense? – Melo1991 Nov 21 '12 at 19:30
  • I would start with simpler solutions and increase complexity if good results cannot be achieved. Regarding selection: You could compare two solutions A and B as follows: If A is feasible and B is feasible take the better one. If A is infeasible and B is infeasible take the one with least constraint violation. If either A or B is feasible, but not both then take the feasible one. That's similar to how e.g. NSGA-II deals with constrained optimization problems. Of course you can only use tournament selection that way. – Andreas Nov 21 '12 at 19:42
  • @DonAndre I was just disscussing the project with my supervisor and we talked about the NSGA-II Algorithm, with my projects title being Multi objective optimization for timetabling, we agreed this route could possibly be the best route for me to take, would you agree? – Melo1991 Nov 22 '12 at 10:54
  • I do not feel confident arguing about what is "best" since I'm not familiar with the project or its goals. I think the discussion goes beyond the scope of the question. Unless you have specific parts that you'd like to see addressed in the answer I suggest to close the topic. Otherwise please open a new question or place a bounty if you want to gain more attention. – Andreas Nov 22 '12 at 14:36
  • Btw, I forgot to add you might also want to consider stochastic ranking if you're dealing with penalties. – Andreas Nov 26 '12 at 13:55