# [R] Constrined dependent optimization.

rkevinburton at charter.net rkevinburton at charter.net
Mon Mar 30 14:16:08 CEST 2009

```It would in the stictess sense be non-linear since it is only defined for descrete interface values for each variable. And in general it would be non-linear anyway. If I only have three variables which can take on values 1,2,3 then f(1,2,3) could equal 0 and f(2,1,3) could equal 10.

Thank you for the suggestions.

Kevin

---- Paul Smith <phhs80 at gmail.com> wrote:
> On Sun, Mar 29, 2009 at 9:45 PM,  <rkevinburton at charter.net> wrote:
> > I have an optimization question that I was hoping to get some suggestions on how best to go about sovling it. I would think there is probably a package that addresses this problem.
> >
> > This is an ordering optimzation problem. Best to describe it with a simple example. Say I have 100 "bins" each with a ball in it numbered from 1 to 100. Each bin can only hold one ball. This optimization is that I have a function 'f' that this array of bins and returns a number. The number returned from f(1,2,3,4....) would return a different number from that of f(2,1,3,4....). The optimization is finding the optimum order of these balls so as to produce a minimum value from 'f'.I cannot use the regular 'optim' algorithms because a) the values are discrete, and b) the values are dependent ie. when the "variable" representing the bin location is changed (in this example a new ball is put there) the existing ball will need to be moved to another bin (probably swapping positions), and c) each "variable" is constrained, in the example above the only allowable values are integers from 1-100. So the problem becomes finding the optimum order of the "balls".
> >
> > Any suggestions?
>
> If your function f is linear, then you can use lpSolve.
>
> Paul
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help