[Haskell-cafe] Re: Generalizing three programs

apfelmus at quantentunnel.de apfelmus at quantentunnel.de
Mon Feb 5 11:19:23 EST 2007

Andrew Wagner wrote:
> Hi everyone,
> I've got an interesting problem here I'm trying to solve. Actually,
> I've got several problems which seem to have a very similar structure.
> I want to find a way to abstract them to solve other problems which
> can be thought about in the same way. Here they are:
> http://hpaste.org/307
> http://hpaste.org/308
> http://hpaste.org/309
> Note that these are just sketches, the programs aren't done yet. The
> general structure of the problem is that an object enters a system,
> interacts with different parts of the system, and eventually leaves,
> and we want to monitor some statistics about the interaction, so that
> we can then make some changes, and run it again, and hopefully improve
> it. Thanks in advance for any suggestions!

I'm unsure whether it's a good idea to simulate the situations, I'd
prefer a more denotational approach. To that extend,


may help. Also, I think that in all three problems, the interesting
probability distributions (like the time a random customer has to wait
at the register) - perhaps depending on a chosen scheduling strategy -
can be calculated without sampling. At least, the sampling can be
integrated transparently into the probabilistic functional programming
framework cited above.

Besides, it's not specified what "efficiency" means in the grocery store
problem. The mean time a customer has to wait is not the only possible
cost measure. Customers have different "processing" times and one could
weight mean wait time with that, so that people buying few stuff have
much shorter waiting times than people with several full shopping carts.


More information about the Haskell-Cafe mailing list