- void inc_mat_space(Problem lp, int maxextra)
- {
- if(lp.non_zeros + maxextra > lp.mat_alloc)
- {
- int i;
- lp.mat_alloc = lp.non_zeros + maxextra;
- Matrix[] old_mat = lp.mat;
- lp.mat = new Matrix[lp.mat_alloc];
- for (i = old_mat.length; i < lp.mat.length; i++)
- lp.mat[i] = new Matrix(0,0);
- System.arraycopy(old_mat, 0, lp.mat, 0, old_mat.length);
- int[] old_col_no = lp.col_no;
- lp.col_no = new int[lp.mat_alloc];
- System.arraycopy(old_col_no, 0, lp.col_no, 0, old_col_no.length);
- if (lp.active != FALSE)
- {
- Mat=lp.mat;
- Col_no=lp.col_no;
- }
- }
- } // end of inc_mat_space
-
- void inc_row_space(Problem lp)
- {
- if(lp.rows > lp.rows_alloc)
- {
- lp.rows_alloc=lp.rows+10;
- lp.sum_alloc=lp.rows_alloc+lp.columns_alloc;
-
- float[] db_ptr = lp.orig_rh;
- lp.orig_rh = new float[lp.rows_alloc + 1];
- System.arraycopy(db_ptr, 0, lp.orig_rh, 0, db_ptr.length);
-
- db_ptr = lp.rh;
- lp.rh = new float[lp.rows_alloc + 1];
- System.arraycopy(db_ptr, 0, lp.rh, 0, db_ptr.length);
-
- db_ptr = lp.rhs;
- lp.rhs = new float[lp.rows_alloc + 1];
- System.arraycopy(db_ptr, 0, lp.rhs, 0, db_ptr.length);
-
- db_ptr = lp.orig_upbo;
- lp.orig_upbo = new float[lp.sum_alloc + 1];
- System.arraycopy(db_ptr, 0, lp.orig_upbo, 0, db_ptr.length);
-
- db_ptr = lp.upbo;
- lp.upbo = new float[lp.sum_alloc + 1];
- System.arraycopy(db_ptr, 0, lp.upbo, 0, db_ptr.length);
-
- db_ptr = lp.orig_lowbo;
- lp.orig_lowbo = new float[lp.sum_alloc + 1];
- System.arraycopy(db_ptr, 0, lp.orig_lowbo, 0, db_ptr.length);
-
- db_ptr = lp.lowbo;
- lp.lowbo = new float[lp.sum_alloc + 1];
- System.arraycopy(db_ptr, 0, lp.lowbo, 0, db_ptr.length);
-
- db_ptr = lp.solution;
- lp.solution = new float[lp.sum_alloc + 1];
- System.arraycopy(db_ptr, 0, lp.solution, 0, db_ptr.length);
-
- db_ptr = lp.best_solution;
- lp.best_solution = new float[lp.sum_alloc + 1];
- System.arraycopy(db_ptr, 0, lp.best_solution, 0, db_ptr.length);
-
- int[] int_ptr = lp.row_end;
- lp.row_end = new int[lp.rows_alloc + 1];
- System.arraycopy(int_ptr, 0, lp.row_end, 0, int_ptr.length);
-
- short[] short_ptr = lp.basis;
- lp.basis = new short[lp.sum_alloc + 1];
- System.arraycopy(short_ptr, 0, lp.basis, 0, short_ptr.length);
-
- short_ptr = lp.lower;
- lp.lower = new short[lp.sum_alloc + 1];
- System.arraycopy(short_ptr, 0, lp.lower, 0, short_ptr.length);
-
- int_ptr = lp.bas;
- lp.bas = new int[lp.rows_alloc + 1];
- System.arraycopy(int_ptr, 0, lp.bas, 0, int_ptr.length);
-
- db_ptr = lp.duals;
- lp.duals = new float[lp.rows_alloc + 1];
- System.arraycopy(db_ptr, 0, lp.duals, 0, db_ptr.length);
-
- short_ptr = lp.ch_sign;
- lp.ch_sign = new short[lp.rows_alloc + 1];
- System.arraycopy(short_ptr, 0, lp.ch_sign, 0, short_ptr.length);
-
- int_ptr = lp.eta_col_end;
- lp.eta_col_end = new int[lp.rows_alloc + lp.max_num_inv];
- System.arraycopy(int_ptr, 0, lp.eta_col_end, 0, int_ptr.length);
-
- if(lp.names_used != FALSE) {
- String[] str_ptr = lp.row_name;
- lp.row_name = new String[lp.rows_alloc + 1];
- System.arraycopy(str_ptr, 0, lp.row_name, 0, str_ptr.length);
- }
-
- if(lp.scaling_used != FALSE) {
- db_ptr = lp.scale;
- lp.scale = new float[lp.sum_alloc + 1];
- System.arraycopy(db_ptr, 0, lp.scale, 0, db_ptr.length);
- }
-
- if(lp.active != FALSE)
- set_globals(lp);
- }
- }
-
- void inc_col_space(Problem lp)
- {
- if(lp.columns >= lp.columns_alloc)
- {
- int[] int_ptr;
- lp.columns_alloc=lp.columns+10;
- lp.sum_alloc=lp.rows_alloc+lp.columns_alloc;
-
- float[] float_ptr = lp.orig_upbo;
- lp.orig_upbo = new float[lp.sum_alloc + 1];
- System.arraycopy(float_ptr, 0, lp.orig_upbo, 0, float_ptr.length);
-
- float_ptr = lp.upbo;
- lp.upbo = new float[lp.sum_alloc + 1];
- System.arraycopy(float_ptr, 0, lp.upbo, 0, float_ptr.length);
-
- float_ptr = lp.orig_lowbo;
- lp.orig_lowbo = new float[lp.sum_alloc + 1];
- System.arraycopy(float_ptr, 0, lp.orig_lowbo, 0, float_ptr.length);
-
- float_ptr = lp.lowbo;
- lp.lowbo = new float[lp.sum_alloc + 1];
- System.arraycopy(float_ptr, 0, lp.lowbo, 0, float_ptr.length);
-
- float_ptr = lp.solution;
- lp.solution = new float[lp.sum_alloc + 1];
- System.arraycopy(float_ptr, 0, lp.solution, 0, float_ptr.length);
-
- float_ptr = lp.best_solution;
- lp.best_solution = new float[lp.sum_alloc + 1];
- System.arraycopy(float_ptr, 0, lp.best_solution, 0, float_ptr.length);
-
- short[] short_ptr = lp.basis;
- lp.basis = new short[lp.sum_alloc + 1];
- System.arraycopy(short_ptr, 0, lp.basis, 0, short_ptr.length);
-
- short_ptr = lp.lower;
- lp.lower = new short[lp.sum_alloc + 1];
- System.arraycopy(short_ptr, 0, lp.lower, 0, short_ptr.length);
-
- if(lp.names_used != FALSE) {
- int[] str_ptr = lp.col_name;
- lp.col_name = new int[lp.columns_alloc + 1];
- System.arraycopy(str_ptr, 0, lp.col_name, 0, str_ptr.length);
- }
-
- if(lp.scaling_used != FALSE) {
- float_ptr = lp.scale;
- lp.scale = new float[lp.sum_alloc + 1];
- System.arraycopy(float_ptr, 0, lp.scale, 0, float_ptr.length);
- }
-
- int_ptr = lp.col_end;
- lp.col_end = new int[lp.columns_alloc + 1];
- System.arraycopy(int_ptr, 0, lp.col_end, 0, int_ptr.length);
-
- if(lp.active != FALSE)
- set_globals(lp);
- }
- } // end of inc_col_space
-