-
Notifications
You must be signed in to change notification settings - Fork 3
The Problem Class
Henri Lotze edited this page Mar 21, 2021
·
1 revision
The problem code is the simplest to implement when creating a new task.
Its class requires setting five attributes:
- The
problem.name, that is used by__str__and should contain the full name of the problem (without the word 'problem'). - The
problem.n_startvalue, which encodes at which minimum instance size the problem can be called. - The
problem.parser, which is usually set to a parser object of the problem. - The
problem.verifier, which is usually set to a verifier object of the problem. - The
problem.approximableflag, which states if the problem can be approximated (or whether a solution is only correct or incorrect).
A sample implementation of the problem.py of the biclique problem is the following:
import logging
from algobattle.problem import Problem
from .parser import BicliqueParser
from .verifier import BicliqueVerifier
logger = logging.getLogger('algobattle.biclique')
class Biclique(Problem):
name = 'Bipartite Clique'
n_start = 5
parser = BicliqueParser()
verifier = BicliqueVerifier()
approximable = True