title: R - Find which value of a data frame to minimize a sum
body: <p>In R, I have the data frame which follows :</p>
  
  <pre><code>Mean_1     Mean_2        Nb_element_1     Nb_element_2
  42.66667   51.89474      3                38
  65.00000   -85.87500     1                8
  163.32653  -117.96970    49               33
  22.83333   247.00000     6                1
  </code></pre>
  
  <p>I would solve this optimization problem which follows :</p>
  
  <p>(1) : argmin Sum(| |Mean_1| - |Mean_2| | + |nb_element_1-nb_element_2|)</p>
  
  <p>(2) : 1.1*|Mean_1| > |Mean_2| > 0.75*|Mean_1| </p>
  
  <p>I want to find which elements give the smallest sum value constrained by (2)</p>
  
  <p>Is there a function which can do that ? Like solve() where we have to solve (1) = 0 or others functions ?</p>
  
  <p>Thank You. </p>
  
  <p>Edit : What I wanted is to have the best combination between an element from Mean_1 and Mean_2 that give the smallest sum value, example :</p>
  
  <pre><code>(Mean_1[1],Nb_element_1[1]) with (Mean_2[3],Nb_element_2[3])
  (Mean_1[2],Nb_element_1[2]) with (Mean_2[1],Nb_element_2[1])
  (Mean_1[3],Nb_element_1[3]) with (Mean_2[4],Nb_element_2[4])
  (Mean_1[4],Nb_element_1[4]) with (Mean_2[2],Nb_element_2[2])
  </code></pre>
  
  <p>Give the smallest sum value (not in this particular case, it's just an example to explain)</p>
  
  <p>Actually, Mean_1 and Nb_element_1 are associated as Mean_2 and Nb_element_2.</p>
  
  <p>So it faciliates the problem.</p>
  
  <p>Thank you again.</p>