> The code for an age- and sex-structured, individual
> based model to simulate a disease with latent and
> infectious periods is at:
> 
> http://www.geocities.com/do_joly/disease.txt
> 
> Example results are at:
> 
> http://www.geocities.com/do_joly/disease.pdf
> 
> I realize that my code lacks elegance and efficiency,
> so any suggestions would be greatly appreciated. 
> Also, to make sure that I don't forget things as I
> learn them, I comment the hell out of the code as I
> go, even for simple things.  As I know nothing about
> GUI development, it runs off a prompt and just dumps
> the results to files.  I actually call the script from
> an R procedure that plots the results.

This is a brave move.

In your Individual code you have 

    attr_writer :sex, :alive, :mother, :ages, :infected

and then individual routines for getting @age etc.

    attr_accessor :sex, :alive, :mother, :ages, :infected

might save those extra routines.

Might the alive and pregnant attributes be better as boolean values rather
than 1 / 0 tested integers?

Maybe @alive should never be directly accessed at all outside the class and
you could use an interface like

   class Individual

     def alive?
       @alive
     end

     def die
       @alive = false
     end

   end

where the ? at the end of the method name is meaningful

you might want to indent the code consistently so that it's easier to look
at and see the structure e.g.

  class Population < Array
    alias_method :old_init, :initialize
      def initialize(num = 0, val = nil, &proc)
        if block_given?
  num.times {|i| self.push (yield i)}
        else
  old_init(num, val)
  end
  end
  end

might be nicer as

  class Population < Array

    alias_method :old_init, :initialize

    def initialize(num = 0, val = nil, &proc)
      if block_given?
        num.times {|i| self.push (yield i)}
      else
        old_init(num, val)
      end
    end

  end

I'll look at it moer later when I get home.

Hope this helps,

Mike

-- 
mike / stok.co.uk                    |           The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/       | GPG PGP Key      1024D/059913DA 
mike / starnix.com                   | Fingerprint      0570 71CD 6790 7C28 3D60
http://www.starnix.com/            |                  75D2 9EC4 C1C0 0599 13DA