http://www.perlmonks.org?node_id=474816

eibwen has asked for the wisdom of the Perl Monks concerning the following question:

I'm in the preliminary stages of authoring a "schedule optimization" program. Basically, I'd like it to parse a database of recurrent events and compute possible combinations based on date, time, and possibly other constraints.

I've tried both CPAN and google searches with minimal results. Are there any existing codes/modules which might be applicable or perhaps serve a similar function?

There seem to be a variety of modules which might be applicable -- but nothing directly. For example, the mathematical permutation and combination modules seem apt, yet I haven't figured out how to compensate for date spans, particularly for multiday events (eg MWF, TTh, etc).

There are a few alternate possibilities -- try to implement the behavior in SQL or write my own code from scratch. Given a well designed database SQL may be the best choice, but that still leaves the problem of linked events (eg Event B subsequent to Event A).

Even if I were to use SQL, I'm not quite sure how to combine the dates with the Math::Combinatorics.

Lastly, test-driven development seems prudent; however I'm not quite sure which tests are necessary. For example, given the objective, I'd test for time conflicts and verification of other constraints -- but beyond that I'm not sure.