Showing posts with label ilog. Show all posts
Showing posts with label ilog. Show all posts

Friday, January 15, 2010

Flex gantt chart project plan v.01

Flex gantt based on the sample code from ilog / elixir. The demo had a bunch of pitfalls, which I’ve tried to overcome

  1. underling data model (collections) are not XML based. Seems to me that adobe relies on the xml data for alot of their proof of concept.
  2. nested set library from pear php to persist the tree in the back end. There was a bit of heavy lifting and I ended up hacking the pear NestedSet.php
  3. support for multiple trees (forest) in the nested set
  4. ilog has bug in the constraints where the constraints do not refresh
  5. highlighting the selected constraint
  6. circular reference cycles in the directed graph using the tarjan algorithm from a previous post
  7. When a parent constraint changes the move.
  8. Database is sync’d for most interactions
  9. supports a templatization, where the dates get bumped to the the current date + 7 for each template, so you can ruse a project.

After a bunch of thought early on, I decided to try to map nodes, constraints and resources with associated reservations to rows in the database. My thinking was to build it this way for a few reasons:

  1. I didn’t want to have a corrupt xml and then have to go through the pain to of debugging it
  2. support for future concurrency. While it’s not in my use case as of now, my thinking was that XML blobs in the database do not lend themselves to collaboration. Of course if I was to go with real time concurrency, I would need to think about a COCOMO option
  3. templates and copying
  4. I didn’t want to get in the situation where a user made bunch of edits and then app failed, or the persistence failed or the javascript saying “you need to save” because you just navigated away.

The real drawback to going away from xml is that there would be a bunch more heavy lifting to import/export to MS Project Plan

As you can tell, I may have chosen poorly.

Monday, December 28, 2009

Finding circular dependencies in Flex/AS3

I was looking for cycles in a directed graph in a task chart implementation I was doing for a client. My implementation of the Tarjan algorithm is hard coded for a linkage of task objects linked by constraints. I’d be interested to find out if anyone else has dug into this algorithm and gotten it to work.

package model.task {
import ilog.gantt.TaskChart;


public class Tarjan {
private var index:int = 0;
private var stack:Array = new Array();
private var SCC:Array = new Array();
public var taskChart:ilog.gantt.TaskChart;

/**
* N.B. Don't forget to reset the *.index = -1 after checking
*
* DJH 12/24/2009 This will only work for task nodes connected by constraints. It does not traverse
* the entire task hierachical data
*
* I don't fully understand but all nodes are treated as loops. Look through the SCC
* array for child arrays which with more than 1 node and those the the cycles.
*
*/
public function tarjan(task:Object /* node */ /*, adjacencyList:Array*/ ):Array {
trace("tarjan():: push task " + task.id);
task.index = index;
task.lowLink = index;
index++;
stack.push(task);
var constraints:Array = taskChart.getFromConstraints(task);
// Collect the successors
if(constraints) {
for each(var c:Object in constraints) {
var toTask:Object = taskChart.getToTask(c);
if(toTask == null) {
// DJH 12/9/2009, fix the constraint does not chain to a successor, so ignore
continue;
}
if(toTask.index == -1) {
tarjan(toTask /*, adjacencyList*/ );
task.lowLink = Math.min(task.lowLink, toTask.lowLink);
} else if(stack.indexOf(toTask) >= 0) {
task.lowLink = Math.min(task.lowLink, toTask.index);
}
}
}
if(task.lowLink == task.index) {
var arr:Array = new Array();
do {
toTask = stack.pop();
arr.push(toTask);
} while(toTask != task)
SCC.push(arr);
}
return SCC;
}
}
}