Results 1 to 4 of 4
 11022011, 10:09 PM #1Member
 Join Date
 Apr 2011
 Posts
 18
 Rep Power
 0
Need help with weighted interval scheduling problem.
This is what I have for my program so far.
Java Code:import java.io.File; import java.io.FileNotFoundException; import java.util.Arrays; import java.util.Scanner; public class WeightedIntervalScheduling { public static void main(String[] args) throws FileNotFoundException { int i,j; String FileName; FileName = "Intervals.txt"; File f = new File(FileName); Scanner fileIn = new Scanner(f); int[] Start = new int[100]; int[] Finish = new int[100]; int[] Weight = new int[100]; i = 0; while (fileIn.hasNext()) { Start[i] = fileIn.nextInt(); Finish[i] = fileIn.nextInt(); Weight[i] = fileIn.nextInt(); i++; } i = 0; while (i < 9){ System.out.println(Start[i] + ", " + Finish[i] + ", " + Weight[i]); i++; } //just input int Jobs[] = new int[8]; j=0; i=0; while(i!=7){ Jobs[i] = i; i++;} int M[] = new int[8]; int p[] = new int[8]; i=0; j=0; while(j!=8){ i=0; while(i!=8){ if(Start[j] >= Finish[i]){ p[j]=Math.max(Finish[i], Start[j]); } i++; } j++; } j=0; while(j<=7){ if(j==0){M[j] = 0;} if(j>0){M[j]= Math.max(Weight[j]+ Weight[p[j]], M[j1]);} j++; } System.out.println(Arrays.toString(p)); System.out.println(Arrays.toString(M)); System.out.println("Optimal Value: " + p[7]); } }
 11032011, 01:13 PM #2
 Join Date
 Sep 2008
 Location
 Voorschoten, the Netherlands
 Posts
 14,311
 Blog Entries
 7
 Rep Power
 24
Re: Need help with weighted interval scheduling problem.
Can you describe the problem you're trying to solve? (not your implementation (it doesn't work as it is now) ;)
kind regards,
JosThe only person who got everything done by Friday was Robinson Crusoe.
 11082013, 05:31 PM #3Member
 Join Date
 Nov 2013
 Posts
 1
 Rep Power
 0
Re: Need help with weighted interval scheduling problem.
I've written an explanation of the problem, its complexity analysis and provided C++ code here: Weighted Interval Scheduling Problem  Everything Under The Sun
 11082013, 05:44 PM #4Just a guy
 Join Date
 Jun 2013
 Location
 Netherlands
 Posts
 5,114
 Rep Power
 9
Similar Threads

Generate weighted random numbers, nextGaussian ()
By graympa in forum New To JavaReplies: 2Last Post: 03252011, 10:36 PM 
Scheduling problem with FCFS/FIFO
By ShutUpAndExplode in forum New To JavaReplies: 7Last Post: 04262010, 05:45 PM 
weighted GPA
By cheekee.monkee in forum New To JavaReplies: 3Last Post: 12032009, 08:01 PM 
need info on running thread during a particular time interval alone
By karthikeyan_raju in forum Threads and SynchronizationReplies: 2Last Post: 10062009, 02:40 AM 
Scheduling a task
By bugger in forum Advanced JavaReplies: 3Last Post: 12042007, 01:32 PM
Bookmarks