Skip to content

Commit

Permalink
Fix optimizations GUI (whatsopt#189)
Browse files Browse the repository at this point in the history
* Increase number of optimization per user

* Fix optimizations page initialization

* Remove n_start option from MOO

* Improve traces
  • Loading branch information
relf authored Oct 26, 2023
1 parent ee55e2d commit 4cc7ade
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 7 deletions.
2 changes: 1 addition & 1 deletion app/models/optimization.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class OptimizationError < Exception; end
RUNNING = 4
OPTIMIZER_STATUS = [VALID_POINT, INVALID_POINT, RUNTIME_ERROR, SOLUTION_REACHED, RUNNING, PENDING, OPTIMIZATION_ERROR, UNKNOWN_STATUS]

MAX_OPTIM_NUMBER = 50
MAX_OPTIM_NUMBER = 500

store :config, accessors: [:xtypes, :xlimits, :n_obj, :cstr_specs, :options], coder: JSON
store :inputs, accessors: [:x, :y, :with_best], coder: JSON
Expand Down
3 changes: 1 addition & 2 deletions app/views/optimizations/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@


<% content_for :document_ready do %>
let view = new App.OptimizationsIndex();
view.start();
App.OptimizationsIndex.start();
<% end %>
<% end %>

Expand Down
5 changes: 3 additions & 2 deletions services/whatsopt_server/optimizer_store/optimizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,9 @@ def tell(self, x, y):
print(y)
nobj = self.n_obj
ncstrs = len(self.constraints)
print(y.shape)
print(nobj, ncstrs)
print(f"Y shape = {y.shape}")
print(f"n_obj={nobj}")
print(f"n_cstrs={ncstrs}")
if y.shape[1] != (nobj + ncstrs):
raise ValueError(
"Size mismatch: y should be {}-size ({} objectives + {} constraints), got {}".format(
Expand Down
10 changes: 8 additions & 2 deletions services/whatsopt_server/optimizer_store/segmoomoe_optimizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,14 @@

class SegmoomoeOptimizer(Optimizer):
def __init__(
self, xtypes, xlimits, n_obj, cstr_specs=[], mod_obj_options={}, options={}, logfile=None
self,
xtypes,
xlimits,
n_obj,
cstr_specs=[],
mod_obj_options={},
options={},
logfile=None,
):
super().__init__(xlimits, n_obj, cstr_specs, mod_obj_options, options, logfile)
self.xtypes = xtypes
Expand Down Expand Up @@ -64,7 +71,6 @@ def fun(x):
default_models = {"obj": mod_obj, "con": mod_con}

optim_settings = {
"n_start": 10,
"criterion": "PI",
"n_iter": 1,
"pop_size": 30,
Expand Down

0 comments on commit 4cc7ade

Please sign in to comment.