Right now I am playing around with the Linear Program class in Scala Breeze and I've gotten up to the point where I am going to optimize my linear programming problem using the following code.
import breeze.stats.distributions
import breeze.stats._
import breeze.linalg._
val lp = new breeze.optimize.linear.LinearProgram()
val unif_dist = breeze.stats.distributions.Uniform(-1,1)
val U = DenseMatrix.rand(1, 3, unif_dist).toArray
val V = DenseMatrix.rand(2, 3, unif_dist).toArray.grouped(3).toArray
val B = Array.fill(3)(lp.Binary())
val Objective = V.map(vi => U.zip(vi).map(uv => uv._1 * uv._2)).map(uvi => B.zip(uvi).map(buv => buv._1 * buv._2)).map(x => x.reduce(_ + _)).reduce(_ + _)
val lpp = ( Objective subjectTo() )
lp.maximize(lpp)
I receive the following error
scala> lp.minimize(lpp)
<console>:45: error: type mismatch;
found : lp.Problem
required: lp.Problem
lp.minimize(lpp)
^
Has anyone here run into this before, and if so, did you come up with a way to fix it? Additionally, I am open to suggestions on a cleaner way to write the line where I asssign Objective.