-
Notifications
You must be signed in to change notification settings - Fork 381
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
Real Variable Type - Precision addition #399
base: main
Are you sure you want to change the base?
Real Variable Type - Precision addition #399
Conversation
Added precision for the Real variable type sample generation
First of all, thank you for your contribution! The main problem I see here is that this only is used in the sampling. However, the mutation and crossover would still allow in any type of precision. An elegant way to restrict the search is implementing a e.g.
For mixed variables, this would look a little different though (you would have to iterate over each variable and round it). Or is your use case strictly restricted to having a specific precision during sampling? |
Hi @blankjul , First of all, I appreciate your response and thank you for building pymoo. I tried the approach after modifying the code for my use case, using the following custom "Repair" class -
Please Note : I had to use the dataframe because I have both categorical and numerical variables in my dataframe and the rounding off would be done for just the numerical columns of choice ("rounding_off_by_features"). the For loop post that is to convert to datatype expected by the objective and constraint functions. Although, the res.X does not abide by the same laws, is there a way I can restrict mutation and crossover to also abide by the laws of precision I'm setting for each element in the decision space ? After the first round of optimisation, where I tried to debug the code, the mutation and crossover eventually move the variable precisions back to default. Please let me know if there is a solution for this. |
Do you have a solution without pandas? So far pymoo does not have pandas as a dependency and I would not like to add it for one line of code at this point. |
@blankjul I completely understand your concern. I tried this solution, although it involves for loops (which I ideally don't like to add to numpy calculations), but for my case, this worked perfectly. Please let me know your thoughts on this. I can help and would love to test this comprehensively if needed and get it added to the package.
Thanks. |
Did you test the code above on a purely vectorized problem? For example, NSGA-II on ZDT1? Originally, I was not planning to add mixed variables because it breaks whenever a numpy array is expected. I think this is a very good example where operators don't really work for all variable types at the same time. |
For certain cases, the Real value data type might not need a default numpy precision for sampling, if we could set precision for every variable, that would prevent unnecessary exploration in the search space