Веб Зображення Новини Групи Блоги Перекладач Gmail Ще »
Групи, які ви переглядали нещодавно | Довідка | Увійти
Головна сторінка Груп Google
Допис з розмови Newby(ish)
Група, до якої ви додаєте допис, - група Usenet. Відтак, будь-хто в Інтернеті бачитиме вашу електронну адресу.
Вашу відповідь не було надіслано.
Ваш допис надіслано
 
Від:
Кому:
Копія:
Продолжить:
Додати копію: | Додати продовження: | Редагувати тему
Тема:
Підтвердження:
З метою підтвердження введіть символи, наведені на зображенні нижче, або числа, які чуєте, натиснувши значок доступу. Прослухайте і введіть цифри, що чуєте
 
Gregory Rickeard  
Переглянути профіль   Перекласти вказаною мовою: Перекладено (переглянути оригінал)
 Більше налаштувань 27 Чер 2003, 13:45
Групи новин: comp.lang.lisp
Від: Gregory Rickeard <s9905...@sms.ed.ac.uk>
Дата: Fri, 27 Jun 2003 11:45:45 +0100
Місцевий час: Пт 27 Чер 2003 13:45
Тема: Newby(ish)
---not homework---

I have been playing with LISP (xlispstat) for a while and have been trying
to implement a genetic programming algorythm in it. I am using binary tree
representations of functions (that is an evolved program should consist
entiraly of lists of length 3 whos fist member is a member of the function
set and whos other members are either similar lists or members of the
terminal set.) however at some point though the gp run cons cells start
appearing, oftain containing atoms which dont apear in any of the
functions used in the program or as arguments to the program (the atom
TREE is particularly common)

The most likely function to be causing this is crossover - which performs
most of the work for crossover and mutation (ie. replaces a random subtree
in a tree with some specifies structure.)

(defun crossover (tree &optional (subst nil) (prob-no-recursion .75))
  "args: tree &optional (subst nil) (prob-no-recursion .75)

finds a random subtree (not including the entire tree) of tree and returns
it, possibly
after replacing it with subst if subst is non nil.."
  (if (< (random 1.0) (expt prob-no-recursion (1- (max-depth tree))))
      ;; swap with a sub tree
      (let ((args (cdr tree))
            (rnd (random 2))
            (tmp nil))
        (if (null subst)
            (cond ((= rnd 0) (car args))
                  (t (second args)))
          (cond ((= rnd 0) (setf tmp (car args))
                           (rplaca args subst)
                           tmp)
                (t (setf tmp (second args))
                   (rplacd args (list subst))
                   tmp))))
    ;; swap with another sub-tree
    (let* ((dl (max-depth (second tree)))
           (dr (max-depth (third tree)))
           (rnd (random (+ dl dr))))
      (if (< rnd dl)
          (crossover (second tree) subst)
        (crossover (third tree) subst)))))

crossover looks fine to me - but i am unshure of my usage of rplaca and
rplacd...


Ви мусите увійти перед публікацією повідомлень.
Аби надіслати допис, будь ласка, спочатку приєднайтеся до цієї групи.
Будь ласка, поновіть своє прізвисько на сторінці налаштування передплати перед тим, як надіслати свій допис.
У вас немає права надсилання дописів до цієї групи.

Створити групу - Групи Google - Домашня сторінка Google - Правила користування послугою - Заява про конфіденційність і нерозголошення інформації
©2009 Google