You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
def __init__(self, **kwargs):
vars = {
"b": Binary(),
"x": Choice(options=["nothing", "multiply"]),
"y": Integer(bounds=(0, 2)),
"z": Real(bounds=(0, 5)),
}
super().__init__(vars=vars, n_obj=1, **kwargs)
def _evaluate(self, X, out, *args, **kwargs):
b, x, z, y = X["b"], X["x"], X["z"], X["y"]
f = z + y
if b:
f = 100 * f
if x == "multiply":
f = 10 * f
out["F"] = f
I used the mixed-type variable setting method in the tutorial, but found that each variable can only generate one value each time it is evaluated, instead of specifying upper and lower limits to generate a matrix of corresponding dimensions like a normal Problem. If it is a normal Problem definition method, can each candidate solution be of binary type? Maybe I do not understand the specific method of generating candidate solutions. But according to my understanding, I need to use binary and floating-point variables in normal Problem。
The text was updated successfully, but these errors were encountered:
If you have a SINGLE type you can define a vector. For mixed problems you always define one variable at a time.
You can define a problem with binary vectors as variables this way: https://pymoo.org/customization/binary.html
class MixedVariableProblem(ElementwiseProblem):
I used the mixed-type variable setting method in the tutorial, but found that each variable can only generate one value each time it is evaluated, instead of specifying upper and lower limits to generate a matrix of corresponding dimensions like a normal Problem. If it is a normal Problem definition method, can each candidate solution be of binary type? Maybe I do not understand the specific method of generating candidate solutions. But according to my understanding, I need to use binary and floating-point variables in normal Problem。
The text was updated successfully, but these errors were encountered: