# [R] Linear programming question

Wed Jul 18 20:11:58 CEST 2007

```Tobias,

Just a clarification/correction to my solution: it makes no difference
whether A and B are positive or negative.  The minimum of S1+S2-S3-S4 is
always -2(A+B).

Ravi.

----------------------------------------------------------------------------
-------

Assistant Professor, The Center on Aging and Health

Division of Geriatric Medicine and Gerontology

Johns Hopkins University

Ph: (410) 502-2619

Fax: (410) 614-9625

Email: rvaradhan at jhmi.edu

----------------------------------------------------------------------------
--------

-----Original Message-----
From: r-help-bounces at stat.math.ethz.ch
[mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Ravi Varadhan
Sent: Wednesday, July 18, 2007 1:52 PM
To: 'Tobias Schlottmann'; r-help at stat.math.ethz.ch
Subject: Re: [R] Linear programming question

Tobias,

Adding the first constraints yields:
S1 + S2 >= -2A

Similarly adding the second set of constraints:
S3 + S4 <= 2B

If A and B are positive (which you didn't specify) then
The minimum of S1+S2 is -2A, and the maximum of S3+S4 is 2B.

Thus, the minimum of S1+S2-S3-S4 is -2(A+B).

Ravi.

----------------------------------------------------------------------------
-------

Assistant Professor, The Center on Aging and Health

Division of Geriatric Medicine and Gerontology

Johns Hopkins University

Ph: (410) 502-2619

Fax: (410) 614-9625

Email: rvaradhan at jhmi.edu

----------------------------------------------------------------------------
--------

-----Original Message-----
From: r-help-bounces at stat.math.ethz.ch
[mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Tobias Schlottmann
Sent: Wednesday, July 18, 2007 1:24 PM
To: r-help at stat.math.ethz.ch
Subject: [R] Linear programming question

Hi everybody,
consider please an optimization problem:

minimize   sum S1+S2

Subject to :  y - x =< A + S1
x - y =< A + S2

and we want to add two more constraints:

y - x =< B - S3
x - y =< B - S4

where A is a small constant value and B is a large constant value, S1 and
S2 are surplus and S3 and S4 are slack variables.

S3 and S4 have to be maximized in objective function. As objective
function, is this correct?  :

minimize sum S1+ S2 - S3 -S4

where actually we want to minimize S1 and S2; and maximize S3 and S4.

If it is not correct, what to do ?

Thank you for any guide.

Tobias

---------------------------------

[[alternative HTML version deleted]]

______________________________________________
R-help at stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

______________________________________________
R-help at stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

```