c# - Solver foundation simplex solution takes a lot of time -
trying solve following problem using solver foundation:
given: range: {x | x double} , points: {(x,y) | x,y double}
find piece wise linear function - { (a,b) | a,b double} where:
- linear lines drawn between x'es range.
- covers points.
- minimal area under graph.
example: range: {1, 2, 3} , points {(1,40), (1.5,40), (2.5,70)}

my solution:
minimize following problem simplex:
foreach range add :
var ai = new decision(domain.realrange(0, 100), null); var bi = new decision(domain.realrange(0, 100), null); model.adddecisions(a, b); foreach point points fall in range add constraint
model.addconstraints("c{0}".f(pointidx), * point.x + b >= point.y); then add goal:
model.addgoal("area", goalkind.minimize, goal); and solution:
var solution = context.solve(new simplexdirective()); the solution works gives me right answer takes lot of time simple case takes 130 ms. tell me doing wrong? can optimize ? simplex method right case? have better software solution solverfoundation optimization.
try loading model oml string, enforce simplex solver check if problem lp
Comments
Post a Comment