help-glpk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Help-glpk] Solve then add rows then presolve: Can I maintain basis?


From: Joey Rios
Subject: [Help-glpk] Solve then add rows then presolve: Can I maintain basis?
Date: Thu, 26 Jun 2008 15:18:56 -0700

I am doing something like this with glpk-4.23:

lp = lpx_read_cpxlp("../prob.cplex");
glp_create_index(lp);
glp_simplex(lp, simplex_control_params);

for(i = 0; i < 40; i++ ) {
        printf("Iteration %d\n", i);
        add_rows(lp, buffer, index, value, col_status, subprob);
        printf("Added rows...\n");
        simplex_control_params->meth = GLP_DUALP;
        simplex_control_params->presolve = GLP_ON;
        glp_simplex(lp, simplex_control_params);
}

Where my "add_rows" function does something like this:

for( i = 1; i <= glp_get_num_cols(lp); i++ )
        col_status[i] = glp_get_col_stat(lp, i);

count = 0;
do {
    row = glp_add_rows(lp, 1);
    read a row from another file and parse it to set ind and val arrays...
    glp_set_row_bnds...
    glp_set_mat_row(lp, row, 2, ind, val);
} while(++count < n );

for( i = 1; i <= glp_get_num_cols(lp); i++ )
        glp_set_col_stat(lp, i, col_status[i]);


If I keep the presolver on, the basis information from the previous solve is lost and the 2-phase primal algorithm kicks off from scratch (instead of the dual simplex using the previous basis).  If I turn the presolver off, I know my problem is bigger than it needs to be, but the dual simplex does kick in starting with the previously optimal basis.  So I guess my question is:  is there a way to use the presolver AND supply an initial basic solution?  If not, is there a mathematical/algorithmic reason this isn't possible?   If so, I'd be interested in hearing it because it will probably change my approach (and understanding) of my problem.  My understanding from the glpk code is that the presolver uses a copy of the original problem to perform all of it transformations and then the solution to the presolved problem is translated back to the original problem when the simplex completes.  This transformation must interfere with any basis that the original problem had, thus eliminating it I suppose?  Hope all of these questions make sense.

I'll gladly supply more info if it's helpful.  Thanks in advance for any insights.



Earn cashback on your purchases with Live Search - the search that pays you back! Learn More

reply via email to

[Prev in Thread] Current Thread [Next in Thread]