Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Locked thread
ShoulderDaemon
Oct 9, 2003
support goon fund
Taco Defender

Is it supposed to return the high-water-mark for total cost of running jobs at any time during the schedule?

Because it doesn't do that. Try with two jobs: the first that starts at 1, ends at 2, and has cost 100; the second that starts at 3 and ends at 4, and has cost 1. The algorithm you posted will return 1.

Adbot
ADBOT LOVES YOU

ShoulderDaemon
Oct 9, 2003
support goon fund
Taco Defender

MrMoo posted:

Yes, I have three very bad options so far and they're not really getting better. The idea with this version is to walk through a sorted list of time events and increment the cost as each job starts and decrement as they end.

Your "max_cost" variable should actually be called "current_total_cost", if that helps. Once you have that, maximizing should be easy.

  • Locked thread