Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion sb_arch_opt/algo/arch_sbo/infill.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ def _g(_):
else:
x_optimized.append(x_ref_i)

return Population.new(X=np.row_stack(x_optimized))
return Population.new(X=np.vstack(x_optimized))

@staticmethod
def get_pareto_front(f: np.ndarray) -> np.ndarray:
Expand Down
6 changes: 3 additions & 3 deletions sb_arch_opt/algo/egor_interface/algo.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,9 +217,9 @@ def _run_infills(self, n_infills: int):
x, x_failed, y = self._get_xy(pop)

# Update
self._x = np.row_stack([self._x, x])
self._y = np.row_stack([self._y, y])
self._x_failed = np.row_stack([self._x_failed, x_failed])
self._x = np.vstack([self._x, x])
self._y = np.vstack([self._y, y])
self._x_failed = np.vstack([self._x_failed, x_failed])

# Store results
if self._results_folder is not None:
Expand Down
14 changes: 7 additions & 7 deletions sb_arch_opt/algo/segomoe_interface/algo.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,9 +316,9 @@ def _dummy_f_grouped(_):
return sego.get_x(i=-1)

def _tell_infill(self, x, x_failed, y):
self._x = np.row_stack([self._x, x]) if self._x is not None else x
self._y = np.row_stack([self._y, y]) if self._y is not None else y
self._x_failed = np.row_stack([self._x_failed, x_failed]) if self._x_failed is not None else x_failed
self._x = np.vstack([self._x, x]) if self._x is not None else x
self._y = np.vstack([self._y, y]) if self._y is not None else y
self._x_failed = np.vstack([self._x_failed, x_failed]) if self._x_failed is not None else x_failed
self._save_results()

def _get_sego(self, f_grouped):
Expand Down Expand Up @@ -465,10 +465,10 @@ def get_population(self, x: np.ndarray, y: np.ndarray, x_failed: np.ndarray = No
f, g, h = self._split_y(y)

if x_failed is not None and len(x_failed) > 0:
x = np.row_stack([x, x_failed])
f = np.row_stack([f, np.zeros((x_failed.shape[0], f.shape[1]))*np.inf])
g = np.row_stack([g, np.zeros((x_failed.shape[0], g.shape[1]))*np.inf])
h = np.row_stack([h, np.zeros((x_failed.shape[0], h.shape[1]))*np.inf])
x = np.vstack([x, x_failed])
f = np.vstack([f, np.zeros((x_failed.shape[0], f.shape[1]))*np.inf])
g = np.vstack([g, np.zeros((x_failed.shape[0], g.shape[1]))*np.inf])
h = np.vstack([h, np.zeros((x_failed.shape[0], h.shape[1]))*np.inf])

kwargs = {'X': x, 'F': f, 'G': g, 'H': h}
pop = Population.new(**kwargs)
Expand Down
2 changes: 1 addition & 1 deletion sb_arch_opt/algo/tpe_interface/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ def __init__(self):
super().__init__(sampling=None)

def do(self, problem, n_samples, **kwargs):
x_init = np.row_stack([self.interface.ask_init() for _ in range(n_samples)])
x_init = np.vstack([self.interface.ask_init() for _ in range(n_samples)])
return Population.new(X=x_init)


Expand Down
4 changes: 2 additions & 2 deletions sb_arch_opt/design_space.py
Original file line number Diff line number Diff line change
Expand Up @@ -647,8 +647,8 @@ def _get_all_discrete_x_by_trial_and_imputation(self):
x_repair = x_repair[is_not_repaired, :]
is_active = is_active[is_not_repaired, :]

x_discr = np.row_stack([x_discr, x_repair])
is_act_discr = np.row_stack([is_act_discr, is_active.astype(bool)])
x_discr = np.vstack([x_discr, x_repair])
is_act_discr = np.vstack([is_act_discr, is_active.astype(bool)])

# Impute continuous values
self.impute_x(x_discr, is_act_discr)
Expand Down
4 changes: 2 additions & 2 deletions sb_arch_opt/pareto_front.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,9 @@ def _calc_pareto_set_front(self, *_, pop_size=None, n_gen_min=10, n_repeat=4, n_
ps = res.X
pf = res.F
else:
pf_merged = np.row_stack([pf, res.F])
pf_merged = np.vstack([pf, res.F])
i_non_dom = NonDominatedSorting().do(pf_merged, only_non_dominated_front=True)
ps = np.row_stack([ps, res.X])[i_non_dom, :]
ps = np.vstack([ps, res.X])[i_non_dom, :]
pf = pf_merged[i_non_dom, :]

# Reduce size of Pareto front to a predetermined amount to ease Pareto-front-related calculations
Expand Down
6 changes: 3 additions & 3 deletions sb_arch_opt/problems/gnc.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,8 @@ def _gen_all_discrete_x(self) -> Optional[Tuple[np.ndarray, np.ndarray]]:
x_rows.append(x_combs)
is_active_rows.append(is_act_combs)

x_all = np.row_stack(x_rows)
is_active_all = np.row_stack(is_active_rows)
x_all = np.vstack(x_rows)
is_active_all = np.vstack(is_active_rows)
return x_all, is_active_all

def _get_discrete_x_combs_type(self, x_base, j, n_objs):
Expand Down Expand Up @@ -234,7 +234,7 @@ def _iter_conns(n_src_, n_tgt_):
n_combinations += 1

if return_conns:
n_combinations = np.row_stack(n_combinations)
n_combinations = np.vstack(n_combinations)
n_comb_conn[n_src, n_tgt] = n_comb_conn[n_tgt, n_src] = n_combinations

if return_conns:
Expand Down
2 changes: 1 addition & 1 deletion sb_arch_opt/problems/rocket.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ def _gen_all_discrete_x(self) -> Optional[Tuple[np.ndarray, np.ndarray]]:
x_stage[:, 1:1+x_engines.shape[1]] = x_engines
x_stages.append(x_stage)

x_stages = np.row_stack(x_stages)
x_stages = np.vstack(x_stages)
x_all = np.repeat(x_stages, 3, axis=0)
x_all[:, [11]] = np.tile(np.array([np.arange(3)]).T, (x_stages.shape[0], 1)) # Head shape

Expand Down
14 changes: 7 additions & 7 deletions sb_arch_opt/sampling.py
Original file line number Diff line number Diff line change
Expand Up @@ -339,8 +339,8 @@ def _choice(n_choose, n_from, replace=True):
is_active.append(is_act_all[x_all_choose, :])
i_x_sampled[x_all_choose] = True

x = np.row_stack(x)
is_active = np.row_stack(is_active)
x = np.vstack(x)
is_active = np.vstack(is_active)

# Uniformly add discrete vectors if there are not enough (can happen if some groups are very small and there
# are no continuous dimensions)
Expand All @@ -354,8 +354,8 @@ def _choice(n_choose, n_from, replace=True):
else:
i_from_group = np.arange(x_available.shape[0])

x = np.row_stack([x, x_available[i_from_group, :]])
is_active = np.row_stack([is_active, is_act_available[i_from_group, :]])
x = np.vstack([x, x_available[i_from_group, :]])
is_active = np.vstack([is_active, is_act_available[i_from_group, :]])

return x, is_active

Expand Down Expand Up @@ -489,7 +489,7 @@ def _choice(n_choose, n_from, replace=True):
i_opt_sampled = _choice(n_add, len(opt_values[i_dv]))
x_add[:, i_dv] = opt_values[i_dv][i_opt_sampled]

x = x_add if x is None else np.row_stack([x, x_add])
x = x_add if x is None else np.vstack([x, x_add])

# Correct and remove duplicates
x, is_active = self._correct(problem, repair, x)
Expand All @@ -509,8 +509,8 @@ def _choice(n_choose, n_from, replace=True):
if x.shape[0] < n_samples and has_x_cont:
n_add = n_samples-x.shape[0]
i_select_dup = _choice(n_add, x.shape[0])
x = np.row_stack(x, x[i_select_dup, :])
is_active = np.row_stack(is_active, is_active[i_select_dup, :])
x = np.vstack(x, x[i_select_dup, :])
is_active = np.vstack(is_active, is_active[i_select_dup, :])

return x, is_active

Expand Down
Loading