Tuesday 15 April 2014

r - constrained optimization of quadratic function -


I am using to optimize the non-linear constraint optimization problem.

The problem is:

  at least: - (0.653 * x [1] + 0.234 * x [1] * x [1] + 0.437 * x [ 2] + 0.769 * x [3] +0.453 * x [4] + 0.744 * x [5] + 0.476 × x [5] * x [5])   

parity barrier :

  x [1] + x [2] + x [3] + x [4] + x [5] = 2600   

Inequality The drawbacks are:

  X [1] & gt; 900 x [1] & lt; 1100 x [2] & gt; 400 x [2] & lt; 600 x [3] & gt; 250 x [3] & lt; 350 x [4] & gt; 175 x [4] & lt; 225 x [5] & gt; 295 x [5] & lt; 305   

What am I trying to do here:

  fn & lt; - Function () {- (0.653 * x [1] + 0.234 * x [1] * x [1] + 0.437 * x [2] + 0.76 9 * x [3] + 0.453 * x [4] + 0.744 * X [5] + 0.476 * x [5] * x [5])} Hake & lt; - work (x) {x [1] + x [2] + x [3] + x [4] + x [5] - 2600 day day & lt; - Function (x) {h & lt; - rep (NA, 1) H [1] and LT; - X [1] - 900 H [2] & lt; - 1100 - x [1] H [3] & lt; - x [2] - 400 h [4] & lt; - 600 - x [2] h [5] and lieutenant - x [3] - 250 h [6] & lt; - 350 - x [3] h [7] & lt; - x [4] - 175 H [8] and lieutenant; - 225 - X [4] H [9] and LT; - X [5] - 295H [10] & lt;  

Case1:

Pre> ans & lt; - auglag (par = null, fn = fn, gr = null, hin = hin, heck = heck) h [1] & lt; Error in x [1] - 900: The length of the replacement is zero

Case 2:

  ans & lt; - Ergoglag (Mercury = C (1,1,1,1,1), Fn = Fn, Hin = is, heck = hack] H [1] error [LT; Case [3]: - X [2] + X [3] + x [4] + x [5] - 2600: object 'H' was not found   

Case 3:

  ans & lt; - Au H [1] & lt; Mistake in the case of x [1] + x [2] + x [3] + x [4] (equal to = C (1000, 000,300,200,300), FN = FN, hein = is, heck = heck]]  5 < -> H [1] & lt; - x [1] - 900: Replacement length is zero   

What is the correct way? Hn = hin, heq = heq Auglag or constrOptim.nl to apply? I tried to solve it, but could not the norms be passed?

After the edits made by @Hong Oye, here are new errors:

  & gt; ANS & LT; - Ergoglag (equivalent = NLL, FN = FN, GR = NLL, HIN = is, heck = hack) H [1] error [1] & lt; - x [1] - 900: The length of the replacement is zero & gt; Ans & lt; Error in error (equal to, ...): unused argument (s) (equal) & amp; auglag (par = c (1,1,1,1,1), fn = fn, hin = hin, heq = heq) Gt; Ans & lt; Error in fn (par, ...): unused reasoning (s) (equal to)> auglag (par = c (1000,500,300,200,300), fn = fn, hin = hin, heq = heq) Answer [1] & lt; - x [1] - 900: The length of the replacement is zero  
  • I have got to do this work

    I was using it:

      fn < - Function () {- (0.653 * x [1] + 0.234 * x [1] * x [1] + 0.437 * x [2] + 0.76 9 * x [3] + 0.453 * x [4] + 0.744 * Instead, I should have used it:  
      fn & lt; - function (x)   {- (0.653 * x [1] + 0.234 * x [1] * x [1] + 0.437 * x [2] + 0.76 9 * x [3] + 0.453 * x [4] + 0.744 * x [5] + 0.476 * x [5] * x [ 5])}    

  • No comments:

    Post a Comment