Re: pert/cpm calculation (was Re: kplato)
Dag Andersen <[email protected]>
| Newsgroups | gmane.comp.kde.kplato |
|---|---|
| Message-ID | <[email protected]> |
Ok, based on what we have discussed I've fleshed out some thoughts. If we separate pert/cpm calculation code from the nodes but allow the code to call the nodes methods, I think the following should be possible. If you want to insulate the code more, we need some sort of interface class. It will depend as much (more?) on your code as on 'kplato' code, I think. What do you think? (I haven't considdered monte carlo or any other distribution methods as I know nothing about it:) (Note that pert_ is prepended for all methods that is only used by pert/cpm calculation) To start calculation: pert_calculate(KPTProject &project, KPTEffort::EffortType effortType); EffortType: Expected, Optimistic, Pessimistic. You'll have to traverse the project to get all the data you need. Then this pert_calculation method will have to call the following: To find out if you shall calculate from a start date or a finish date: direction = project.pert_direction(); To get the duration of a node: node->pert_duration(effortType, direction); The duration is calculated dependent on effort and availability of requested resources. If the task has slack, the duration may not be correct but it should always stay within duration+slack. (Duration will be corrected later on). I plan to allow resource overbooking here (for now?). Then the user can resolve conflicts manually. I'm not sure where to eventually put more advanced resource analysis. To get at the constraints of a node: node->constraint(); If the constraint is ASAP or ALAP; no matter. If it's StartNotEarlier, FinishNotLater, MustStartOn or MustFinishOn you need the time: node->constraintTime(); To set earliestStart/latestFinish: node->setEarliestStart(time); node->setLatestFinish(time); To get a nodes list of child relations: node->dependChildNodes(); To get the relation type: relation->timingRelation(); To get the lag for a relation: relation->lag(); To set errors: node->setError(error); Type of 'error' to be defined... To find out when to start/finish the node (within earliestStart/latestFinish) and to calculate correct duration: node->pert_setStartFinish(); To get the type of node: node->type(); which can be: Type_Project, Type_Subproject, Type_Task, Type_Milestone, Type_Periodic, Type_TerminalNode, Type_Summarytask. Type_TerminalNode I think you will make disappear, Type_Subproject and Type_Periodic are not implemented yet. Type_Project, Type_Subproject, Type_Summarytask can have children. To get a nodes list of children: node->childNodeIterator(); -- Mvh, Dag Andersen