Logo Search packages:      
Sourcecode: tablix2 version File versions  Download package

void population_hint ( population pop,
int  hintpart 
)

Hint a part of the population.

If dat_tuplemap contains information that can be used to initialize variable chromosomes in the population (i.e. the user has loaded an XML file that already contains a partial or a full solution), then this function initializes some variable chromosomes.

If dat_tuplemap doesn't contain this information this function does nothing.

If the information in dat_tuplemap conflicts with a domain of a tuple then the dat_tuplemap information is ignored for that tuple and an error is reported.

Parameters:
pop Pointer to the population to be hinted.
hintpart Percent of the population that will be hinted.

Definition at line 1429 of file data.c.

References table_t::chr, debug(), table_t::fitness, chromo_t::restype, population_t::size, population_t::tables, table_t::typenum, and resourcetype_t::var.

{
      int n,m;
      table *tab;

      int num;

      assert(pop!=NULL);
      assert(hintpart>=0);
      assert(hintpart<=100);

      num=0;
      for(n=0;n<pop->size;n++) {
            tab=pop->tables[n];

            if(rand()%100>=hintpart) continue;
            
            for(m=0;m<tab->typenum;m++) {
                  if(tab->chr[m].restype->var) {
                        table_hint(tab, m);
                  }
            }
            num++;
            tab->fitness=-1;
      }

      debug("Hinted %d tables in a population of %d (%d%%)", 
                  num, pop->size, (num*100)/pop->size);
}


Generated by  Doxygen 1.6.0   Back to index