I am new to R solver and I want to have a simple example in R for the below problem:
I have four columns which I calculate the individual sums as the illustrated sample example below:
The problem I want to solve in R:
Find the optimal lines that satisfies, simultaneously, the below statements:
- For the first two columns (a, b) the individual summations to be more close to 0
- The sums of (c, d) to be more close to 5
I do not have restrictions of which package solver to use. It could be helpful to have an example of R code for this!
EDIT
For the same solution I would like to apply some rules:
- I want the sum(c) > sum(d) AND sum(d) < (static number, like 5)
- Also, if I want the sums to fall into a range of numbers and not just static numbers, how the solution could it be written?
NlcOptim
nice to use. Very flexible once you get the hang of it and is quick. cran.r-project.org/web/packages/NlcOptim/NlcOptim.pdf