set_scaling

Specifies which scaling algorithm must be used.

void set_scaling(lprec *lp, int scalemode);

Return Value

set_scaling has no return value.

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

scalemode

Specifies which scaling algorithm must be 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

Remarks

The set_scaling function specifies which scaling algorithm must be 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;

  /* Create a new LP model */
  lp = make_lp(0, 0);
  if(lp == NULL) {
    fprintf(stderr, "Unable to create new LP model\n");
    return(1);
  }

  set_scaling(lp, CURTISREIDSCALE);

  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, get_scaling, is_integerscaling, is_scalemode, is_scaletype