How to show all possible solutions with lp solve with r - r

My idea is to start using lp solve in order to solve a linear programming model. As a result, I studied the lp function and his components.
However, one thing which is not clear to me is how do I display all possible optimal solutions using lp solve in R without my variables be binary?
I would appreciate an easy example to better understand.
Thanks,
David

Related

How to find multiple optimal solutions using Gurobi

I am using Gurobi through Julia, and currently have it set up so that it gives me an optimal solution to the LP I am interested in.
However, it would be really helpful if there was a way it could give multiple optimal solutions. Even just giving me two solutions instead of only one would be very useful for my project.
Does anyone know how to do this?
A continuous LP has 0, 1 or infinitely many optimal solutions. So enumerating them is difficult.
We could try to enumerate the optimal corner points (a.k.a. basis solutions). This is not so simple either. Here is one approach: https://yetanothermathprogrammingconsultant.blogspot.com/2016/01/finding-all-optimal-lp-solutions.html.
Notes:
With an objective with random coefficients you may be able to find a few solutions. To restrict the search to optimal solutions, add the original objective as a constraint.
If the problem is a MIP, Gurobi can find all optimal integer solutions (or a subset of them). This is done (very efficiently) using the solution pool.

Is there a way to plot the solutions, feasible region and the optimal solution for Linear Programming in Julia Language?

I'm wondering if ther is a package to plot the feasible region (based on the constraints) and the optimal solution for linear programming in Julia Language using Juno. Do you know a way to do this? Suppose we have a LP problem and want to visualize the region and optimal solution. Is there a package to do this? How can I do this. I would appreciate so much your help. Thanks.

Multiobjective Constrained Combinatorial Optimization in R

This is quite a general question, but I have not been able to find a solution so far.
I am trying to solve a problem of combinatorial optimization in which I have several objective functions to optimize, as well as several constraints to impose. I am thus trying to find some software (an R package preferably) that can solve this problem.
I have explored several options, but none of them seems to be useful for my purpose: lpSolveAPI is aimed for linear programming only, which is not the case; mco can minimize a multidimensional objective function, but does not seem to be able to manage binary (i.e. decision) variables, needed for combinatorial problems; adagio and CEGO can deal with combinatorial optimization problems, but as far as I can see they can only optimize a single unidimensional function.
Is there any other package I am not aware of that can handle this type of problem? Or any of the aforementioned may be useful, though I may be missing the way to the functionality I need?
Thank you so much in advance with this. It is being really a nightmare trying to find this out.

Solve Algebraic Riccati Equation in R

I know that it's quite simple to solve the equation in Matlab. But is there a way to solve it in R as well? I need it for my Kalman filter implementations.

Solve Constrained Quadratic Programming with R

I really love R but from time to time it really gives me a headache...
I have the following simple quadratic minimization problem which can be formulated and solved within no time in Excel (click on picture to enlarge):
and
The problem itself is pretty straightforward: I want to minimize (w1^2+w2^2)/2 by finding the best combination of w1,w2 and b under the constraints that for all Y*(w1*X1+w2*X2+b) >= 1
I know that there is the quadprog package for solving these kinds of problems but I find it so unintuitive that I am not able to specify the problem correctly :-( I hate to say it but Excel seems to be better suited for specifying optimization problems like these :-(((
My question
How to formulate the above problem correctly so that it can be solved with R (no matter which package) and the program arrives at the correct values for w1, w2 and b (as can be seen in the picture above). Please don't just post links but please give actual code that works. It would be great if you could comment your code so it becomes clear why you do the things you do. Thank you!
The necessary data is here:
data <- matrix(c(2.947814,6.626878, 1,
2.530388,7.785050, 1,
3.566991,5.651046, 1,
3.156983,5.467077, 1,
2.582346,4.457777,-1,
2.155826,6.222343,-1,
3.273418,3.520687,-1),ncol=3,byrow=T)
colnames(data) <- c("X1","X2","y")
Addendum
Some people took offense at my request to provide code (and not simply links). I apologized for that and gave my reasons that I did not find any good approaches in the answers so far on SO. The deeper reason for that is that the problem is unusual in the sense that b is only in the constraint and not in the objective function. So I still think that this question is a good fit for SO.
Actually, the problem is a little tricky because b is only present in the inequality constraint matrix but not in the objective function. Therefore the matrix in the quadratic programming problem is only positive semidefinite but not positive definite.
My approach is therefore to set the matrix entry corresponding to b to a very small value - in my case 1e-9. Someone else more familiar with such optimization problems might know how to solve the problem properly...
Calculate solve.QP input
c1=data[,"X1"]*data[,"y"]
c2=data[,"X2"]*data[,"y"]
#I use 1e-9 for the b entry
Dmat=matrix(`[<-`(numeric(9),c(1,5,9),c(1,1,1e-9)),3,3)
dvec=rep(0,3)
Amat=cbind(c1,c2,data[,"y"])
bvec=rep(1,nrow(Amat))
Solve with solve.QP
library(quadprog)
sol=solve.QP(Dmat=Dmat,dvec=dvec,Amat=t(Amat),bvec=bvec)$solution
sol
#[1] 2.903910 1.201258 -14.734964
Same as excel.

Resources