Package expressions

Examples of expressions.FuzzyExpression


        }


        List<FuzzyLiteral> res = new ArrayList();
        for (int i = 0; i < numberOfConstraints; i++) {
            FuzzyExpression exp = getRandomExpression2(variables, pNegation, nrVariablesPerClause);
            while (exp.getVariables().size() != nrVariablesPerClause)
                exp = getRandomExpression2(variables, pNegation, nrVariablesPerClause);
            double upperbound = 1;
            double lowerbound;
            if (rand.nextDouble() < 0.5)
                lowerbound = floor(exp.eval(interpretation1));
            else
                lowerbound = floor(exp.eval(interpretation2));

            res.add(new FuzzyLiteral(lowerbound, upperbound, exp));
        }
        return res;
    }
View Full Code Here


        }


        List<FuzzyLiteral> res = new ArrayList();
        for (int i = 0; i < numberOfConstraints; i++) {
            FuzzyExpression exp = getRandomMixedExpression(variables, pNegation, pMinimum, nrVariablesPerClause);
            while (exp.getVariables().size() != nrVariablesPerClause)
                exp = getRandomMixedExpression(variables, pNegation, pMinimum, nrVariablesPerClause);
            double upperbound = 1;
            double lowerbound;
            if (rand.nextDouble() < 0.5)
                lowerbound = floor(exp.eval(interpretation1));
            else
                lowerbound = floor(exp.eval(interpretation2));

            res.add(new FuzzyLiteral(lowerbound, upperbound, exp));
        }
        return res;
    }
View Full Code Here

        for (int i = 0; i < numberOfVariables; i++)
            variables.add("v" + i);

        List<FuzzyLiteral> res = new ArrayList();
        for (int i = 0; i < numberOfConstraints; i++) {
            FuzzyExpression exp = getRandomExpression2(variables, pNegation, nrVariablesPerClause);
            while (exp.getVariables().size() != nrVariablesPerClause)
                exp = getRandomExpression2(variables, pNegation, nrVariablesPerClause);
            double value1 = rand.nextDouble();
            double value2 = rand.nextDouble();
//           double upperbound = ceil(value + rand.nextDouble()*(1-value));
//           double lowerbound = floor(rand.nextDouble()*value);
 
View Full Code Here

            if (r.getHead() instanceof GroundLiteral) {
                GroundLiteral l = (GroundLiteral) r.getHead();
                ArrayList<FuzzyExpression> args = new ArrayList<FuzzyExpression>();
                args.add(r.convertBodyExpression());
                args.add(new FuzzyConstantExpression(rho.getValue(r)));
                FuzzyExpression support = new FuzzyMultiExpression(args, r.getRuleTNorm());
                if (litMap.containsKey(l)) {
                    // Use the maximum directly in the expression associated.
                    litMap.put(l, new FuzzyBinaryExpression(litMap.get(l), support, new SM()));
                } else {
                    litMap.put(l, support);
View Full Code Here

    public void addFuzzyClause(FuzzyClause fc) {
//        System.out.println("voor = " + fc);
        ArrayList<Literal> newLiterals = new ArrayList<Literal>();
        for (Literal l : fc.getDisjuncts()) {
            FuzzyLiteral flit = (FuzzyLiteral) l;
            FuzzyExpression newExp = flit.getExpression().accept(dnegElim);
            newLiterals.add(new FuzzyLiteral(flit.getLowerBound(),
                                             flit.getUpperBound(), newExp));
        }
        FuzzyClause fcnieuw = new FuzzyClause(newLiterals);
//        System.out.println("na = " + fcnieuw);
View Full Code Here

            return res;
        }
    }

    public static void main(String[] args) {
        FuzzyExpression exp = new FuzzyBinaryExpression(new FuzzyBinaryExpression(new FuzzyVariableExpression("a"),
                                                                                  new FuzzyVariableExpression("b"), new SW()),
                                                        new FuzzyBinaryExpression(new FuzzyVariableExpression("c"),
                                                                                  new FuzzyVariableExpression("d"), new SW()),
                                                        new TW());
        FuzzyLiteral lit = new FuzzyLiteral(0.3, 0.7, exp);
View Full Code Here

    ArrayList<FuzzyClause> newClauses = new ArrayList<FuzzyClause>();
    for (FuzzyClause c : clauses) {
      ArrayList<Literal> newLiterals = new ArrayList<Literal>();
      for (Literal l : c.getDisjuncts()) {
        FuzzyLiteral flit = (FuzzyLiteral) l;
        FuzzyExpression newExp = flit.getExpression().accept(dnegElim);
        newLiterals.add(new FuzzyLiteral(flit.getLowerBound(),
            flit.getUpperBound(), newExp));
      }
      newClauses.add(new FuzzyClause(newLiterals));
    }
View Full Code Here

    ArrayList<FuzzyClause> newClauses = new ArrayList<FuzzyClause>();
    for (FuzzyClause c : clauses) {
      ArrayList<Literal> newLiterals = new ArrayList<Literal>();
      for (Literal l : c.getDisjuncts()) {
        FuzzyLiteral flit = (FuzzyLiteral) l;
        FuzzyExpression newExp = flit.getExpression().accept(dnegElim);
        newLiterals.add(new FuzzyLiteral(flit.getLowerBound(),
            flit.getUpperBound(), newExp));
      }
      newClauses.add(new FuzzyClause(newLiterals));
    }
View Full Code Here

        return new Pair(fu.getArgument1(), fu.getArgument2());
    }

    private List<DisjunctiveLinearInequality> process(FuzzyLiteral lit) {
        List<DisjunctiveLinearInequality> res = new ArrayList();
        FuzzyExpression exp = lit.getExpression().normalise();
        if (isNegation(exp)) {
            return process(new FuzzyLiteral(1 - lit.upperbound, 1 - lit.lowerbound, getUnaryArgument(exp)));
        }

        if (isMaximum(exp)) {
View Full Code Here

            }
        }
        else if (exp instanceof FuzzyBinaryExpression) {
            FuzzyBinaryExpression exp1 = (FuzzyBinaryExpression) exp;
            BinaryOperator op = exp1.getOperator();
            FuzzyExpression arg1 = exp1.getArgument1();
            FuzzyExpression arg2 = exp1.getArgument2();
            List<DisjunctiveLinearInequality> res = new ArrayList();
            if (op instanceof SM) {
                IntermediateResult ir1 = process(arg1, false);
                IntermediateResult ir2 = process(arg2, false);
                if ((ir1 instanceof VariableResult) && (ir2 instanceof ConstantResult)) {
View Full Code Here

TOP

Related Classes of expressions.FuzzyExpression

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.