coser.datamodel.decisionsystem
类 TestCostConstraintNominalDecisionSystemGA

java.lang.Object
  继承者 Instances
      继承者 coser.datamodel.decisionsystem.RoughDecisionSystem
          继承者 coser.datamodel.decisionsystem.CostSensitiveDecisionSystem
              继承者 coser.datamodel.decisionsystem.NominalDecisionSystem
                  继承者 coser.datamodel.decisionsystem.TestCostNominalDecisionSystem
                      继承者 coser.datamodel.decisionsystem.TestCostConstraintNominalDecisionSystem
                          继承者 coser.datamodel.decisionsystem.TestCostConstraintNominalDecisionSystemGA

public class TestCostConstraintNominalDecisionSystemGA
extends TestCostConstraintNominalDecisionSystem

Project: The cost-sensitive rough sets project.

Summary: Test cost constraint decision system with genetic algorithms. The methods might be merged into TestCostNominalDecisionSystemGA. They are written independently because those programs belong to different authors.

Author: Jiabin Liu

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

Organizaion: Lab of Granular Computing, Zhangzhou Normal University, Fujian 363000, China.

Progress: The very beginning.
Written time: September 2, 2011.
Last modify time: May 26, 2012.


字段摘要
修饰符 和 类型 字段 和 描述
(专用软件包)  int bestChromosomeIndex
          The best chromosome of the group of chromosomes.
(专用软件包)  double bestFitnessValue
          The best fitness value of the group of chromosomes.
(专用软件包)  boolean[][] chromosomes
          The population.
(专用软件包)  double[] fitnessValues
          Fitness value for chromosomes.
(专用软件包)  int generations
          The max generation.
static int MORE_ATTRIBUTES_ATTEMPTS
           
(专用软件包)  int numberOfChromosomes
          The number of Chromosomes.
 
从类 coser.datamodel.decisionsystem.TestCostConstraintNominalDecisionSystem 继承的字段
ALL_EXHAUSTIVE, BASS, currentSubreduct, currentSubreductEntropy, currentSubreductTestCost, exhaustiveSubreductResultArray, MAX_CANDIDATES_FOR_BASS, MAX_CANDIDATES_FOR_SESRA, MAX_TESTS_FOR_EXHAUSTIVE, OPR_RESULT_LENGTH, optimalSubreductConsistency, optimalSubreductCost, optimalSubreductEntropy, optimalSubreductsArray, PURE_BACKTRACK, SESRA, SESRAstar
 
从类 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, 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
 
构造方法摘要
构造函数 和 描述
TestCostConstraintNominalDecisionSystemGA(TestCostNominalDecisionSystem paraDecisionSystem)
          Construct the decision system.
 
方法摘要
修饰符 和 类型 方法 和 描述
protected  void chromosomeJustifyForConstraint(boolean[] paraChromosome)
          Adjust the chromosome to be close to the constraint.
protected  double computeFitnessValue(boolean[] paraChromosome, double paraLambda)
          Compute the fitness of the given chromosome using the conditional entropy and the test cost.
 boolean constraintSatisfied(boolean[] paraSelectedTests)
          Judge whether or not the given test set satisfy the constraint.
protected  void crossoverOperation()
          Uniform crossover.
protected  double generateRandomChromosome(boolean[] paraChromosome, double paraLambda)
          Generate a random chromosome according to the test cost constraint.
 int getConstraint()
          Get the test cost upper bound.
 void initializeForReduction(boolean paraWeighting, int paraNumberOfChromosomes, int paraNumberOfGeneration)
          Initialize for reduction.
protected  void initializePopulation(double paraLambda)
          Initialize a population.
protected  void mutationOperation(double paraLambda)
          Mutation operation.
protected  int searchOneUnselectedChromosomes(int[] paraChromosomeIndices, int paraNumberOfUnselectedChromosomes)
          Select a chromosomes not selected yet for crossover.
protected  void selectionOperation(double paraLambda)
          Select the new group of chromosomes from the existing group according to some probabilities.
 boolean[] testCostConstraintReductionGA(double paraLambda, int paraConstraint)
          Generate a test set by GA.
 
从类 coser.datamodel.decisionsystem.TestCostConstraintNominalDecisionSystem 继承的方法
backtrackForSubreducts, computeConstraintSatisfiedTestSetsBacktrack, computeConstraintSatisfiedTestSetsBacktrack, constraintReductionBacktrack, constraintReductionBASS, constraintReductionSESRA, constraintReductionSESRA, constraintReductionSESRAstar, constraintSatisfied, entropyBasedLambdaWeightedConstraintReduction, getExhaustiveSubreductResults, getOneOptimalSubreduct, getOptimalSubreductConsistency, getOptimalSubreductCost, getSubreductEntropy, getSubreductString, getSubreductTestCost, posBasedLambdaWeightedConstraintReduction, removeShortTestSets, removeShortTestSets, selectMaximalConsistencySubreducts, toString
 
从类 coser.datamodel.decisionsystem.TestCostNominalDecisionSystem 继承的方法
computeOptimalReductBacktrack, entropyBasedLambdaWeightedReduction, isCurrentReductOptimal, optimalReductBacktrack, removeRedundantAttributes, setLambda, setWeighting, sortByTestCost
 
从类 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
 

字段详细信息

MORE_ATTRIBUTES_ATTEMPTS

public static final int MORE_ATTRIBUTES_ATTEMPTS
另请参见:
常量字段值

numberOfChromosomes

int numberOfChromosomes
The number of Chromosomes.


generations

int generations
The max generation.


chromosomes

boolean[][] chromosomes
The population.


fitnessValues

double[] fitnessValues
Fitness value for chromosomes.


bestChromosomeIndex

int bestChromosomeIndex
The best chromosome of the group of chromosomes.


bestFitnessValue

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

构造方法详细信息

TestCostConstraintNominalDecisionSystemGA

public TestCostConstraintNominalDecisionSystemGA(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
方法详细信息

initializeForReduction

public void initializeForReduction(boolean paraWeighting,
                                   int paraNumberOfChromosomes,
                                   int paraNumberOfGeneration)
                            throws java.lang.Exception
Initialize for reduction. Overloads the one of the super class.

参数:
paraWeighting - weighting or not, for lambda-weighting
paraNumberOfChromosomes - number of chromosomes, only for GA
paraNumberOfGeneration - number of generations, only for GA
抛出:
java.lang.Exception - if the attribute or class is not nominal, or missing values exists.

getConstraint

public int getConstraint()
Get the test cost upper bound.

返回:
the constraint.

testCostConstraintReductionGA

public boolean[] testCostConstraintReductionGA(double paraLambda,
                                               int paraConstraint)
                                        throws java.lang.Exception
Generate a test set by GA. It should satisfy the constraint.

参数:
paraLambda - Lambda is used to just the chromosome's test cost
paraConstraint - The test cost upper bound.
返回:
a test set represented by a boolean array.
抛出:
java.lang.Exception

initializePopulation

protected void initializePopulation(double paraLambda)
                             throws java.lang.Exception
Initialize a population.

抛出:
java.lang.Exception

generateRandomChromosome

protected double generateRandomChromosome(boolean[] paraChromosome,
                                          double paraLambda)
                                   throws java.lang.Exception
Generate a random chromosome according to the test cost constraint. The result is stored in the given boolean array. The chromosome should be close to the test cost constraint however not exceeding it.

参数:
paraChromosome - the given chromosome that will be changed in the method.
paraLambda - the given lambda value
返回:
the fitness value of the generated chromosome
抛出:
java.lang.Exception

selectionOperation

protected void selectionOperation(double paraLambda)
                           throws java.lang.Exception
Select the new group of chromosomes from the existing group according to some probabilities. A chromosome may be chosen many times. Input: 1. A group of chromosomes which in member variable "chromosomes";
2. constraint which is stored as a member variable "constraint"; Output: The result of selection is a new population which puts in member variable chromosomes.

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

computeFitnessValue

protected double computeFitnessValue(boolean[] paraChromosome,
                                     double paraLambda)
                              throws java.lang.Exception
Compute the fitness of the given chromosome using the conditional entropy and the test cost.

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

crossoverOperation

protected void crossoverOperation()
                           throws java.lang.Exception
Uniform crossover. The new chromosome may not meet the constraint. Input: A group of chromosomes which in member variable chromosomes. Output: The result of crossover is a new population which puts in member variable chromosomes.

抛出:
java.lang.Exception

searchOneUnselectedChromosomes

protected int searchOneUnselectedChromosomes(int[] paraChromosomeIndices,
                                             int paraNumberOfUnselectedChromosomes)
                                      throws java.lang.Exception
Select a chromosomes not selected yet for crossover. Zilong.

参数:
paraChromosomeIndices - The index of chromosomes.
paraNumberOfUnselectedChromosomes - The valid number of chromosomes.
返回:
The index of selected chromosome.
抛出:
java.lang.Exception

mutationOperation

protected void mutationOperation(double paraLambda)
                          throws java.lang.Exception
Mutation operation. After mutation, the test cost constraint is met. Input: A group of chromosomes which in member variable chromosomes; Output: The result of mutation is a new population which puts in member variable chromosomes;

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

chromosomeJustifyForConstraint

protected void chromosomeJustifyForConstraint(boolean[] paraChromosome)
                                       throws java.lang.Exception
Adjust the chromosome to be close to the constraint. Input: constraint which is a member variable. Jiabin

参数:
paraChromosome - The given chromosome.
抛出:
java.lang.Exception

constraintSatisfied

public boolean constraintSatisfied(boolean[] paraSelectedTests)
                            throws java.lang.Exception
Judge whether or not the given test set satisfy the constraint. This method can be put to class OptimalSubReductDecisionSystem.

参数:
paraSelectedTests - Selected tests represented by a boolean array.
抛出:
java.lang.Exception - if it is thrown by computeTestCost().