ml4co_kit.wrapper.base

Base class for all wrappers in the ML4CO kit.

Classes

WrapperBase(task_type, precision)

class ml4co_kit.wrapper.base.WrapperBase(task_type: ~ml4co_kit.task.base.TASK_TYPE, precision: ~numpy.float32 | ~numpy.float64 = <class 'numpy.float32'>)[source]

Bases: object

evaluate(check_constr: bool = True) float[source]

Evaluate the task list.

evaluate_w_gap(check_constr: bool = True) Sequence[float][source]

Evaluate the task list.

from_pickle(file_path: Path)[source]
from_task_pickle_folder(task_class: Type[TaskBase], folder_path: Path)[source]
from_txt(file_path: Path, *args, **kwargs)[source]
generate(generator: GeneratorBase, solver: SolverBase, num_samples: int = 1280, num_threads: int = 1, batch_size: int = 1, optimizer_parallel: bool = False, show_time: bool = True)[source]
generate_w_to_txt(file_path: Path, generator: GeneratorBase, solver: SolverBase, num_samples: int = 1280, num_threads: int = 1, batch_size: int = 1, write_per_iters: int = 1, write_mode: str = 'a', show_time: bool = True)[source]
solve(solver: SolverBase, num_threads: int = 1, batch_size: int = 1, optimizer_parallel: bool = False, show_time: bool = False)[source]
swap_sol_and_ref_sol()[source]
to_pickle(file_path: Path)[source]
to_task_pickle_folder(folder_path: Path)[source]
to_txt(show_time: bool = False, mode: str = 'w')[source]