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 [[alternative HTML version deleted]]
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
[[alternative HTML version deleted]]
______________________________________________
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.
[[alternative HTML version deleted]]
Please cc the list. It's too much trouble for me, but maybe not for someone else. Bert On Feb 15, 2017 6:02 PM, "Brady Richter" <bradyrichter at gmail.com> wrote:> Bert, > > > > I?m 46- I don?t get homework. Just looking for a bit of help getting > started organizing the loop structure, but since it seems to be too much > trouble I will figure it out on my own. > > > > Regards, > > > > Brady > > > > > > *From:* Bert Gunter [mailto:bgunter.4567 at gmail.com] > *Sent:* Wednesday, February 15, 2017 8:47 PM > *To:* Brady Richter <bradyrichter at gmail.com> > *Cc:* R-help <r-help at r-project.org> > *Subject:* Re: [R] New R user- Simple optimization problem > > > > 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 > > > > > > > [[alternative HTML version deleted]] > > ______________________________________________ > 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. > > >[[alternative HTML version deleted]]