Beefy Boxes and Bandwidth Generously Provided by pair Networks Russ
XP is just a number

Schedule Optimization

by eibwen (Friar)
on Jul 14, 2005 at 10:11 UTC ( #474816=perlquestion: print w/ replies, xml ) Need Help??
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.

Comment on Schedule Optimization
Re: Schedule Optimization
by artist (Parson) on Jul 14, 2005 at 11:08 UTC
    If you can give us some sample data, we can try out here.
Re: Schedule Optimization
by SimonClinch (Chaplain) on Jul 14, 2005 at 11:21 UTC
    This is clearly a data modelling problem - even if you do find a module that provides some kind of assistance, it wouldn't be flexible enough to handle those 'other constraints' nor can it remotely address the risk of design change your requirement represents.

    My advice is that before even deciding what to implement in perl or SQL, you need to design and maintain your logical data model (here is a short course and use that to drive what you then build in perl, DDL and/or SQL as your physical implementation.

    At that point you'll have well-definied entities we can look at to advise on how to implement them.

    Your requirement does suggest the event entity would be a parent that owns event-day children (as database tables) but I'd need to see the rest of the requirement to be confident about that - also I don't yet see why you want to use mathematical combinations which are different from the simple multiples concept your requirement so far suggests

    Hope this helps,


    One world, one people

Re: Schedule Optimization
by jimX11 (Friar) on Jul 14, 2005 at 12:33 UTC

    If you implement the behavior in SQL, you may be able to use Test::DatabaseRow to run tests in a perl test suite.

    Here's an overview of testing modules

    I too think sample data would help me better understand your interesting question.

Re: Schedule Optimization
by fglock (Vicar) on Jul 15, 2005 at 03:00 UTC
Re: Schedule Optimization
by thor (Priest) on Jul 15, 2005 at 11:11 UTC
    In addition to what artist said about sample data, it'd also be nice to know what your definition of "optimal" is given said data.


    Feel the white light, the light within
    Be your own disciple, fan the sparks of will
    For all of us waiting, your kingdom will come

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://474816]
Approved by Nevtlathiel
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (9)
As of 2014-04-19 09:15 GMT
Find Nodes?
    Voting Booth?

    April first is:

    Results (480 votes), past polls