-
Notifications
You must be signed in to change notification settings - Fork 16
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
Unable to use SSANSGA2 for my problem #6
Comments
Actually, it's not only SSANSGA2, but any surrogate model. For instance I face exactly the same problem with GPSAF-NSGA-II. I also mention that passing from pymoo to pysamo, I had to change some lines in my custom Problem class:
to
otherwise I would get an error, which is not surprising because pysamoo explicitely checks for xl and xu (apparently pymoo didn't). I will soon face a problem (if I can get pysamoo to work), because I will implement a variable based on the "Choice" type, and it's not bounded like ints and floats, so I don't know how to deal with this using xl and xu. I am still lost, made very little progress... I don't know whether my code is faulty or if pysamoo has a bug, in which case I'd like to bypass it. |
pysamoo does not support mixed-variables (at least it was not direclty develoved for it). I am sure it can be customized if the surrogate-models are able to handle this as well. However, RBF or Kriging already assume a continouus variable space. |
Oh, I see... |
yes exactly. And to my knowledge there is not much research done on mixed-variables surrogates either. But I would refer to a related research field which is hyper-parameter optimization. Checkout optuna for example. |
Thank you very much @blankjul , I will check Optuna out. Even though pymoo's tutorial states to remove duplicates to get a better solution, in practice, in my case at least I believe, there's almost no way two solutions are going to be equal, because floats are varied between bounds. It is extremely unlikely that two individuals are the same, even for a pop size of over a million. Therefore the speedup and the use of NoDuplicateElimination() is very valuable. |
Yes pymoo is designed to be modular and for you to easily change its behavior, e.g. like duplicate elimination. Are you working with a large population size? |
Yes, I was working with a large population (it's not very costly to evaluate an individual). In the meantime, I did notice that it was better to use a custom elimination class in order to remove duplicates in a different problem. What surprised me is that even with floats as parameters, I would get duplicates in the population, which I did not expect. It was a particular problem, and in this case it was better to follow the suggestion of the tutorial to remove duplicates. I also tried Optuna, and it seems to solve my problem as I wanted, i.e. run a surrogate multi objective optimization with different types of parameters, including several constraints. So I thank you very much for your suggestion. |
Hi @blankjul, in my case I've created a problem with only binary variables, and I've found that I'm encountering the same error as mentioned in the first comment of the issue (only the size varies). Additionally, I've converted the problem to contain only integer variables, yet I still encounter the same error. Is it normal to encounter the same error if I'm only using discrete variables? |
The error is indicating that the problem is setting the wrong dimension. Make sure the dimensions match the definition (n_obj, n_ieq_constr, ..) |
First, thank you for your response. For example, run the following code: class MyBinaryProblem(ElementwiseProblem):
def __init__(self):
super().__init__(n_var=24, n_obj=2, n_ieq_constr=0, n_eq_constr=4, xl=0, xu=1, vtype=bool)
def _evaluate(self, x, out, *args, **kwargs):
out["F"] = [100.0, 200.0]
out["H"] = [1.0, 0.2, 0.3, 0.1]
problem = MyBinaryProblem()
algorithm = SSANSGA2(n_initial_doe=50,
n_infills=10,
surr_pop_size=100,
surr_n_gen=100)
minimize(problem, algorithm, ("n_gen", 5), seed=1, save_history=False, verbose=True) I get the following error:
What am I doing wrong? Should I define the variable "sampling" in the algorithm? |
It seems that the issue arises because I defined my problem using |
Elementwise Problems don't work in pysamoo if I recall my implementation. But you can just write out the problem definition like this:
|
Ok, I understand. I will try the code you provided, thank you.
I believe this might fix the problem. |
Any update to support mixed variables? Other research is being implemented but partially: https://github.com/huawei-noah/HEBO/tree/master/MCBO & facebook/Ax#2650 |
So far there are no plans to also supported mixed-variables out of the box. |
Hi,
I have a multiobjective (2 objectives) optimization problem that works with pymoo, I solve a 2 constraints with 5 variables to vary (some are floats, some are ints) with a MixedVariableGA() algorithm in pymoo, and it works fine.
I wanted to try the surrogate (pysamoo) approach to see the difference. My problem should be compatible with SSANSGA2 as far as I can see.
My tries lead to an error I haven't been able to fix.
Running the code leads to:
Any pointer to what's possibly wrong is welcome.
The text was updated successfully, but these errors were encountered: