New R user- Simple optimization problem

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

New R user- Simple optimization problem

Brady Richter
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]]

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: New R user- Simple optimization problem

Bert Gunter-2
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" <[hidden email]> 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]]

______________________________________________
[hidden email] 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]]

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: New R user- Simple optimization problem

Bert Gunter-2
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" <[hidden email]> 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:[hidden email]]
> *Sent:* Wednesday, February 15, 2017 8:47 PM
> *To:* Brady Richter <[hidden email]>
> *Cc:* R-help <[hidden email]>
> *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" <[hidden email]> 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]]
>
> ______________________________________________
> [hidden email] 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]]

______________________________________________
[hidden email] 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.