> Tutorials > Callable Library Tutorial > Performing Sensitivity Analysis |
Performing Sensitivity Analysis |
INDEX
![]() |
In Performing Sensitivity Analysis , there is a discussion of how to perform sensitivity analysis in the Interactive Optimizer. As with most interactive features of ILOG CPLEX, there is a direct approach to this task from the Callable Library. This section modifies the example lpex1.c
to show how to perform sensitivity analysis with routines from the Callable Library.
To begin, make a copy of lpex1.c
, and edit this new source file. Among the declarations (for example, immediately after the declaration for dj
) insert these additional declarations:
double *lowerc = NULL, *upperc = NULL; double *lowerr = NULL, *upperr = NULL; |
At some point after the call to CPXlpopt
, (for example, just before the call to CPXwriteprob
), perform sensitivity analysis on the objective function and on the right-hand side coefficients by inserting this fragment of code:
This sample is familiarly known as "throw away" code. For production purposes, you probably want to observe good programming practices such as freeing these allocated arrays at the TERMINATE
label in the application.
A bound value of 1e+20 (CPX_INFBOUND
) is treated as infinity within ILOG CPLEX, so this is the value printed by our sample code in cases where the upper or lower sensitivity range on a row or column is infinite; a more sophisticated program might print a string, such as -inf
or +inf
, when negative or positive CPX_INFBOUND
is encountered as a value.
Similar code could be added to perform sensitivity analysis with respect to bounds via CPXboundsa
.
Copyright © 1987-2003 ILOG, S.A. All rights reserved. Legal terms. | PREVIOUS NEXT |