[R] Constrined dependent optimization.

Paul Smith phhs80 at gmail.com
Mon Mar 30 12:41:18 CEST 2009


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




More information about the R-help mailing list