import numpy as np
from src.datasets.breast_cancer import BreastCancerDataset
from src.datasets.digits import DigitsDataset
from src.models.branin import Branin
from src.models.ac_branin import ACBranin
from src.datasets.ac_branin import ACBraninDataset
from src.models.himmelblau import HimmelblauModel
from src.models.mlp import MLPModel
from src.models.svm import SVMModel
from src.tasks.task import Task

TASKS = [
    ###### Branin ########
    Task(
        name="Branin (Blackbox)",
        model=Branin(),
        deterministic=True,
        objectives=["regret"],
        optimization_type="bb",
        n_trials=200,
        walltime_limit=60,
        max_config_calls=1,
    ),
    Task(
        name="Branin (HPO)",
        model=Branin(),
        deterministic=True,
        objectives=["regret"],
        optimization_type="hpo",
        n_trials=200,
        walltime_limit=60,
        max_config_calls=1,
    ),
    Task(
        name="Branin (HPO, 8 workers)",
        model=Branin(),
        deterministic=True,
        objectives=["regret"],
        optimization_type="hpo",
        n_trials=200,
        walltime_limit=60,
        max_config_calls=1,
        n_workers=8,
    ),
    Task(
        name="Branin (AC)",
        model=ACBranin(ACBraninDataset()),
        deterministic=True,
        objectives=["regret"],
        optimization_type="ac",
        n_trials=300,
        walltime_limit=1720,
        max_config_calls=10000,
        use_instances=True,
    ),
    ######## Himmelblau ########
    Task(
        name="Himmelblau (Blackbox)",
        model=HimmelblauModel(),
        deterministic=True,
        objectives=["cost"],
        optimization_type="bb",
        n_trials=300,
        walltime_limit=60,
        max_config_calls=1,
    ),
    Task(
        name="Himmelblau (HPO)",
        model=HimmelblauModel(),
        deterministic=True,
        objectives=["cost"],
        optimization_type="hpo",
        n_trials=300,
        walltime_limit=60,
        max_config_calls=1,
    ),
    Task(
        name="Himmelblau (HPO, 8 workers)",
        model=HimmelblauModel(),
        deterministic=True,
        objectives=["cost"],
        optimization_type="hpo",
        n_trials=300,
        walltime_limit=60,
        max_config_calls=1,
        n_workers=8,
    ),
    ######## SVM-Digits (HB) ########
    Task(
        name="SVM-Digits",
        model=SVMModel(DigitsDataset()),
        deterministic=False,
        objectives=["1-accuracy"],
        optimization_type="hpo",
        n_trials=500,
        walltime_limit=np.inf,
        use_instances=True,
        max_config_calls=50,
    ),
    Task(
        name="SVM-Digits (HB)",
        model=SVMModel(DigitsDataset()),
        deterministic=False,
        objectives=["1-accuracy"],
        optimization_type="mf",
        n_trials=500,
        walltime_limit=np.inf,
        use_instances=True,
        min_budget=10,
        max_budget=50,
        incumbent_selection="highest_observed_budget",
        n_seeds=2,
    ),
    Task(
        name="SVM-Digits (HB, 8 workers)",
        model=SVMModel(DigitsDataset()),
        deterministic=False,
        objectives=["1-accuracy"],
        optimization_type="mf",
        n_trials=500,
        walltime_limit=np.inf,
        use_instances=True,
        min_budget=10,
        max_budget=50,
        incumbent_selection="highest_observed_budget",
        n_seeds=2,
        n_workers=8,
    ),
    ######## BreastCancer (HB) ########
    Task(
        name="MLP-BreastCancer (HB)",
        model=MLPModel(BreastCancerDataset()),
        deterministic=False,
        objectives=["1-accuracy"],
        optimization_type="mf",
        min_budget=1,
        max_budget=25,
        n_trials=1500,
        walltime_limit=480,
        n_seeds=1,
        incumbent_selection="highest_budget",
    ),
    Task(
        name="MLP-BreastCancer (HB, 8 workers)",
        model=MLPModel(BreastCancerDataset()),
        deterministic=False,
        objectives=["1-accuracy"],
        optimization_type="mf",
        min_budget=1,
        max_budget=25,
        n_trials=1500,
        walltime_limit=480,
        n_seeds=1,
        incumbent_selection="highest_budget",
        n_workers=8,
    ),
    ######## BreastCancer (SH) ########
    Task(
        name="MLP-BreastCancer (SH)",
        model=MLPModel(BreastCancerDataset()),
        deterministic=False,
        objectives=["1-accuracy"],
        optimization_type="mf",
        min_budget=1,
        max_budget=25,
        n_trials=1500,
        walltime_limit=480,
        n_seeds=1,
        incumbent_selection="highest_budget",
        intensifier="successive_halving",
    ),
    Task(
        name="MLP-BreastCancer (SH, 8 workers)",
        model=MLPModel(BreastCancerDataset()),
        deterministic=False,
        objectives=["1-accuracy"],
        optimization_type="mf",
        min_budget=1,
        max_budget=25,
        n_trials=1500,
        walltime_limit=480,
        n_seeds=1,
        incumbent_selection="highest_budget",
        intensifier="successive_halving",
        n_workers=8,
    ),
]
