auto_scale

Scales the model.

REAL auto_scale(lprec *lp);

Return Value

auto_scale returns 0 or a negative value if scaling failed, else the meaning scale factor.

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

Remarks

The auto_scale function scales the model according to the scaling method specified with set_scalemode. 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.

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);
  }

  auto_scale(lp);

  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, set_scalemode, get_scalemode, unscale