January 19th, 2011, 9:59 am
I'm working on a R optimazation but am a bit hindered by the fact that I'm not that good with R and haven't done a proper optimization for two years.First off does any one know any good reference material with explicit detailed examples for R optimization that works for a rather complex function and numerous restrictions. Simplex might work though, not quite sure atm.Secondly how would you approach something like this: I have a set of items with 3 category labels, 1 binary variable for +/- values, 1 numeric value. The solution needs to be a set of numerbers for one of the categories where they are split for the +/- binary so that you have two solveable numbers for each category.Might make more sense with the data like this:Items:Item, Category 1, Category 2, Category 3, IsPlus, NumberNR1, Colour, Red, Ball, 1, 0.1NR2, Colour, Red, Jacket, 0, 0.2NR3, Colour, Red, Pen, 1, 0.2NR4, Colour, Blue, Ball, 1, 0.2NR5, Colour, Blue, Pen, 0, 0.1NR6, Soda, Red, Ball, 1, 0.2NR7, Soda, Blue, Ball, 0, 0.5So basically any permutation of the categories is possible and the items are unique on the IsPlus they can only be either plus or minus. Numbers are only a factor of the item.I need to optimize based on category 2 and whether it's plus or minus. So let's say all Reds that have IsPlus==1 get one number, all Reds that have IsPlus==2 have another.So the x is something like:Category 2,PlusValue,MinusValueRed,0.1234,0.2345Blue,0.3456,0.4567My restrictions are: - The sum of (abs(PlusValue-MinusValue)) for Category 1 must be less than a%- The sum of (abs(PlusValue-MinusValue)) for Category 2 must be less than b%- The sum of (abs(PlusValue-MinusValue)) for Category 3 must be less than c%- The sum of (abs(PlusValue*Number-MinusValue*Number)) must be less than d%- The sum of (abs(PlusValue+MinusValue)) independant of Category must be less than e%- The sum of (abs(PlusValue-MinusValue)) independant of Category must be less than f%- x values can only be between g% and h%Each Category 2 can be mapped to a single Category 1 so that can simplify things for the restriction matrix but since each category 2 maps to multiple category 3 values there is a problem. I can easily figure out most of the stuff except for that one to many relationship.Anyone have any ideas as to how this would work?