Algorithms for deterministic and stochastic project scheduling problems