Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial guess list in dFST-PSO #20

Open
cristina-29 opened this issue Dec 14, 2021 · 1 comment
Open

Initial guess list in dFST-PSO #20

cristina-29 opened this issue Dec 14, 2021 · 1 comment

Comments

@cristina-29
Copy link

cristina-29 commented Dec 14, 2021

Hello Marco,

I want to perform a discrete optimization and I am using the dFST-PSO (=1.8.1 version).
I am having some issues with the usage of an initial guess list, for which the algorithm seems to not convert the discrete problem to a continuous one (while there is no problem when I do initial_guess_list=None). Here I report an example of what I am doing:

nb_particles = 13

FP = FuzzyPSO()
FP.set_search_space_discrete(discrete_list)
FP.set_swarm_size(nb_particles)
FP.set_parallel_fitness(fitness=eval_function_parallel_swarm, arguments=args, skip_test=True)

_, best_fitness, best_solution = FP.solve_with_fstpso(
max_iter=max_swarm_iter, initial_guess_list=initial_guess_list,
max_iter_without_new_global_best=max_swarm_iter_without_new_global_best,
verbose=False
)

The discrete_list is a list-of-list, something like this:
discrete_list = [ [ 'a', 'b', 'c', 'd'], ['e', 'f', 'g'], ['e', 'f', 'g'] ]

So, 3 variables where each of them can be one of those letters. I want to start from an initial list, that is:
initial_guess_list = [ [ 'a', 'g', 'g' ] ]
So, I want the first particle of the first swarm iteration to be equal to this initial guess list, while the other particles (both of the first swarm iteration and of all the next swarm iterations) should be initialized randomly by dFST-PSO.
For this reason, I set initial_guess_list=initial_guess_list. Well, what I receive as output is this:

  • FST-PSO converted the 3D discrete problem to a 10D real valued probabilistic problem
  • Search space boundaries automatically set to: [[0, 1], [0, 1], [0, 1], [0, 1], [0, 1], [0, 1], [0, 1], [0, 1], [0, 1], [0, 1]]
  • Max velocities set to: [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]
  • Number of particles automatically set to 24
  • Swarm size now set to 13 particles
  • Parallel fitness requested
  • Maximum number of iterations without any update of the global best set to 5
    ERROR: each initial guess must have length equal to 10, aborting.

If I set initial_guess_list=None, instead, it does NOT give me ERROR: it creates 13 particles having 3 variables by choosing randomly each of them from those letters I provided in discrete_list, as expected.

Hence, I am just wondering why is it requiring me to provide an initial guess list having a length equal to 10. Is the initial guest list correctly initialized or not? Or could be it related to other kind of issues?

Thank you very much in advance for any help you can provide!

@aresio
Copy link
Owner

aresio commented Dec 15, 2021

Dear Cristina,

thank you for pointing out this issue. As a matter of fact, dFST-PSO tries to convert the discrete problem to a continuous one, by estimating the parameters of a probabilistic model generating high quality solutions. When you provide a list of initial guesses, dFST-PSO expects that you provide a list of guesses for the continuous problem (i.e., the probabilities). One possible solution could be to provide an initial guess corresponding to [['a', 'g', 'g']], i.e., [[1,0,0,0,0,0,1,0,0,1]]

This is actually a very interesting bug / unexpected behavior that I will solve immediately. I think that, in the discrete case, the user should provide a hint from the original solution-space and the conversion to probability should be solved (internally and transparently) by dFST-PSO. I will work on that.

Best,

Marco

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants