Re: [R] Non-linearly constrained optimisation

From: Stuart Nettleton <>
Date: Sun, 20 Jul 2008 13:03:14 +1000

Your issue seems to be a common one at present. While I am relatively new to R (and would welcome being corrected), I haven't been able to find an existing module to parse algebraic equations and build acyclic networks (for the objective function and each constraint) to submit to solving routines (such as optim, BB, Patrick Burns' genopt from S Poetry, Algencan etc). Certainly there are the components to build one, for example topological sort packages like mathgraph and Carter Butts' network. I have implemented acyclic networks in three major projects and so I have started to contemplate the missing package in both R and Mathematica. At this point I am significantly further advanced in Mathematica, building from Eric Swanson's excellent perturbationAIM package. Yet it seems slightly odd to me that the required functionality hasn't been developed in R up to this point in time. Many people need this functionality, the network algorithms have been around for forty years and there are many solvers, even open source ones like ipopt. Of course, the "big guns" in this field are GAMS and AMPL and it is perhaps their overwhelming presence or respect for the developers of these packages that has led R developers to be somewhat cautious about releasing code in this area. However, there are already alternatives. For a quasi open source version of AMPL you could use Dr Ampl ( ) or write your problem in GAMS or AMPL format and submit to the Neos server either directly ( or by using ( I really hope this gets worked out in R at some stage!

On Sun, 20 Jul 2008 08:10:35 +1000, <> wrote:

> Dear R Users,
> I am looking for some guidance on setting up an optimisation in R with
> non-linear constraints.
> Here is my simple problem:
> - I have a function h(inputs) whose value I would like to maximise
> - the 'inputs' are subject to lower and upper bounds
> - however, I have some further constraints: I would like to constrain the
> values for two other separate function f(inputs) and g(inputs) to be
> within
> certain bounds
> This means the 'inputs' must not only lie within the bounds specified by
> the 'upper' and 'lower' bounds, but they must also not take on values
> such
> that f(inputs) and g(inputs) take on values outside defined values. h, f
> and g are all non-linear.
> I believe constroptim would work if f and g were linear. Alas, they are
> not. Is there any other way I can achieve this in R ?
> Thanks in advance,
> Tolga
> Generally, this communication is for informational purposes only
> and it is not intended as an offer or solicitation for the purchase
> or sale of any financial instrument or as an official confirmation
> of any transaction. In the event you are receiving the offering
> materials attached below related to your interest in hedge funds or
> private equity, this communication may be intended as an offer or
> solicitation for the purchase or sale of such fund(s). All market
> prices, data and other information are not warranted as to
> completeness or accuracy and are subject to change without notice.
> Any comments or statements made herein do not necessarily reflect
> those of JPMorgan Chase & Co., its subsidiaries and affiliates.
> This transmission may contain information that is privileged,
> confidential, legally privileged, and/or exempt from disclosure
> under applicable law. If you are not the intended recipient, you
> are hereby notified that any disclosure, copying, distribution, or
> use of the information contained herein (including any reliance
> thereon) is STRICTLY PROHIBITED. Although this transmission and any
> attachments are believed to be free of any virus or other defect
> that might affect any computer system into which it is received and
> opened, it is the responsibility of the recipient to ensure that it
> is virus free and no responsibility is accepted by JPMorgan Chase &
> Co., its subsidiaries and affiliates, as applicable, for any loss
> or damage arising in any way from its use. If you received this
> transmission in error, please immediately contact the sender and
> destroy the material in its entirety, whether in electronic or hard
> copy format. Thank you.
> Please refer to for
> disclosures relating to UK legal entities.
> ______________________________________________
> mailing list
> PLEASE do read the posting guide
> and provide commented, minimal, self-contained, reproducible code.


DISCLAIMER: This email message and any accompanying atta...{{dropped:10}}

______________________________________________ mailing list
PLEASE do read the posting guide
and provide commented, minimal, self-contained, reproducible code.
Received on Sun 20 Jul 2008 - 03:08:45 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sun 20 Jul 2008 - 04:31:53 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive