I just found the R scripting language with the lpsolve library.

We want to maximize profit on a portfolio.

So we set up an objective function and constraints:

Code:

```
MAX = 0.055A + 0.049B + 0.1C + 0.085D + 0.1E
A+B+C+D+E <= 100,000
A+B <= 20,000
C+D <= 50,000
E <= 60,000
A >= 5,000
Transformed into matrix format constraints (non-negative constraints are assumed):
1,1,1,1,1 <= 100000
1,1,0,0,0 <= 20000
0,0,1,1,0 <= 50000
0,0,0,0,1 <= 60000
1,0,0,0,0 >= 5000
```

Then we create an R script:

Code:

```
library(lpSolve)
f.obj <- c(0.055, 0.049, 0.1, 0.085, 0.1)
f.con <- matrix(c(1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0), nrow = 5, byrow = TRUE)
f.dir <- c("<=","<=","<=","<=",">=")
f.rhs <- c(100000, 20000, 50000, 60000, 5000)
lp("max", f.obj, f.con, f.dir, f.rhs)
lp("max", f.obj, f.con, f.dir, f.rhs)$solution
lp("max", f.obj, f.con, f.dir, f.rhs)$objval
```

Then we run the script

` ``R -f example.r`

Then we get an answer:

Code:

```
> library(lpSolve)
> f.obj <- c(0.055, 0.049, 0.1, 0.085, 0.1)
> f.con <- matrix(c(1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0), nrow = 5, byrow = TRUE)
> f.dir <- c("<=","<=","<=","<=",">=")
> f.rhs <- c(100000, 20000, 50000, 60000, 5000)
> lp("max", f.obj, f.con, f.dir, f.rhs)
Success: the objective function is 9775
> lp("max", f.obj, f.con, f.dir, f.rhs)$solution
[1] 5000 0 50000 0 45000
> lp("max", f.obj, f.con, f.dir, f.rhs)$objval
[1] 9775
>
```

So we need to invest 5000 Euros into stock A, 50000 Euros into stock C, and 45000 Euros into stock E in order to maximize profit {given the expected returns}.

Our expected maximum profit is 9775 Euros.

This is very powerful for personal investing.