get_scaling

# 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_NONE (0) | No scaling
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
SCALE_DYNUPDATE (256) | dynamic update
SCALE_ROWSONLY (512) | scale only rows
SCALE_COLSONLY (1024) | scale only columns
Parameters lp Pointer to previously created lp model. See return value of make_lp, copy_lp, read_lp, read_LP, 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. SCALE_DYNUPDATE is new from version 5.1.1.0 It has always been so that scaling is done only once on the original model. If a solve is done again (most probably after changing some data in the model), the scaling factors aren't computed again. The scalars of the original model are used. This is not always good, especially if the data has changed considerably. One way to solve this was/is call unscale before a next solve. In that case, scale factors are recomputed. From version 5.1.1.0 on, there is another way to make sure that scaling factors are recomputed and this is by settings SCALE_DYNUPDATE. In that case, the scaling factors are recomputed also when a restart is done. Note that they are then always recalculated with each solve, even when no change was made to the model, or a change that doesn't influence the scaling factors like changing the RHS (Right Hand Side) values or the bounds/ranges. This can influence performance. It is up to you to decide if scaling factors must be recomputed or not for a new solve, but by default it still isn't so. It is possible to set/unset this flag at each next solve and it is even allowed to choose a new scaling algorithm between each solve. Note that the scaling done by the SCALE_DYNUPDATE is incremental and the resulting scalars are typically different from scalars recomputed from scratch. The default is SCALE_GEOMETRIC + SCALE_EQUILIBRATE + SCALE_INTEGERS (196). 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);

      delete_lp(lp);
      return(0);
    }
lp_solve API reference See Also make_lp, copy_lp, read_lp, read_LP, read_mps, read_freemps, read_MPS, read_freeMPS, read_XLI, set_scaling, set_scalelimit, get_scalelimit, is_integerscaling, is_scalemode, is_scaletype