src/main/java/org/thegalactic/rule/ImplicationalSystem.java
public int makeDirect() {
        this.makeUnary();
        this.makeProper();
        int s = this.sizeRules();
        boolean ok = true;
        while (ok) {
            ImplicationalSystem save = new ImplicationalSystem(this);
            for (Rule rule1 : save.sigma) {
                for (Rule rule2 : save.sigma) {
                    if (!rule1.equals(rule2) && !rule1.getPremise().containsAll(rule2.getConclusion())) {
                        ComparableSet c = new ComparableSet(rule2.getPremise());
                        c.removeAll(rule1.getConclusion());
                        c.addAll(rule1.getPremise());
                        if (!c.containsAll(rule2.getPremise())) {
                            Rule newR = new Rule(c, rule2.getConclusion());
                            // new_rule.addAllToPremise (rule1.getPremise());
                            // new_rule.addAllToPremise (rule2.getPremise());
                            // new_rule.removeAllFromPremise(rule1.getConclusion());
                            // new_rule.addAllToConclusion(rule2.getConclusion() );
                            this.addRule(newR);
                        }
                    }
                }
            }
            if (this.sizeRules() == save.sizeRules()) {
                ok = false;
            }
        }
        this.makeCompact();
        return s - this.sizeRules();
    }
/**
     * Makes this component a compact and direct ImplicationalSystem.
     *
     * The unary and proper form of this componant is first computed. For two
     * given rules rule1 and rule2, if the conclusion of rule1 contains the
     * premise of rule1, then a new rule is addes, with rule1.premisse +
     * rule2.premisse - rule1.conclusion as premise, and rule2.conclusion as
     * conlusion. This treatment is performed in a recursive way until no new
     * rule is added.
     *
     * This treatment is performed in O(d|S|), where d corresponds to the number
     * of rules that have to be added by the direct treatment, that can be
     * exponential in the worst case.
     *
     * @return the difference between the number of rules of this component
     *         before and after this treatment
     */
Makes this component a compact and direct ImplicationalSystem.
The unary and proper form of this componant is first computed. For two
given rules rule1 and rule2, if the conclusion of rule1 contains the
premise of rule1, then a new rule is addes, with rule1.premisse +
rule2.premisse - rule1.conclusion as premise, and rule2.conclusion as
conlusion. This treatment is performed in a recursive way until no new
rule is added.

This treatment is performed in O(d|S|), where d corresponds to the number
of rules that have to be added by the direct treatment, that can be
exponential in the worst case.

@return the difference between the number of rules of this component
before and after this treatment
Makes this component a compact and direct ImplicationalSystem . The unary and proper form of this componant is first computed . For two given rules rule1 and rule2 if the conclusion of rule1 contains the premise of rule1 then a new rule is addes with rule1 . premisse + rule2 . premisse - rule1 . conclusion as premise and rule2 . conclusion as conlusion . This treatment is performed in a recursive way until no new rule is added . This treatment is performed in O ( d|S| ) where d corresponds to the number of rules that have to be added by the direct treatment that can be exponential in the worst case . @return the difference between the number of rules of this component before and after this treatment
public int makeDirect() {
        this.makeUnary();
        this.makeProper();
        int s = this.sizeRules();
        boolean ok = true;
        while (ok) {
            ImplicationalSystem save = new ImplicationalSystem(this);
            for (Rule rule1 : save.sigma) {
                for (Rule rule2 : save.sigma) {
                    if (!rule1.equals(rule2) && !rule1.getPremise().containsAll(rule2.getConclusion())) {
                        ComparableSet c = new ComparableSet(rule2.getPremise());
                        c.removeAll(rule1.getConclusion());
                        c.addAll(rule1.getPremise());
                        if (!c.containsAll(rule2.getPremise())) {
                            Rule newR = new Rule(c, rule2.getConclusion());
                            this.addRule(newR);
                        }
                    }
                }
            }
            if (this.sizeRules() == save.sizeRules()) {
                ok = false;
            }
        }
        this.makeCompact();
        return s - this.sizeRules();
    }
public int makeDirect ( ) { this . makeUnary ( ) ; this . makeProper ( ) ; int s = this . sizeRules ( ) ; boolean ok = true ; while ( ok ) { ImplicationalSystem save = new ImplicationalSystem ( this ) ; for ( Rule rule1 : save . sigma ) { for ( Rule rule2 : save . sigma ) { if ( ! rule1 . equals ( rule2 ) && ! rule1 . getPremise ( ) . containsAll ( rule2 . getConclusion ( ) ) ) { ComparableSet c = new ComparableSet ( rule2 . getPremise ( ) ) ; c . removeAll ( rule1 . getConclusion ( ) ) ; c . addAll ( rule1 . getPremise ( ) ) ; if ( ! c . containsAll ( rule2 . getPremise ( ) ) ) { Rule newR = new Rule ( c , rule2 . getConclusion ( ) ) ; this . addRule ( newR ) ; } } } } if ( this . sizeRules ( ) == save . sizeRules ( ) ) { ok = false ; } } this . makeCompact ( ) ; return s - this . sizeRules ( ) ; }
Makes this component a compact and direct ImplicationalSystem.
Makes this component a compact and direct ImplicationalSystem .
// new_rule.addAllToPremise (rule1.getPremise()); // new_rule.addAllToPremise (rule2.getPremise()); // new_rule.removeAllFromPremise(rule1.getConclusion()); // new_rule.addAllToConclusion(rule2.getConclusion() );