alteryx / Optimization

Alteryx Optimization Tool
GNU General Public License v3.0
0 stars 1 forks source link

Output optimal value, optimal solution separately from the report #19

Closed kuol closed 8 years ago

kuol commented 8 years ago

Sometimes, user need these information(optimal value, optimal solution) for downstream Alteryx workflow. For example, in the 84.51 mixed integer programming example, they also want to know the optimal size, which can be calculated based on the optimal solution. Our PKO example also used the output solution.

ramnathv commented 8 years ago

Good point. The most general way to serialize the whole output is to do something like this:

serializeSolution <- function(sol){
  data.frame(
    key = c('objval', 'solution'),
    value = c(sol$objval, as.character(jsonlite::toJSON(sol$solution)))
  )
}

This will produce the following output.

     key                           value
1   objval                            7051
2   solution [1,1,1,1,1,1,1,1,1,1,0,1,1,0,0]

We can come up with two functions, one to serialize the output to pass along to another tool, and another function that will deserialize the output.

ramnathv commented 8 years ago

This is done. Now we have a S and D output for data.