public Linear(Data data) throws IloException, FileNotFoundException {
		
		this.data = data;
		cplex = new IloCplex();
		cplex.setOut(new PrintStream("./solution/" + data.filename + "LP.log"));
		
		//decision variable y (integer)
		y = new IloNumVar[data.nLinks];
		for (int i = 0; i < data.nLinks; i++) {				
			Link link = data.links[i];
			String varName = "y(" + link.sNode + "," + link.tNode + ")";
			y[i] = cplex.numVar(0, link.capacity, varName);
		}
		
		//flow cost
		IloLinearNumExpr cost = cplex.linearNumExpr();
		for (int i = 0; i < data.nLinks; i++) {
			Link link = data.links[i];
			cost.addTerm(link.unitCost, y[i]);
		}
		cplex.addMinimize(cost);
		
		//flow conservation constraints
		for (int n = 0; n < data.nNodes; n++) {
			Node node = data.nodes[n];
			IloLinearNumExpr constFlow = cplex.linearNumExpr();
			for (int i = 0; i < data.nLinks; i++) {
				Link link = data.links[i];
				if (node.label == link.sNode) {
					constFlow.addTerm(1, y[i]);						
				} else if (node.label == link.tNode) {
					constFlow.addTerm(-1, y[i]);						
				}
			}
			cplex.addEq(constFlow, node.demand);
		}
		
	}