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
1 change: 1 addition & 0 deletions simopt/GUI.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ def main() -> None:
root = GUIMaster()
root.title("SimOpt Library Graphical User Interface")
root.pack_propagate(False)
root.tk.call("tk", "scaling", 1.0)

# Parse command line
log_level = logging.INFO
Expand Down
22 changes: 16 additions & 6 deletions simopt/experiment_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,12 +202,22 @@ def create_design_list_from_table(design_table: DataFrame) -> list[dict[str, Any
# Creates dictonary of table to convert values to proper datatypes.
dp_dict = design_table.to_dict(orient="list")

# NOTE: the str cast for the factor name shouldn't be necessary, but it tells the
# typing system that the dict keys are definitely strings and not just hashable.
return [
{str(factor): literal_eval(str(dp_dict[factor][dp])) for factor in dp_dict}
for dp in range(len(design_table))
]
# TODO: this is a hack to get the data type of the factors back.
design_list = []
for dp in range(len(design_table)):
config = {}
for factor in dp_dict:
key = str(factor)
raw_value = str(dp_dict[factor][dp])
try:
value = literal_eval(raw_value)
except ValueError:
# This exception handles the case where the value is a string.
value = raw_value
config[key] = value
design_list.append(config)

return design_list


def create_design(
Expand Down
2 changes: 1 addition & 1 deletion simopt/gui/main_menu.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from simopt.gui.new_experiment_window import NewExperimentWindow
from simopt.gui.toplevel_custom import Toplevel

FONT_SCALE: Final[float] = 1.5
FONT_SCALE: Final[float] = 1


class MainMenuWindow(Toplevel):
Expand Down
9 changes: 8 additions & 1 deletion simopt/gui/new_experiment_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -1647,6 +1647,13 @@ def __show_data_farming_core(
for factor in model_specifications:
specifications[factor] = model_specifications[factor]
# Convert the specifications to a dictionary of DFFactor objects

# TODO: This is a hack to remove the step_type and search_direction factors
# because str type is not currently supported in the GUI.
if isinstance(base_object, Solver) and base_object.class_name_abbr == "FCSA":
del specifications["step_type"]
del specifications["search_direction"]

self.factor_dict = spec_dict_to_df_dict(specifications)

# Add all the column headers
Expand Down Expand Up @@ -2355,7 +2362,7 @@ def __log_results_gui(self, experiment_name: str) -> None:
self.__update_experiment_label(experiment_name, "Logging")
# Try to log the experiment
try:
self.post_normalize(experiment_name)
self.log_results(experiment_name)
# If successful, update the label and button
self.__update_experiment_label(experiment_name, "Logged")
self.__update_action_button(experiment_name, "All Steps\nComplete")
Expand Down
10 changes: 7 additions & 3 deletions simopt/solvers/fcsa.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
D. J. Eckman, S. G. Henderson, and S. Shashaani
"""

from typing import Annotated, ClassVar, Literal
from typing import Annotated, ClassVar

import cvxpy as cp
import numpy as np
Expand Down Expand Up @@ -44,7 +44,9 @@ class FCSAConfig(SolverConfig):
),
]
step_type: Annotated[
Literal["const", "decay"],
# TODO: change back when the old GUI is removed
# Literal["const", "decay"],
str,
Field(default="const", description="constant or decaying step size?"),
]
step_mult: Annotated[
Expand All @@ -60,7 +62,9 @@ class FCSAConfig(SolverConfig):
Field(default=0.01, ge=0, description="tolerance function"),
]
search_direction: Annotated[
Literal["FCSA", "CSA-N", "CSA"],
# TODO: change back when the old GUI is removed
# Literal["FCSA", "CSA-N", "CSA"],
str,
Field(
default="FCSA",
description=(
Expand Down