Hi, I have a very large cplex model and adding constraints one by one by cplex.addLe or cplex.addGe results in consuming a lot of time in building the model. Is there anyway by which i can speed up the process. I saw a way of doing this in C++ by using IloRangeArray but not sure how can I do that in Java. Thanks asked 24 Nov '14, 04:00 Meghna 
I am not a CPLEX expert, but usually there's a cache scheme going in the solver API. This will allow the user to do some inefficient things building the model and still be OK in terms of performance. That being said, it's hard to cover all possible "less smart" ways of inputting data :) Often changing the dimension of the problem can be difficult to cache efficiently, since a lot of internal structures like matrix, bound data etc possibly need to change dimension too. In your case, I would try to specify a number of empty constraints and variables in advance, then fill in the data one by one should be OK (I think). answered 24 Nov '14, 04:11 Bo Jensen ♦ I am not sure if I understand your solution correctly. I want to reduce the time it takes in building the model not the time it takes to solve the model.
(24 Nov '14, 04:48)
Meghna
Yes, but you add constraints one by one, which could be a potential performance issue in terms of building themodel. I tried to explain why that might be a bad idea. So instead add in larger bulks, even if you don't know the data at that point in time, then fill the correct data in as needed later.
(24 Nov '14, 05:03)
Bo Jensen ♦
Thanks...that is what I am trying to find out how can I add constraints in bulk when using cplex with java.
(24 Nov '14, 05:14)
Meghna

addRows public int addRows(double[] lb, double[] ub, int[][] ind, double[][] val) throws IloException Adds a set of new rows to LP matrix. The rows being added are represented in sparse matrix notation. That is, the nonzero coefficients of the new rows are given as arrays of column indices and corresponding arrays of values. Each pair of corresponding arrays must match in length. For each of the added rows, a new range constraint is implicitly constructed. The lower and upper bound value of the ith newly created range constraint are provided in the arguments lb[i] and ub[i]. Its expression is the scalar product of the values specified in the array val[i] and the variables corresponding to the columns specified in the array ind[i]. Parameters: lb  An array of double values containing the lower bounds for the range constraints to be created and added as rows to the invoking LP matrix. ub  An array of double values containing the upper bounds for the range constraints to be created and added as rows to the invoking LP matrix. ind  An array or arrays of column indices for the nonzeros of the new rows. An index must appear at most one time for each new row and must be in the range 0 through getNcols()1. val  An array or arrays of the corresponding values of the nonzeros of the rows to be added. Returns: The row index of the first new row. Throws: IloException answered 24 Nov '14, 05:29 Bo Jensen ♦ 