[Top][All Lists]

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

[Help-glpk] Error handling in Rglpk

From: Heinrich Schuchardt
Subject: [Help-glpk] Error handling in Rglpk
Date: Tue, 17 Feb 2015 19:49:04 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.4.0

Hello Stefan,

currently Rglpk will cause the R process to be terminated if an error
occurs in the GLPK library.

You can use the following GMPL file (test.mod) for testing:

var x, >=0;
minimize obj : x + 5;

Now start R and

x <- Rglpk_read_file( "/home/user/test.mod", type = "MathProg", verbose
Rglpk_solve_LP(x$objective, x$constraints[[1]], x$constraints[[2]],
x$constraints[[3]], x$bounds, x$types, x$maximum)

The GLPK library detects that the problem has no constraint and
terminates the R process.

I have patched the sources such that an error is correctly handled.
See appendix.

Rglpk_solve and Rglpk_read_file call
glp_error_hook(Rglpk_error_hook, &env);

This sets the hook function to Rglpk_error_hook.

A far jump is used to return if an error occurs.

Best regards

Heinrich Schuchardt

Attachment: Rglpk.tar.gz
Description: GNU Zip compressed data

reply via email to

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