oh sorry ..

The detailed description of the problem is given below

dataFrame is matrix of dim 100X100 with some values
a is a vector of length 1
x is a vector of any length between 1 to 99

funcScore<-function(a,x){
    
    sc<-0
    sc1<-0
    
     for(j in 1:(length(x))){
        sc<-sc+abs(dataFrame[a,x[j]])
      }
    
    if(length(x)==1){
      sc1<-0
    }
    
    else{ 
       if(length(x)>1){
          for(i in 1:(length(x)-1)){
               for(j in (i+1):(length(x))){
                      sc1 <- sc1+abs(dataFrame[(x[i]-1),x[j]])
               }
          }
       }
    }
   score <- sc-sc1
   return(score)
 }

Given the value of "a",  i would like to use some optimization function (
value of x) to maximize the score, such that x can be any combination ?

Thanks






--
View this message in context: 
http://r.789695.n4.nabble.com/Optimize-a-function-with-Discrete-inputs-tp4638644p4638851.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
R-help@r-project.org mailing list
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 via email to