Skip to content

New R user- Simple optimization problem

2 messages · Brady Richter, Bert Gunter

#
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
1 day later
#
Homework?

If so, we don't do hw here. Otherwise, we usually ask people to show us
their failed coding efforts rather than expecting us to do the problem for
them. Please read and follow the posting guide.

Cheers,

Bert
On Feb 15, 2017 10:25 AM, "Brady Richter" <bradyrichter at gmail.com> wrote:
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







______________________________________________
R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.