Skip to content
Prev 367163 / 398506 Next

New R user- Simple optimization problem

Hi I am learning R currently and I having trouble structuring a program.

 

Data consists of 1 data frame with a day of the week, a class list, and a
utility score.

 

Date                   Class                   Utility

 

Monday              Chem                  85

Monday              Physics               75

Tuesday              Chem                  95

Tuesday              Math                  93

Tuesday              History               87

Tuesday              Language           86

 

And so on through Friday.

 

I want to maximize total utility (the sum) given 2 constraints:

 

1.	The number of classes you must take each day is fixed. (Must take 1
class on Monday, 2 on Tuesday, 1 on Wednesday etc.)
2.	No repeats- You can only take any given class zero or one time.  

 

Any help to go about this would be appreciated.

 

Thank you.

 

bhr