help-glpk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Help-glpk] new API suggestion : report scaling ratio


From: Robbie Morrison
Subject: [Help-glpk] new API suggestion : report scaling ratio
Date: Tue, 10 May 2011 20:36:01 +1200 (NZST)
User-agent: SquirrelMail/1.4.17

Hello Andrew and API users

I would like to recover and report the current scaling
ratio (defined below) for the as-scaled constraint
matrix, whenever the solver and/or my application hits
problems.

I guess I could use a mix of 'glp_get_num_cols'
'glp_get_mat_row' and 'glp_get_rii' and write my own
routine to do this.  Although I haven't tried this yet.

But would it be simpler to expose the current scaling
ratio thru a new API?  I rather suspect that the
underlying functionality exists in GLPK?  Something
like this, perhaps:

  ---------------------------------
   API suggestion : glp_get_scale_ratio
  ---------------------------------

  While users can easily calculate the scaling ratio
  (defined below) from their raw data (assuming they
  still have it), this (suggested) call would allow
  users to readily access that same information for the
  internally scaled version of their problem.

  Just one design question that I do not have an answer
  to: does GLPK know when the current scaling is stale?

    2.5.8  Recover scaling ratios

    Synopsis

        double glp_get_scale_ratio(glp_prob *lp, int scaled);

    Description

        The routine 'glp_get_scale_ratio' returns the
        current scaling ratio 's' for the constraint
        matrix, defined thus

             s = max|a_ij| / min|a_ij|

        If the parameter 'scaled' is zero, the
        original, unscaled LP problem is used.
        Otherwise, if the parameter scaled is non-zero,
        the routine uses the internally scaled LP
        problem.

        If the scaled problem is selected, the caller
        is responsible for ensuring that the scaling is
        indeed current.  That may require a prior call
        to 'glp_scale_prob'.

        If the problem is empty, zero is returned
        (a value not otherwise possible).

    Returns

        The routine 'glp_get_scale_ratio' returns the
        current scaling ratio, or zero if the problem
        is empty.

    Abnormal states

        This routine does not specifically identify
        abnormal states or issue warning messages.

        OR

        This routine requires that the problem has been
        recently scaled (see section on Problem
        scaling) if 'scaled' is non-zero.  If the
        current scaling is stale, the routine returns
        minus one and issues a warning message.

On that same theme, GLPSOL could offer a --summarize
(or --extended-check or --problem-metrics) option that,
after applying the default scaling, reports the
original and scaled scale ratios.  It could also be
influenced by the option --noscale (and such).  It
could also output any other problem-side information
deemed useful and not covered by --check, including,
for instance, the problem class and the variable type
counts.  Hence:

  --summarize       do not solve problem, check input data, apply
                    scaling, and report generally (implies --check)

This GLPSOL option is not something I am pushing for,
however.  :)

I am happy to modify the GLPK codebase and submit code
and documentation patches for 'glp_get_scale_ratio',
if that would help.

Alternatively, a pointer about the feasibility of
writing my own routine (as suggested at the start)
would also be useful.

all the best
Robbie
---
Robbie Morrison
PhD student -- policy-oriented energy system simulation
Technical University of Berlin (TU-Berlin), Germany
University email (redirected) : address@hidden
Webmail (preferred)           : address@hidden
[from Webmail client]





reply via email to

[Prev in Thread] Current Thread [Next in Thread]