Examples of Linear


Examples of javax.constraints.impl.constraint.Linear

  // These two methods are needed for GoalAssignValue only
  public Constraint constraintVarEqValue(Var var,int value) {
    return new Linear(var,"=",value);
  }
  public Constraint constraintVarNeqValue(Var var,int value) {
    return new Linear(var,"!=",value);
  }
View Full Code Here

Examples of javax.constraints.impl.constraint.Linear

      min += vars[i].getMin()*values[i];
      max += vars[i].getMax()*values[i];
    }
    AbstractProblem p = (AbstractProblem) vars[0].getProblem();
    Var scalProdVar = new javax.constraints.impl.Var(p, "scalProd", min, max);
    new Linear(values,vars, "=", scalProdVar).post();
    return scalProdVar;
  }
View Full Code Here

Examples of libshapedraw.animation.trident.ease.Linear

        this.stateStack = new Stack<TimelineState>();
        this.stateStack.push(TimelineState.IDLE);
        this.doneCount = 0;

        this.ease = new Linear();
    }
View Full Code Here

Examples of libshapedraw.animation.trident.ease.Linear

     * Creates a new instance of KeyInterpolators
     */
    KeyInterpolators(int numIntervals, TimelineEase... interpolators) {
        if (interpolators == null || interpolators[0] == null) {
            for (int i = 0; i < numIntervals; ++i) {
                this.interpolators.add(new Linear());
            }
        } else if (interpolators.length < numIntervals) {
            for (int i = 0; i < numIntervals; ++i) {
                this.interpolators.add(interpolators[0]);
            }
View Full Code Here

Examples of net.sf.javailp.Linear

      double factor1, EleConnector var1,
      double factor2, EleConnector var2,
      double factor3, EleConnector var3,
      String op, double limit) {
   
    Linear linear = new Linear();
   
    double limitCorrection = 0;
   
    if (var1 != null) {
      LPVariablePair c1 = variableMap.get(var1);
      linear.add(factor1, c1.posVar());
      linear.add(-factor1, c1.negVar());
      limitCorrection += factor1 * var1.getPosXYZ().y;
    }
   
    if (var2 != null) {
      LPVariablePair c2 = variableMap.get(var2);
      linear.add(factor2, c2.posVar());
      linear.add(-factor2, c2.negVar());
      limitCorrection += factor2 * var2.getPosXYZ().y;
    }
   
    if (var3 != null) {
      LPVariablePair c3 = variableMap.get(var3);
      linear.add(factor3, c3.posVar());
      linear.add(-factor3, c3.negVar());
      limitCorrection += factor3 * var3.getPosXYZ().y;
    }
   
    problem.add(linear, op, limit - limitCorrection);
   
View Full Code Here

Examples of net.sf.javailp.Linear

   
  }
 
  private Linear constructObjective() {
 
    Linear objectiveLinear = new Linear();
   
    for (LPVariablePair v : variables) {
     
      if (v.getConnectors().get(0).groundState == ON) {
       
        objectiveLinear.add(1, v.posVar());
        objectiveLinear.add(1, v.negVar());
       
      }
     
    }
   
View Full Code Here

Examples of org.fnlp.ml.classifier.hier.Linear

    BaseGenerator featureGen = new BaseGenerator();
    ZeroOneLoss loss = new ZeroOneLoss();
    Inferencer msolver = new MultiLinearMax(featureGen, al, null,2);

    PATrainer trainer = new PATrainer(msolver, featureGen, loss, round,c, null);
    Linear pclassifier = trainer.train(train, null);
   
    String modelFile = path+".m.gz";
    pclassifier.saveTo(modelFile);

    long end = System.currentTimeMillis();
    System.out.println("Total Time: " + (end - start));
    System.out.println("End!");
    (new File(modelFile)).deleteOnExit();
View Full Code Here

Examples of org.fnlp.ml.classifier.hier.Linear

    BaseGenerator featureGen = new BaseGenerator();
    ZeroOneLoss loss = new ZeroOneLoss();
    Inferencer msolver = new MultiLinearMax(featureGen, lf, null,2);

    PATrainer trainer = new PATrainer(msolver, featureGen, loss, round,c, null);
    Linear pclassifier = trainer.train(trainset, null);
    String modelFile = "./tmp/m.gz";
    pclassifier.saveTo(modelFile);
    pclassifier = null;
   
    System.out.println("分类器测试");
    pclassifier = Linear.loadFrom(modelFile);
    float[] tdata = new float[]{1,0,1};
    ISparseVector sv = new HashSparseVector(tdata,true);
    Instance inst = new Instance(sv);
    String lab = pclassifier.getStringLabel(inst);
    System.out.println("分类结果:\t"+lab);
   

    long end = System.currentTimeMillis();
    System.out.println("Total Time: " + (end - start));
View Full Code Here

Examples of org.fnlp.ml.classifier.linear.Linear

    public static void main(String[] args) throws Exception {

      ARClassifier tc = new ARClassifier();
      tc.train();
      Linear cl =Linear.loadFrom(modelFile);
      int i = 0;int j = 0;double ij = 0.0;int kk = 0;int jj = 0;int nn = 0;int n = 0;
      InstanceSet test = new InstanceSet(cl.getPipe(),cl.getAlphabetFactory());
      SimpleFileReader sfr = new SimpleFileReader("../tmp/ar-train.txt",true);
     
      ArrayList<Instance> list1 = new ArrayList<Instance>();
      while (sfr.hasNext())
      {
        list1.add(sfr.next());
      }
      List<String>[] str1 = new List[list1.size()];
      String[] str2 = new String[list1.size()];
      Iterator it = list1.iterator();
      while(it.hasNext()){
        Instance in = (Instance) it.next();
        str1[i] = (List<String>) in.getData();
        str2[i] = (String) in.getTarget();
        i++;
      }
      for(int k = 0;k<str2.length;k++)
      {
        if(str2[k].equals("1"))
          kk++;
      }
      String ss =null;
        test.loadThruPipes(new ListReader(str1));
       
        for(int ii=0;ii<str1.length;ii++){
          ss = cl.getStringLabel(test.getInstance(ii));
          if(ss.equals("1"))
            j++;
       
          if(ss.equals("1")&&ss.equals(str2[ii]))
            jj++;
View Full Code Here

Examples of org.fnlp.ml.classifier.linear.Linear

      Generator gen = new SFGenerator();
      ZeroOneLoss l = new ZeroOneLoss();
      Inferencer ms = new LinearMax(gen, factory.getLabelSize());
      Update update = new LinearMaxPAUpdate(l);
      OnlineTrainer trainer = new OnlineTrainer(ms, update,l, factory.getFeatureSize(), 50,0.005f);
      Linear pclassifier = trainer.train(instset,instset);
      pipe.removeTargetPipe();
      pclassifier.setPipe(pipe);
      factory.setStopIncrement(true);
      pclassifier.saveTo(modelFile);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.