java - CPLEX minimize piecewise linar functions -
i'm setting java program using cplex. want find minimum of cost function lots of terms.
now turns out of these cost terms should not linear piecewise linear. know cplex can - how? can hardly find information or tutorials on that.
does have experience , can recommend/show me tutorials or code snippets?
this super helpful... in advance! philipp
here code:
ilolinearnumexpr tominimize = cplex.linearnumexpr(); for(float hour = start; hour <= end; hour += stepsize){ ilonumvar purchase = cplex.numvar(0, double.max_value, "purchase_" + hour); purchaseperhour.put(hour, purchase); tominimize.addterm(rate, purchase); ilonumvar esale = cplex.numvar(-double.max_value, 0, "sale_" + hour); saleperhour.put(hour, sale); tominimize.addterm(salerate/4000, esale); /* here should term similar sale/purchase ones above being piecewise linearly dependent variable */ } cplex.addminimize(tominimize);
have @ transport cplex example. there java version there uses piecewise linear objective function.
Comments
Post a Comment