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)}

enter image description here

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

Popular posts from this blog

.htaccess - First slash is removed after domain when entering a webpage in the browser -

Automatically create pages in phpfox -

c# - Farseer ContactListener is not working -