Package infosapient.hdg

Source Code of infosapient.hdg.FzyHdgAROUND

package infosapient.hdg;
/*
* Copyright (c) 2001, Workplace Performance Tools, All Rights Reserved.
*
* LICENSE TO USE THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THE COMMON PUBLIC LICENSE 0.5
* ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES
* RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
* The license may be viewed at:
* http://www.opensource.org/licenses/cpl.html
*/
import infosapient.system.FzySet;
import java.rmi.server.ObjID;

/**

*
* Class FzyHdgAROUND broadens the membership around the maximum height of the set, by raising
* <code> m[i] to @link FzyHedge.AROUND_EXP </code>.
* @author Copyright 1997-2001, Workplace Performance Tools, All Rights Reserved.
* <br> License to use this program is provided under the COMMON PUBLIC LICENSE 0.5.</br>
*
* <br> THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS COMMON PUBLIC LICENSE
* ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES
* RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.<br>
* @version $Revision: 1.1.1.1 $
*/
public class FzyHdgAROUND extends FzyHedge {
  static final long serialVersionUID = -178140277901480352L;
  public FzyHdgAROUND() {myID = new ObjID();}
  public FzySet apply(FzySet aSet) {
    double d_inx, d_jnx;
    VECMAX = aSet.getMemberArray().length;
    results = new double[VECMAX];
    for (int i = 0; i < VECMAX; i++) results[i] = 0.0;

    m = new double[VECMAX];
    m = aSet.getMemberArray();
    double domainSegment = aSet.getHighDomain() - aSet.getLowDomain();
    double interval = domainSegment / (VECMAX-1);
    int inxOfDomainForMaxMem = 0;
    try {
      double domainForMaxMem = aSet.domainForMembership(aSet.getMaxHeight());
      inxOfDomainForMaxMem =
          aSet.getIndexForDomain(domainForMaxMem);
    } catch (Exception fse) {
      fse.printStackTrace();
    }
    d_inx = (double) inxOfDomainForMaxMem;
    for (int jnx = 0; jnx < VECMAX; jnx++) {
      if (m[jnx] != 0.0) {
        d_jnx = (double) jnx;
        double diff = d_jnx - d_inx;
        double p1 = Math.abs(diff * interval);
        double p2 = (1.0d / ( 1.0d + Math.pow(p1, AROUND_EXP)) * m[jnx]);
        //System.out.println(" jnx = \t"+ jnx+"\t diff = "+diff+",\t part1 =\t "+p1+",\t part2 =\t "+p2);
        results[jnx] = Math.max(results[jnx], p2);
      }
    }
    aSet.setMembershipArray(results);
    return aSet;
  }
  public String getName() { return "around"; }
}
TOP

Related Classes of infosapient.hdg.FzyHdgAROUND

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.