Source code for ccvm_simulators.ccvmplotlib.problem_metadata.problem_metadata
from abc import ABC, abstractmethod
import pandas as pd
from enum import Enum
[docs]
class TTSType(Enum):
"""Time-To-Solution Type ENUM class.
Either a CPU time (physical) or an optic device time (wallclock).
"""
wallclock = "wallclock"
physical = "physical"
[docs]
class ProblemMetadata(ABC):
"""Abstract class for the problem metadata."""
def __init__(self, problem: ProblemType) -> None:
"""Problem Metadata abstract class object constructor.
The constructor defines and holds common variables for different
problems solved with CCVM solvers.
Args:
problem (ProblemType): A problem type.
"""
self.__problem = problem
@property
def problem(self) -> ProblemType:
"""Problem type getter method.
Returns:
ProblemType: Problem Type.
"""
return self.__problem
[docs]
@abstractmethod
def ingest_metadata(self) -> None:
"""Take a file path to metadata and convert them into a
pandas.DataFrame."""
[docs]
@abstractmethod
def generate_plot_data(self) -> pd.DataFrame:
"""Generate data for plotting.
Plotting data will be varied by a different problem. Thus, for different
problems, plotting data preparation code needs to be implemented in its
inherited proble-specific metadata object.
Returns:
pd.DataFrame: A new data for plotting.
"""
pass
[docs]
@abstractmethod
def generate_success_prob_plot_data(self) -> pd.DataFrame:
"""_summary_
Returns:
pd.DataFrame: _description_
"""
pass