Skip to content
Merged
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
14 changes: 10 additions & 4 deletions pycona/find_scope/findscope2.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,28 @@
from ..ca_environment.active_ca import ActiveCAEnv
from ..ca_environment.acive_ca_proba import ProbaActiveCAEnv
from .findscope_core import FindScopeBase
from ..utils import get_kappa, get_con_subset

from ..find_scope.findscope_obj import split_proba, split_half

class FindScope2(FindScopeBase):
"""
This is the version of the FindScope function that was presented in
Bessiere, Christian, et al., "Learning constraints through partial queries", AIJ 2023
"""

def __init__(self, ca_env: ActiveCAEnv = None, time_limit=0.2):
def __init__(self, ca_env: ActiveCAEnv = None, split_func=None, time_limit=0.2):
"""
Initialize the FindScope2 class.

:param ca_env: The constraint acquisition environment.
:param time_limit: The time limit for findscope query generation.
:param split_func: The function used to split the variables in findscope.
"""
super().__init__(ca_env, time_limit)

if split_func is None:
split_func = split_proba if isinstance(ca_env, ProbaActiveCAEnv) else split_half

super().__init__(ca_env, time_limit, split_func=split_func)
self._kappaB = []

def run(self, Y, kappa=None):
Expand Down Expand Up @@ -72,7 +78,7 @@ def _find_scope(self, R, Y):

# Create Y1, Y2 -------------------------
proba = self.ca.bias_proba if hasattr(self.ca, 'bias_proba') else []
Y1, Y2 = self.split_func(Y=Y, R=R, kappaB=kappaBRY, proba=proba)
Y1, Y2 = self.split_func(Y=Y, R=R, kappaB=kappaBRY, P_c=proba)

S1 = set()
S2 = set()
Expand Down