On line optimal dispatch: a knowledge based approach