get_scaling
Specifies which scaling algorithm is used.
int get_scaling(lprec *lp);
Return Value
get_scaling returns which scaling algorithm is used. Can by any of the
following values:
SCALE_EXTREME (1) |
Scale to convergence using largest absolute value |
SCALE_RANGE (2) |
Scale based on the simple numerical range |
SCALE_MEAN (3) |
Numerical range-based scaling |
SCALE_GEOMETRIC (4) |
Geometric scaling |
SCALE_CURTISREID (7) |
Curtis-reid scaling |
Additionally, the value can be OR-ed with any combination of one of the
following values:
SCALE_QUADRATIC (8) |
? |
SCALE_LOGARITHMIC (16) |
Scale to convergence using logarithmic mean of all values |
SCALE_USERWEIGHT (31) |
User can specify scalars |
SCALE_POWER2 (32) |
also do Power scaling |
SCALE_EQUILIBRATE (64) |
Make sure that no scaled number is above 1 |
SCALE_INTEGERS (128) |
also scaling integer variables |
Parameters
lp
Pointer to previously created lp model. See return value of
make_lp, read_lp,
read_LP, read_lpt, read_LPT, read_mps, read_freemps, read_MPS, read_freeMPS, read_XLI
Remarks
The get_scaling function returns which scaling algorithm is used. This
can influence numerical stability considerably. It is advisable to always use
some sort of scaling.
set_scaling must be called before
solve is called.
SCALE_EXTREME, SCALE_RANGE, SCALE_MEAN, SCALE_GEOMETRIC, SCALE_CURTISREID are
the possible scaling algorithms. SCALE_QUADRATIC, SCALE_LOGARITHMIC,
SCALE_USERWEIGHT, SCALE_POWER2, SCALE_EQUILIBRATE, SCALE_INTEGERS are possible
additional scaling parameters.
SCALE_POWER2 results in creating a scalar of power 2. May improve stability.
SCALE_INTEGERS results also in scaling Integer columns. Default they are not
scaled.
Example
#include <stdio.h>
#include <stdlib.h>
#include "lp_lib.h"
int main(void)
{
lprec *lp;
int scalemode;
/* Create a new LP model */
lp = make_lp(0, 0);
if(lp == NULL) {
fprintf(stderr, "Unable to create new LP model\n");
return(1);
}
scalemode = get_scaling(lp); /* Will return 0 */
delete_lp(lp);
return(0);
}
lp_solve API reference
See Also make_lp,
read_lp, read_LP, read_lpt, read_LPT, read_mps,
read_freemps, read_MPS, read_freeMPS, read_XLI, set_scaling,
set_scalelimit, get_scalelimit, is_integerscaling, is_scalemode, is_scaletype
|