I have an optimization problem with the following characteristics :
Linear objective function with binary variables (only)
Non-linear constraints.
I am looking for an adapted algorithm in R. Any ideas?
When I have the same optimization problem but with linear constraints, I use the ROI:: suite with the Multiple Solution Binary Linear Problem plugin: ROI.plugin.msbinlp. I am checking out the Rsolnp package but I am yet unable to constraint the solution to integer/binary variables.
Any idea would be very much appreciated. Thank you in advance!
Related
The problem has an exponential objective and exponential equality constraint function.Both my objective and constraint function are differentiable.
I would want to solve it using lagrange method and also want the function to output lagrange multiplier. I am currently exploring aug_lag in nloptr and solnp in rsolnp.
First question:
Would you suggest these packages or i should explore any other package?
Second question:
I know that rsolnp and nloptr performs local optimisation majorly but if i want to do global optimisation on a similar problem, can you suggest any package / algorithm?
I have a mathematical optimization which I wish to solve in R consider this system/problem:
How Can I solve this problem in R?
In this model Budget, p_l for all l and mu_target are fixed constants while muis a given m-dimensional vector and R is a given n by m matrix.
I have looked into constrOptim and lp but I don't have the imagination to implement the constraints
Those functions require that I have a "constraint" matrix but my problem is that I simply don't know how to design that constraint matrix. There are not many examples with decision variables on both sides of the equations.
Have a look on the nloptr package. It has quite extensive documentation with examples. Lots of algorithms to choose from, depending what problem you are trying to resolve.
NLoptr link
This set of exercises has the student use a QP solver to solve an SVM in R. The suggested solver is the quadprog package. The quadratic problem is given as:
From the remark about the linear SVM, $K=XX'$, $K$ is a singular matrix usually, at most rank $p$ where $X$ is $n\times p$. But the solver quadprog requires a positive definite matrix, not just PSD, in the place of $K$, as mentioned many places (and verified). Any ideas what the instructor had in mind?
I think the workaround would be to add a small number (such as 1e-7) to the diagonal elements of the matrix which is supposed to be positive definite. I am not certain about the math behind it, but the sources below, as well as my experience, suggest that this solution works.
source: https://stats.stackexchange.com/questions/179900/optimizing-a-support-vector-machine-with-quadratic-programming
source: https://teazrq.github.io/stat542/hw/HW6.pdf
This is my first question here so I'm sorry if it's not properly asked.
I'm playing around with the xgboost function in R and I was wondering if there is a simple parameter I could change so my linear regression objective=reg:linear has the restriction of only non-negative coefficients? I know I can use nnls for non-negative least squares regression, but I would prefer some stepwise solution like xgboost is offering.
If there is no easy way but a complicated one I would be happy to hear that, too. I read there is an option to build custom objective functions. So maybe you could change the reg:linear function at some point to get the non-negativity?
Thank you very much for your advice in advance!
I need to solve a linear program in R where the variables are matrices.
More specifically, my optimizing function looks like this.
Max X(A+B)Y - x - y,
where X,Y,A,B are matrices and x,y are scalars. Solve for X,Y,x,y
Subject to bunch of constraints like any linear program
Is there a way to solve this in R?
I checked out linprog and limsolve packages in R. They solve linear programs of scalars.
Is there a way to do the same for matrices in R.
Thanks for your help.
Googling for R linear programming matrices yielded a number of interesting links, of which the following might be interesting:
Simplex Method for Linear Programming Problems, for the boot package.