set_scalemode

Specifies which scaling algorithm must be used.

void set_scalemode(lprec *lp, short scalemode);

Return Value

set_scalemode has no return value.

Parameters

lp

Pointer to previously created lp model. See return value of make_lp, copy_lp, read_lp, read_lp_file, read_LP, read_mps, read_MPS

scalemode

Specifies which scaling algorithm must be used. Can by any of the following values:

MMSCALING (0) numerical range-based scaling
GEOSCALING (1) geometric mean scaling
CURTISREIDSCALE (4) Curtis-Reid scaling

Additionally, the value can be OR-ed with any combination of one of the following values:

POWERSCALE (2) also do Lagrange scaling
LAGRANGESCALE (8) also do Lagrange scaling
INTEGERSCALE (16) also do Integer scaling

Remarks

The set_scalemode function specifies which scaling algorithm must be used. This can influence numerical stability considerably. It is advisable to always use some sort of scaling.
The default is MMSCALING (0). However, scaling is only applied when auto_scale is explicitly called. set_scalemode must be called before auto_scale is called if another scalemode is required.
MMSCALING, GEOSCALING, CURTISREIDSCALE are the possible scaling algorithms. POWERSCALE, LAGRANGESCALE, INTEGERSCALE are possible additional scaling parameters.
POWERSCALE results in creating a scalar of power 2. May improve stability.
LAGRANGESCALE results also in scaling Lagrange columns. Default they are not scaled.
INTEGERSCALE results also in scaling Integer columns. Default they are not scaled.

Example

#include <stdio.h>
#include <stdlib.h>
#include "lpkit.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_scalemode(lp, CURTISREIDSCALE);

  delete_lp(lp);
  return(0);
}

lp_solve API reference

See Also make_lp, copy_lp, read_lp, read_lp_file, read_LP, read_mps, read_MPS, get_scalemode, auto_scale