optimization - R programming: how to choose a combination of a factor with varying numbers, with constraints and then optimize? -


i want every combination of team price < x data format looks like:

       position              name salary           gameinfo avgpointspergame   1       wr       julio jones   9300 phi@atl 07:10pm et           21.293   2       wr odell beckham jr.   9200 nyg@dal 08:30pm et           26.417   3       wr  demaryius thomas   9100 bal@den 04:25pm et           22.812   4       wr        dez bryant   8700 nyg@dal 08:30pm et           19.033   5       qb     aaron rodgers   8600  gb@chi 01:00pm et           23.428   6       wr    calvin johnson   8500  det@sd 04:05pm et           18.229 

let's team consist of 1 qb, 3 wr, 2rb, , flx. there package me select these combinations data set? or perhaps ideas should into. want direction not solution.

i thinking optimization constraints correct way going this, honest have no idea.

the constraints this.

 #constraint 1  #price of team < 50,000  max_price >= 50000   #constraint 2  #1qb    #constraint 3  #2rb  #rb1!=rb2  #constraint 4 #3wr #wr1!=wr2!=wr3  #constraint 5 #1flex #flx!=wr1!=wr2!=wr3 && flx!=rb1!=rb2  

data

df <- structure(list(position = c("wr", "wr", "wr", "wr", "qb", "wr",  "rb", "rb", "rb", "qb"), name = c("julio.jones", "odell.beckham.jr.",  "demaryius.thomas", "dez.bryant", "aaron.rodgers", "calvin.johnson",  "lesean.mccoy", "eddie.lacy", "jamaal.charles", "peyton.manning" ), salary = c(9300, 9200, 9100, 8700, 8600, 8500, 8300, 8200,  8400, 9100), gameinfo = c("phi@atl.07:10pmet", "nyg@dal.08:30pmet",  "bal@den.04:25pmet", "nyg@dal.08:30pmet", "gb@chi.01:00pmet",  "det@sd.04:05pmet", "gb@chi.01:00pmet", "gb@chi.01:00pmet", "gb@chi.01:00pmet",  "gb@chi.01:00pmet"), avgpointspergame = c(21.293, 26.417, 22.812,  19.033, 23.428, 18.229, 21.24, 21.24, 21.24, 21.24)), .names = c("position",  "name", "salary", "gameinfo", "avgpointspergame"), row.names = c("1",  "2", "3", "4", "5", "6", "7", "8", "9", "10"), class = "data.frame") 


Comments

Popular posts from this blog

yii2 - Yii 2 Running a Cron in the basic template -

asp.net - 'System.Web.HttpContext' does not contain a definition for 'GetOwinContext' Mystery -

mercurial graft feature, can it copy? -