coser.datamodel.decisionsystem
类 TestCostNominalDecisionSystemGA

java.lang.Object
  继承者 Instances
      继承者 coser.datamodel.decisionsystem.RoughDecisionSystem
          继承者 coser.datamodel.decisionsystem.CostSensitiveDecisionSystem
              继承者 coser.datamodel.decisionsystem.NominalDecisionSystem
                  继承者 coser.datamodel.decisionsystem.TestCostNominalDecisionSystem
                      继承者 coser.datamodel.decisionsystem.TestCostNominalDecisionSystemGA
直接已知子类:
TestCostNominalDecisionSystemGAWithES

public class TestCostNominalDecisionSystemGA
extends TestCostNominalDecisionSystem

Summary: Test cost sensitive decision system with genetic algorithms. The methods might be merged into TestCostDecisionSystem. They are written independently because those programs belong to different authors.
\@INPROCEEDINGS{PanMinZhu11Genetic,
author = {Guiying Pan and Fan Min and William Zhu},
title = {A genetic algorithm to the minimal test cost reduct problem},
booktitle = {Proceedings of {IEEE} International Conference on Granular Computing},
year = {2011},
pages = {539--544}
}

Author: Guiying Pan kentwingpan@163.com

Copyright: The source code and all documents are open and free. PLEASE keep this header while revising the program.

Organization: Lab of Granular Computing, Zhangzhou Normal University, Fujian 363000, China.
Project: The cost-sensitive rough sets project.

Progress: Test-cost-sensitive attribute reduction based on genetic algorithms implemented.
Written time: July 25, 2011.
Last modify time: September 2, 2011.


字段摘要
修饰符 和 类型 字段 和 描述
(专用软件包)  long bestChromosome
          The best fitness value of the chromosome.
(专用软件包)  double bestFitnessValue
          The best fitness value of the group of chromosomes.
(专用软件包)  boolean[][] chromosomes
          The population.
(专用软件包)  java.lang.String distributionString
          The name of distribution.
(专用软件包)  java.lang.String GAFilename
          The gred filename.
(专用软件包)  int generations
          The max generation.
(专用软件包)  int numberOfChromosomes
          The number of Chromosomes.
 
从类 coser.datamodel.decisionsystem.TestCostNominalDecisionSystem 继承的字段
lambda, weighting
 
从类 coser.datamodel.decisionsystem.NominalDecisionSystem 继承的字段
ATTRIBUTES_COMBINATIONS, BACKTRACK, EXPONENTIAL, reductMinimalSize
 
从类 coser.datamodel.decisionsystem.CostSensitiveDecisionSystem 继承的字段
alpha, COMPLEX_COMMON_TEST_COST, COST_TYPE_MONEY, COST_TYPE_TESTING_TIME, COST_TYPE_WAITING_TIME, currentReductCost, currentReductTime, currentReductTotalTestCost, DEFAULT_AVERAGE_NUMBER_OF_TESTS_PER_GROUP, groupCommonTestCostArray, groupInclusionArray, groupInclusionMatrix, IMPOSSIBLE_COST, individualCostDistributions, individualCostLowerBounds, individualCostMatrix, individualCostRandom, individualCostUpperBounds, minimalTestCostReduct, minimalTimeReduct, misclassificationCostMatrix, misclassificationCostSumArray, NORMAL, optimalReductTestCost, optimalReductTime, PARETO, randomMode, SIMPLE_COMMON_TEST_COST, TEST_COST_INDEPENDENT, TEST_COST_TYPES, testCostConstraint, testCostRelationship, testingOrderMatrix, timeParts, totalTimeConstraint, unifiedMisclassificationCost, UNIFORM
 
从类 coser.datamodel.decisionsystem.RoughDecisionSystem 继承的字段
allConditions, allReducts, allReductsFilename, allSubreducts, allSubreductsFilename, arffFilename, backtrackSteps, candidateReductArray, candidateSubreductArray, candidateSubreductConsistencyArray, classSize, CONDITIONAL_ENTROPY, consistency, core, currentReduct, currentSelectedAttributes, endTime, MAJORITY, minimalReductSize, numberOfCandidateReducts, numberOfCandidateSubreducts, numberOfConditions, numberOfInstances, optimalReduct, POSITIVE_REGION, runTimeInformation, startTime, totalEntropy, totalMajority, totalPositiveRegion
 
构造方法摘要
构造函数 和 描述
TestCostNominalDecisionSystemGA(TestCostNominalDecisionSystem paraDecisionSystem)
          Construct the decision system.
 
方法摘要
修饰符 和 类型 方法 和 描述
 boolean[][] bestInsteadOfWorst(boolean[][] paraChromosomes)
          The worst individual in offsprings is replaced by & the best individual in parent generation.
 double computeFitnessValue_FirstVersion(boolean[] paraChromosome, int paraMaxPositiveRegion, double paraLambda)
          Compute the fitness of the given chromosome in the first version of the genetic algorithm.
 double computeFitnessValue_SecondVersion(boolean[] paraChromosome, int paraMaxPositiveRegion, double paraLambda)
          Compute the fitness of the given chromosome in the second version of the genetic algorithm.
 double computeFitnessValue(boolean[] paraChromosome, int paraMaxPositiveRegion)
          Compute the fitness of the given chromosome.
 boolean[][] crossoverOperation(boolean[][] paraChromosomes)
          Uniform crossover.
 long[] GABasedMinimalAttributeReduction()
          Find a (possibly) minimal reduct using the genetic algorithm based reduction algorithm.
 long[] GABasedMinimalAttributeReduction(boolean[] paraAvailableAttributes)
          Find a (possibly) minimal reduct using the genetic algorithm based reduction algorithm.
 void geneticAlgorithmBasedTCSAttributeReduction_FirstVersion(double paraLambda)
          The first version of the genetic algorithm.
 void geneticAlgorithmBasedTCSAttributeReduction_SecondVersion(double paraLambda)
          The second version of the genetic algorithm.
 boolean[] geneticAlgorithmBasedTCSAttributeReduction(double paraLambda, boolean paraAlgorithm)
          Find a (possibly) minimal test-cost reduct using the genetic algorithm based reduction algorithm.
 java.lang.String getDistributionString()
          Get the distribution name in current.
 java.lang.String getGAFilename()
          Get gred filename.
 boolean[] initializeChromosome(boolean[] paraAllAttributes)
          Initialize a chromosome.
 boolean[][] initializeChromosomes(boolean[] paraAllAttributes)
          Initialize a group of chromosomes.
 void initializePartOfChromosomesToTrue()
          If no chromosome is a solution, then initialize a part of chromosomes(one tenth) to all true.
 void initializePopulation()
          Initialize a population.
 boolean[][] mutationOperation(boolean[][] paraChromosomes)
          Mutation operation.
 long[] removeRedundantReducts()
          Remove redundant candidate reducts.
 int searchPairsOfChromosomes(boolean[] paraCheckChromosome)
          Select a chromosomes for crossover.
 boolean[][] selectionOperation_FirstVersion(boolean[][] paraChromosomes, int paraMaxPositiveRegion, double paraLambda)
          Select new the group of chromosomes in the first version of the genetic algorithm.
 boolean[][] selectionOperation_SecondVersion(boolean[][] paraChromosomes, int paraMaxPositiveRegion, double paraLambda)
          Select new the group of chromosomes in the second version of the genetic algorithm.
 boolean[][] selectionOperation(boolean[][] paraChromosomes, int paraMaxPositiveRegion)
          Select new the group of chromosomes.
 void setDistributionString()
          Set the distribution name.
 void setGAFilename()
          Set the filename such that it can store results produced by GABasedTCSAttributeReduction.
 void setGeneration(int paraGenerations)
          Set the number of generation.
 void setNumberOfChromosomes(int paraNumberOfChromosome)
          Set the number of chromosome.
 
从类 coser.datamodel.decisionsystem.TestCostNominalDecisionSystem 继承的方法
computeOptimalReductBacktrack, entropyBasedLambdaWeightedReduction, isCurrentReductOptimal, optimalReductBacktrack, removeRedundantAttributes, setLambda, setWeighting, sortByTestCost, toString
 
从类 coser.datamodel.decisionsystem.NominalDecisionSystem 继承的方法
buildCandidateReducts, computeAllReductsBacktrack, computeAllReductsBacktrack, computeAllReductsExhaustive, computeAllReductsExhaustive, computeAllReductsExhaustive, computeAllReductsExhaustiveExponential, computeAllSubreducts, computeConsistency, computeCore, conditionalEntropy, entropyBasedReduction, informationGain, informationGain, main, majority, majority, positiveRegion, positiveRegion, removeRedundantSubreducts, splitData, splitData, splitData
 
从类 coser.datamodel.decisionsystem.CostSensitiveDecisionSystem 继承的方法
averageMisclassificationCost, averageMisclassificationCost, averageMisclassificationCost, averageMisclassificationCost, bestClassValue, computeAdditiveCost, computeExceedingFactor, computeOptimalTestCost, computeReductTestCost, computeReductWaitingTime, computeTestCost, computeTestCost, copyForClone, generateIndividualCosts, generateOneCost, getClassificationCost, getDistributionString, getIndividualCost, getIndividualTestCost, getIndividualTestCostArray, getMisclassificationCostMatrix, getOptimalReductTestCost, getReductTotalTestCost, initializeForReduction, refreshTestCost, setAlpha, setComplexCommonTestCostArrays, setCostRandomMode, setIndividualCostArray, setIndividualCostBounds, setIndividualCostDistribution, setMisclassificationCostMatrix, setMisclassificationCostMatrix, setSimpleCommonTestCostArrays, setTestCostsRelationShip, setUnifiedMisclassificationCost
 
从类 coser.datamodel.decisionsystem.RoughDecisionSystem 继承的方法
classEntropy, classEntropy, computeConsistency, computeConsistency, computeCore, conditionalEntropy, conditionalEntropy, copyForClone, delete, divideInTwo, entropyReciprocal, entropyReciprocal, entropyReciprocal, entropyReciprocal, entropyReciprocal, getAllReductsFilename, getAllReductsString, getAllSubreductsFilename, getArffFilename, getArffSource, getBacktrackSteps, getCandidateSubreductConsistencyArray, getCurrentReduct, getCurrentReductIndex, getMeasure, getNumberOfConditions, getOptimalReduct, getReductionTime, getReductString, getRunTimeInformation, hasMissingValue, isNominal, isNormalized, isNumeric, majority, majority, normalize, positiveRegion, positiveRegion, printAllReducts, readAllReducts, readAllReducts, readAllSubreducts, readAllSubreducts, setAllReductsFilename, setAllReductsFilename, setAllSubreductsFilename, setAllSubreductsFilename, setArffFilename, setCurrentReduct, setCurrentReduct, setMeasure, writeAllReducts
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

字段详细信息

numberOfChromosomes

int numberOfChromosomes
The number of Chromosomes.


generations

int generations
The max generation.


bestFitnessValue

double bestFitnessValue
The best fitness value of the group of chromosomes.


bestChromosome

long bestChromosome
The best fitness value of the chromosome.


chromosomes

boolean[][] chromosomes
The population.


distributionString

java.lang.String distributionString
The name of distribution.


GAFilename

java.lang.String GAFilename
The gred filename.

构造方法详细信息

TestCostNominalDecisionSystemGA

public TestCostNominalDecisionSystemGA(TestCostNominalDecisionSystem paraDecisionSystem)
                                throws java.io.IOException,
                                       java.lang.Exception
Construct the decision system. Simply adopt everything of the super class.

抛出:
java.io.IOException
java.lang.Exception
方法详细信息

setNumberOfChromosomes

public void setNumberOfChromosomes(int paraNumberOfChromosome)
Set the number of chromosome.

参数:
paraNumberOfChromosome - The number you need.

setGeneration

public void setGeneration(int paraGenerations)
Set the number of generation.

参数:
paraGenerations - The number you need.

setDistributionString

public void setDistributionString()
Set the distribution name.


getDistributionString

public java.lang.String getDistributionString()
Get the distribution name in current.


setGAFilename

public void setGAFilename()
Set the filename such that it can store results produced by GABasedTCSAttributeReduction.


getGAFilename

public java.lang.String getGAFilename()
Get gred filename.


geneticAlgorithmBasedTCSAttributeReduction

public boolean[] geneticAlgorithmBasedTCSAttributeReduction(double paraLambda,
                                                            boolean paraAlgorithm)
                                                     throws java.lang.Exception
Find a (possibly) minimal test-cost reduct using the genetic algorithm based reduction algorithm. There are two versions, whose difference lies in the condition of computing fitness values. In the first version, the fitness function can be always executed for every solution. In the second version, the fitness function is executed only if the solution may be a reduct or super-reduct.

参数:
paraLambda - The given lambda value.
paraAlgorithm - Algorithms choice.
返回:
the reduct with the form of boolean vector. This reduct is also stored in the & object as currentReduct.
抛出:
java.lang.Exception

initializePopulation

public void initializePopulation()
                          throws java.lang.Exception
Initialize a population.

抛出:
java.lang.Exception

initializeChromosome

public boolean[] initializeChromosome(boolean[] paraAllAttributes)
                               throws java.lang.Exception
Initialize a chromosome.

参数:
paraAllAttributes - All conditional attribubes.
返回:
tempChromosome A boolean array denoting a solution.
抛出:
java.lang.Exception

initializeChromosomes

public boolean[][] initializeChromosomes(boolean[] paraAllAttributes)
                                  throws java.lang.Exception
Initialize a group of chromosomes.

参数:
paraAllAttributes - The given attributes are not core.
返回:
A group of chromosomes.
抛出:
java.lang.Exception

initializePartOfChromosomesToTrue

public void initializePartOfChromosomesToTrue()
                                       throws java.lang.Exception
If no chromosome is a solution, then initialize a part of chromosomes(one tenth) to all true.

抛出:
java.lang.Exception

geneticAlgorithmBasedTCSAttributeReduction_FirstVersion

public void geneticAlgorithmBasedTCSAttributeReduction_FirstVersion(double paraLambda)
                                                             throws java.lang.Exception
The first version of the genetic algorithm.

参数:
paraLambda - The given lambda value.
抛出:
java.lang.Exception

selectionOperation_FirstVersion

public boolean[][] selectionOperation_FirstVersion(boolean[][] paraChromosomes,
                                                   int paraMaxPositiveRegion,
                                                   double paraLambda)
                                            throws java.lang.Exception
Select new the group of chromosomes in the first version of the genetic algorithm.

参数:
paraChromosomes - The given chromosomes.
paraMaxPositiveRegion - The candinality of the positive region of the decision.
paraLambda - The lambad value.
返回:
A new group of chromosomes.
抛出:
java.lang.Exception

computeFitnessValue_FirstVersion

public double computeFitnessValue_FirstVersion(boolean[] paraChromosome,
                                               int paraMaxPositiveRegion,
                                               double paraLambda)
                                        throws java.lang.Exception
Compute the fitness of the given chromosome in the first version of the genetic algorithm.

参数:
paraChromosome - The given chromosome.
paraMaxPositiveRegion - The candinality of the positive region of the decision.
paraLambda - The lambad value.
返回:
A fitness value of the chromosome.
抛出:
java.lang.Exception

geneticAlgorithmBasedTCSAttributeReduction_SecondVersion

public void geneticAlgorithmBasedTCSAttributeReduction_SecondVersion(double paraLambda)
                                                              throws java.lang.Exception
The second version of the genetic algorithm.

参数:
paraLambda - The given lambda value.
抛出:
java.lang.Exception

selectionOperation_SecondVersion

public boolean[][] selectionOperation_SecondVersion(boolean[][] paraChromosomes,
                                                    int paraMaxPositiveRegion,
                                                    double paraLambda)
                                             throws java.lang.Exception
Select new the group of chromosomes in the second version of the genetic algorithm.

参数:
paraChromosomes - The given chromosomes.
paraMaxPositiveRegion - The candinality of the positive region of the decision.
paraLambda - The lambad value.
返回:
A new group of chromosomes.
抛出:
java.lang.Exception

computeFitnessValue_SecondVersion

public double computeFitnessValue_SecondVersion(boolean[] paraChromosome,
                                                int paraMaxPositiveRegion,
                                                double paraLambda)
                                         throws java.lang.Exception
Compute the fitness of the given chromosome in the second version of the genetic algorithm.

参数:
paraChromosome - The given chromosome.
paraMaxPositiveRegion - The candinality of the positive region of the decision.
paraLambda - The lambad value.
返回:
A fitness value of the chromosome.
抛出:
java.lang.Exception

crossoverOperation

public boolean[][] crossoverOperation(boolean[][] paraChromosomes)
                               throws java.lang.Exception
Uniform crossover.

参数:
paraChromosomes - The given group of chromosomes.
返回:
A new population after crossover operation.
抛出:
java.lang.Exception

searchPairsOfChromosomes

public int searchPairsOfChromosomes(boolean[] paraCheckChromosome)
                             throws java.lang.Exception
Select a chromosomes for crossover.

参数:
paraCheckChromosome - The given checked of chromosomes.
返回:
The index of selected chromosome.
抛出:
java.lang.Exception

mutationOperation

public boolean[][] mutationOperation(boolean[][] paraChromosomes)
                              throws java.lang.Exception
Mutation operation.

参数:
paraChromosomes - The given chromosomes.
返回:
The chromosomes.
抛出:
java.lang.Exception

GABasedMinimalAttributeReduction

public long[] GABasedMinimalAttributeReduction()
                                        throws java.lang.Exception
Find a (possibly) minimal reduct using the genetic algorithm based reduction algorithm.

返回:
The candidate reducts.
抛出:
java.lang.Exception

GABasedMinimalAttributeReduction

public long[] GABasedMinimalAttributeReduction(boolean[] paraAvailableAttributes)
                                        throws java.lang.Exception
Find a (possibly) minimal reduct using the genetic algorithm based reduction algorithm.

参数:
paraAvailableAttributes - The available attributes.
返回:
The candidate reducts.
抛出:
java.lang.Exception

computeFitnessValue

public double computeFitnessValue(boolean[] paraChromosome,
                                  int paraMaxPositiveRegion)
                           throws java.lang.Exception
Compute the fitness of the given chromosome.

参数:
paraChromosome - The given chromosome
返回:
A fitness value of the chromosome.
抛出:
java.lang.Exception

selectionOperation

public boolean[][] selectionOperation(boolean[][] paraChromosomes,
                                      int paraMaxPositiveRegion)
                               throws java.lang.Exception
Select new the group of chromosomes.

参数:
paraChromosomes - The given chromosomes.
返回:
A new group of chromosomes.
抛出:
java.lang.Exception

removeRedundantReducts

public long[] removeRedundantReducts()
                              throws java.lang.Exception
Remove redundant candidate reducts.

返回:
object status.
抛出:
java.lang.Exception

bestInsteadOfWorst

public boolean[][] bestInsteadOfWorst(boolean[][] paraChromosomes)
                               throws java.lang.Exception
The worst individual in offsprings is replaced by & the best individual in parent generation.

参数:
paraChromosomes - The given popution.
返回:
paraChromosomes The new popution.
抛出:
java.lang.Exception