R optimization with equality and inequality constraints

后端 未结 3 748
情深已故
情深已故 2020-12-03 15:14

I am trying to find the local minimum of a function, and the parameters have a fixed sum. For example,

Fx = 10 - 5x1 + 2x2 - x3

and the cond

3条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-03 15:28

    rewrite

    fx = function(x) {10 - (5*x[1] + 2*x[2] + (15 - x[3] - x[2]))}

    and add the additional constrain that

    x[1] + x[2] <= 15

提交回复
热议问题