/**
 * This class holds all the data.
 * 
 * Ref.: Lozano, L. and Smith, J. C. (2014). 
 * A Backward Sampling Framework for Interdiction Problems with Fortification
 * 
 * @author L. Lozano & J. C. Smith
 * @affiliation Clemson University
 * @url www.leo-loza.com
 * 
 */
package backwardAlgorithm;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.Random;
import java.util.StringTokenizer;


public class DataHandler {
	// Time horizon
	public static int T;
	// Demand
	public static int[] demand;
	// Capacity
	public static int[] cap;
	// Holding cost
	public static double[] h;
	// Production cost
	public static double[] c;
	// Setup cost
	public static double[] f;
	// Shortage cost
	public static double[] q;
		
	public static int dBudget;
	public static int aBudget;
	
	Random r;
	
	// Read data from an instance
	public DataHandler(int time) {
		T = time;
		demand = new int[T];
		cap= new int[T];
		h= new double[T];
		c= new double[T];
		f= new double[T];
		q= new double[T];
		dBudget = 0;
		aBudget = 0;
	}

	public void createRandomInstance(int seed) {
		r = new Random(seed);
		
		for (int i = 0; i < T; i++) {
			demand[i] = 10+r.nextInt(201);
			cap[i] = 150+r.nextInt(51);
			h[i] = Math.round((0.3+r.nextInt(20)/100.0)*100)/100.0;
			c[i] = 5+r.nextInt(6);
			f[i] = 44+r.nextInt(21);
			q[i]=2*c[i]+r.nextInt((int) (c[i]+1));
			//System.out.println(demand[i]+" "+cap[i]+" "+h[i]+" "+c[i]+" "+" "+f[i]+" "+q[i]);
		}
		
	}

		


}

