Package expressions

Examples of expressions.FuzzyExpression


      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


        if (maxDepth <= 0)
            p = pBinary + pUnary + (pVar + pConst) * rand.nextDouble();
        else
            p = rand.nextDouble();
        if (p < pBinary) {
            FuzzyExpression arg1 = getRandomExpression(variables, pBinary, pUnary, pVar, pConst, maxDepth - 1);
            FuzzyExpression arg2 = getRandomExpression(variables, pBinary, pUnary, pVar, pConst, maxDepth - 1);
            double p2 = rand.nextDouble();
            if (p2 < 0.33)
                return new FuzzyBinaryExpression(arg1, arg2, new TW());
            else if (p2 < 0.66)
                return new FuzzyBinaryExpression(arg1, arg2, new IW());
            else
                return new FuzzyBinaryExpression(arg1, arg2, new SW());
        }
        else if (p < pBinary + pUnary) {
            FuzzyExpression arg1 = getRandomExpression(variables, pBinary, pUnary, pVar, pConst, maxDepth - 1);
            return new FuzzyUnaryExpression(arg1, new N());
        }
        else if (p < pBinary + pUnary + pVar)
            return new FuzzyVariableExpression(variables.get(rand.nextInt(variables.size())));
        else {
View Full Code Here

            return new FuzzyVariableExpression(variables.get(rand.nextInt(variables.size())));
        }
        else {
            int nr1 = 1 + rand.nextInt(nrVariables - 1);
            int nr2 = nrVariables - nr1;
            FuzzyExpression arg1 = getRandomExpression2(variables, pNegation, nr1, false);
            FuzzyExpression arg2 = getRandomExpression2(variables, pNegation, nr2, false);
//            double p2 = rand.nextDouble();
//            if (p2 < 0.33)
            return new FuzzyBinaryExpression(arg1, arg2, new TW());
//            else if (p2 < 0.66)
//                return new FuzzyBinaryExpression(arg1, arg2, new IW());
View Full Code Here

            return new FuzzyVariableExpression(variables.get(rand.nextInt(variables.size())));
        }
        else {
            int nr1 = 1 + rand.nextInt(nrVariables - 1);
            int nr2 = nrVariables - nr1;
            FuzzyExpression arg1 = getRandomMixedExpression(variables, pNegation, pMinimum, nr1, false);
            FuzzyExpression arg2 = getRandomMixedExpression(variables, pNegation, pMinimum, nr2, false);
            double p2 = rand.nextDouble();
            if (p2 < pMinimum)
                return new FuzzyBinaryExpression(arg1, arg2, new TM());
            else
                return new FuzzyBinaryExpression(arg1, arg2, new TW());
View Full Code Here

            String line = in.readLine();
            while (line != null && !line.equals("")) {
                String[] s = line.split(";");
                double lowerbound = Double.parseDouble(s[0]);
                double upperbound = Double.parseDouble(s[1]);
                FuzzyExpression exp = parseExpression(s[2]);
                l.add(new FuzzyClause(new FuzzyLiteral(lowerbound, upperbound, exp)));
                line = in.readLine();
            }
            in.close();
            return l;
View Full Code Here

            variables.add("v" + i);
        }

        List<FuzzyLiteral> res = new ArrayList();
        for (int i = 0; i < numberOfConstraints; i++) {
            FuzzyExpression exp = getRandomExpression(variables, pBinary, pUnary, pVar, pConst, maxDepth);
            double value = exp.eval(interpretation);
//           double upperbound = ceil(value + rand.nextDouble()*(1-value));
//           double lowerbound = floor(rand.nextDouble()*value);
            double upperbound = ceil(value);
            double lowerbound = floor(value);
            res.add(new FuzzyLiteral(lowerbound, upperbound, exp));
View Full Code Here

            variables.add("v" + i);
        }

        List<FuzzyLiteral> res = new ArrayList();
        for (int i = 0; i < numberOfConstraints; i++) {
            FuzzyExpression exp = getRandomExpression2(variables, pNegation, nrVariablesPerClause);
           //PAT: door onderstaande twee lijnen in commentaar te zetten krijgen we
            //ook meerdere voorkomens van een var in 1 clause.
            // while (exp.getVariables().size() != nrVariablesPerClause)
           //     exp = getRandomExpression2(variables, pNegation, nrVariablesPerClause);
            double value = exp.eval(interpretation);
//           double upperbound = ceil(value + rand.nextDouble()*(1-value));
//           double lowerbound = floor(rand.nextDouble()*value);
            double upperbound;
            double lowerbound;
            if (rand.nextDouble() < 0.5) {
View Full Code Here

            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);
            //PAT: door de twee bovenstaande lijnen in commentaar te zetten, krijg je ook clauses waar een bepaalde var meer dan 1 keer kan voorkomen
            double value = exp.eval(interpretation);
//           double upperbound = ceil(value + rand.nextDouble()*(1-value));
//           double lowerbound = floor(rand.nextDouble()*value);
            double upperbound;
            double lowerbound;
            upperbound = ceil(value);
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 value = rand.nextDouble();
            double upperbound = 1;
            double lowerbound = ceil(value);
View Full Code Here

            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 upperbound = 1;
            double lowerbound = 0;
            if (i < nrSatisfiableConstraints)
                lowerbound = floor(exp.eval(interpretation));
            else
                lowerbound = ceil(rand.nextDouble());
            res.add(new FuzzyLiteral(lowerbound, upperbound, exp));
        }
        return res;
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.