Skip to content

Commit 1a3db08

Browse files
author
Julian Blank
committed
0.5.0.rc7
1 parent 95c112b commit 1a3db08

File tree

2 files changed

+26
-25
lines changed

2 files changed

+26
-25
lines changed

pymoo/problems/multi/modact.py

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -30,29 +30,27 @@ def __init__(self, function, pf=None, **kwargs):
3030
self.function = function
3131
self.pf = pf
3232

33-
# try:
34-
# import modact.problems as pb
35-
# except:
36-
# raise Exception("Please install the modact library: https://github.com/epfl-lamd/modact")
37-
#
38-
# if isinstance(function, pb.Problem):
39-
# self.fct = function
40-
# else:
41-
# self.fct = pb.get_problem(function)
42-
#
43-
# lb, ub = self.fct.bounds()
44-
# n_var = len(lb)
45-
# n_obj = len(self.fct.weights)
46-
# n_constr = len(self.fct.c_weights)
47-
# xl = lb
48-
# xu = ub
49-
#
50-
# self.weights = np.array(self.fct.weights)
51-
# self.c_weights = np.array(self.fct.c_weights)
52-
#
53-
# super().__init__(n_var=n_var, n_obj=n_obj, n_constr=n_constr, xl=xl, xu=xu, type_var=np.double, **kwargs)
54-
55-
super().__init__()
33+
try:
34+
import modact.problems as pb
35+
except:
36+
raise Exception("Please install the modact library: https://github.com/epfl-lamd/modact")
37+
38+
if isinstance(function, pb.Problem):
39+
self.fct = function
40+
else:
41+
self.fct = pb.get_problem(function)
42+
43+
lb, ub = self.fct.bounds()
44+
n_var = len(lb)
45+
n_obj = len(self.fct.weights)
46+
n_constr = len(self.fct.c_weights)
47+
xl = lb
48+
xu = ub
49+
50+
self.weights = np.array(self.fct.weights)
51+
self.c_weights = np.array(self.fct.c_weights)
52+
53+
super().__init__(n_var=n_var, n_obj=n_obj, n_constr=n_constr, xl=xl, xu=xu, type_var=np.double, **kwargs)
5654

5755
def _evaluate(self, x, out, *args, **kwargs):
5856
f, g = self.fct(x)
@@ -62,6 +60,9 @@ def _evaluate(self, x, out, *args, **kwargs):
6260
def _calc_pareto_front(self, *args, **kwargs):
6361
# allows to provide a custom pf - because of the size of files published by the author
6462
if self.pf is None:
65-
return Remote.get_instance().load("pf", "MODACT", f"{self.function}.pf")
63+
pf = Remote.get_instance().load("pf", "MODACT", f"{self.function}.pf")
64+
# pf = pf * [1, -1]
65+
pf = pf * self.weights * -1
66+
return pf
6667
else:
6768
return self.pf

pymoo/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "0.5.0.rc6"
1+
__version__ = "0.5.0.rc7"

0 commit comments

Comments
 (0)