Package com.hpctoday.fada

Examples of com.hpctoday.fada.Quast


      // RemoveNegativeVariablesPIPLimitation(GetVariables(),GetParameters(),&new_constraints);
      Solver s = SolverFactory.createSolver();
      s.set(GetIndex(), GetDeep(), GetVariables(), GetParameters(), new_constraints, true);
      // cout<<"\n======================================================\n";
      // s.Print();
      Quast result = s.Max();
      // cout<<"\n NB variables .... ="<<nb_variables;
      // result.Print("\n");
      // cout<<"\n======================================================\n";
      result.DropAddedVariables(nb_variables);
      return result;
    }
  }
View Full Code Here


  // public static Quast FromPIPQuast(int __index, List<String> variables, PipQuast __quast); 
  // ! \brief Import a quast from a pip datastructure
  private Quast FromPipQuast(int __index, int __deep, List<String> __counters, List<String> __params, PipSolution<N> solution,
      Map<Integer, Expression> new_param) {
    if(!solution.hasSolution()){
      return new Quast();
    }
   
    Map<Integer, Expression> __new_param = new HashMap<Integer, Expression>(new_param);
    List<NewParameter<N>> parameters = solution.getParameters();
    for(NewParameter<N> parm: parameters){
      int new_rank = parm.getIndex();
     
      RationalVector<N> vector = parm.getParameters();
      RationalNumber<N> gcd = vector.gcd().inverse();
      vector = vector.multiply(gcd);
     
      Expression num = PipVectorToExpression(vector, __params, __new_param);
     
      //Build denominator
      Expression newparm_def;
      if(gcd.isInteger()){
        int value = (int)gcd.value();
        Expression deno = new Expression(value);
        newparm_def = new Expression(num, Expression.Operation.FADA_DIV, deno);
      } else {
        int n = (int)gcd.getNumerator().value();
        int d = (int)gcd.getDenominator().value();
        Expression exp1 = new Expression(new Expression(d), Expression.Operation.FADA_MUL, num);
        newparm_def = new Expression(exp1, Expression.Operation.FADA_DIV, new Expression(n));
      }
     

      __new_param.put(new_rank, newparm_def);
    }
   
    SubSolution<N> sSolution = solution.getSolution();
    // conditional node
    if(sSolution instanceof PipQuast){
      PipQuast<N> __quast = (PipQuast<N>)sSolution;
      Expression ineq = PipVectorToExpression(__quast.getCondition(), __params, __new_param);
      Condition __cond = new Condition(new Inequation(ineq.GetLeftChild(), Inequation.Predicate.FADA_GREATER_EQ, ineq.GetRightChild()));
      log.trace("Cond: " + __cond);
      return new Quast(__cond,
          FromPipQuast(__index, __deep, __counters, __params, __quast.getThen(), __new_param),
          FromPipQuast(__index, __deep, __counters, __params, __quast.getElse(), __new_param));
    } else if(sSolution instanceof PipList){ // leaf
      PipList<N> list = (PipList<N>)sSolution;
      return new Quast(__index, __deep, __counters, PipListToIndex(list, __counters.size(), __params, __new_param));
    } else {
      return new Quast();
    }
  }
View Full Code Here

TOP

Related Classes of com.hpctoday.fada.Quast

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.