'The top-level control procedure of the separate-and-conquer
algorithm. For given data and target class (may be None), return
a list of rules which all must strictly adhere to the
requirements of rule finder\'s validators.
To induce decision lists (ordered rules), set target class to
None. To induce rule sets (unordered rules), learn rules for
each class individually, in regard to the original learning
data.
Parameters
X, Y, W : ndarray
Learning data.
target_class : int
Index of the class to model.
base_rules : list of Rule
An optional list of initial rules to constrain the search.
domain : Orange.data.domain.Domain
Data domain, used to calculate class distributions.
progress_amount: int, percentage
Part of the learning algorithm covered by this function
call.
Returns
rule_list : list of Rule
Induced rules.'

def find_rules_and_measure_progress(self, X, Y, W, target_class, base_rules, domain, progress_amount):

    initial_class_dist = get_dist(Y, W, domain)
    rule_list = []
    while (not self.data_stopping(X, Y, W, target_class)):
        temp_class_dist = get_dist(Y, W, domain)
        new_rule = self.rule_finder(X, Y, W, target_class, base_rules, domain, initial_class_dist, rule_list)
        if ((new_rule is None) or self.rule_stopping(new_rule)):
            break
        (X, Y, W) = self.cover_and_remove(X, Y, W, new_rule)
        rule_list.append(new_rule)
        if (self.progress_advance_callback is not None):
            progress = ((((temp_class_dist[target_class] - get_dist(Y, W, domain)[target_class]) / initial_class_dist[target_class]) * progress_amount) if (target_class is not None) else (((temp_class_dist - get_dist(Y, W, domain)).sum() / initial_class_dist.sum()) * progress_amount))
            self.progress_advance_callback(progress)
    return rule_list
