# Sensitivity analysis of linear program with coin-or clp

I have written a short example to run the simplex algorithm with coin-or Clp, something quite simple like this:

ClpSimplex solver;
solver.initialSolve();
if(solver.isProvenOptimal()) {
int ncol = solver.getNumCols();
const double *solution = solver.getColSolution();
for(int i=0; i<ncol; i++) {
printf("%f ", solution[i]);
}
printf("\n");
}
if(solver.isAbandoned())
printf("Numerical problems found\n");
if(solver.isProvenPrimalInfeasible())
printf("Primal Infeasible\n");
if(solver.isProvenDualInfeasible())
printf("Dual Infeasible\n");


Now that I have the solution, I would like to do sensitivity analysis that is to say, change the objective function and/or the second member and then check whether the same basis is still optimum or not (of course not restarting from scratch!!)

Is coin-or Clp able to do that and how ? If not, do you know another free LP solver which can make it ?

• Welcome to SciComp.SE! To format code, you need to indent by four spaces. (I have also removed the "thanks", since thanking someone on StackExchange is best done via upvotes and accepting answers.) Jun 21 '13 at 14:40

Any linear programming solver should be able to give you sensitivity information. The information you'll need for assessing the sensitivity to changes in the cost vector is the reduced cost vector and the simplex tableau. You should be able to get the reduced cost information from a call to solver.getReducedCost() (for the reduced cost; uses nomenclature from your example program).
Although the simplex tableau should be available directly, it is not. You will need to use calls to solver.getColumnStatus(j) (to determine whether or not $x_{j}$ is a basic variable). Once you know the basic variables -- they will have values of ClpSimplex::basic -- you can calculate the simplex tableau explicitly from this information.