Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Postgres/src/backend/optimizer/geqo/   (Postgres Database Version 18.4©)  Datei vom 11.4.2026 mit Größe 1 kB image not shown  

Quelle  geqo_mutation.c

  Sprache: C
 

/*------------------------------------------------------------------------
*
* geqo_mutation.c
*
*  TSP mutation routines
*
* src/backend/optimizer/geqo/geqo_mutation.c
*
*-------------------------------------------------------------------------
*/


/* contributed by:
   =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=
   *  Martin Utesch     * Institute of Automatic Control    *
   =        = University of Mining and Technology =
   *  utesch@aut.tu-freiberg.de  * Freiberg, Germany       *
   =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=
 */


/* this is adopted from Genitor : */
/*************************************************************/
/*  */
/* Copyright (c) 1990  */
/* Darrell L. Whitley  */
/* Computer Science Department  */
/* Colorado State University  */
/*  */
/* Permission is hereby granted to copy all or any part of  */
/* this program for free distribution.   The author's name  */
/* and this copyright notice must be included in any copy.  */
/*  */
/*************************************************************/

#include "postgres.h"
#include "optimizer/geqo.h"

#if defined(CX)     /* currently used only in CX mode */

#include "optimizer/geqo_mutation.h"
#include "optimizer/geqo_random.h"

void
geqo_mutation(PlannerInfo *root, Gene *tour, int num_gene)
{
 int   swap1;
 int   swap2;
 int   num_swaps = geqo_randint(root, num_gene / 30);
 Gene  temp;


 while (num_swaps > 0)
 {
  swap1 = geqo_randint(root, num_gene - 10);
  swap2 = geqo_randint(root, num_gene - 10);

  while (swap1 == swap2)
   swap2 = geqo_randint(root, num_gene - 10);

  temp = tour[swap1];
  tour[swap1] = tour[swap2];
  tour[swap2] = temp;


  num_swaps -= 1;
 }
}

#endif       /* defined(CX) */

Messung V0.5 in Prozent
C=91 H=94 G=92

¤ Dauer der Verarbeitung: 0.13 Sekunden  (vorverarbeitet am  2026-08-08) ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.