Displaying 20 results from an estimated 1000 matches similar to: "Linear programming with sparse matrix input format?"
2007 Mar 09
1
lpSolve space problem in R 2.4.1 on Windows XP
Hi.
I am trying to use the linear optimizer from package lpSolve in R 2.4.1 on
Windows XP (Version 5.1). The problem I am trying to solve has 2843
variables (2841 integer, 2 continuous) and 8524 constraints, and I have 2 Gb
of memory. After I load the input data into R, I have at most 1.5 Gb of
memory available. If I start the lp with significantly less memory
available (say 1 Gb), I get
2008 Oct 22
2
suboptimal lp solutions
Hi list,
I want to find the total maximum resources I can spend given a set
allocation proportion and some simple budget constraints.
However, I get suboptimal results via lp and friends (i.e. lpSolve and
simplex in the linprog and boot) .
For example:
library(lpSolve)
proportions = c( 0.46, 0.28, 0.26)
constraints = c( 352, 75, 171)
lp(objective.in = proportions,
const.mat =
2012 May 08
1
Translation of Linear minimization probelm from matlab to r
Hi everyone, i?m a new user of R and i?m trying to translate an linear
optimization problem from Matlab into r.
The matlab code is as follow:
options = optimset('Diagnostics','on');
[x fval exitflag] = linprog(f,A,b,Aeq,beq,lb,ub,[],options);
exitflag
fval
x=round(x);
Where:
f = Linear objective function vector (vector of 45,rows)
A = Matrix for linear inequality
2006 May 05
1
A question about linear optimizaton
Dear all,
I am trying to find a solution satisfying the below equations
in R.
Set up the problem
9 X1+ X2 + X3 = 2
X1+ X2 + X3 = 1
which is subjected to
0 < X1 < X2 < X3 < 2.
I have downloaded the packages \'linprog\' and \'lpSolve\' but can
not see how to solve the question.
Thank you for your help.
With
2009 Mar 27
1
asking advice for Integer Programming packages
Dear everyone,
I don't know much about Integer Programming but am afraid I am facing
a problem that can only be solved via Integer Programming. I was
wondering if those of you who have experience with it could recommend
an R package.
I found the following R packages:
Rglpk
glpk
lpSolve
lpSolveAPI
Are there any others?
Are some of them easier to use than others for a beginner?
Any advice
2007 Jul 27
2
Matrix Multiplication, Floating-Point, etc.
Hi.
I recently tried the following in R 2.5.1 on Windows XP:
>ev2<-c(0.8,-0.6)
>ev1<-c(0.6,0.8)
>ev1%*%ev2
[,1]
[1,] -2.664427e-17
>sum(ev1*ev2)
[1] 0
>
(I got the same result with R 2.4.1 on a different Windows XP machine.)
I expect this issue is very familiar and probably has been discussed in this
forum before. Can someone please point me to some
2007 Nov 14
2
convex optimization package for R, specifically semidefinite programming
Recently, a package for convex optimization was announced for Python,
based upon the LP solver GLPK, the SDP solver
in DSDP5, and the LP and QP solvers in MOSEK. I'm aware GLPK is
available for R, but wondered if anyone had good
packages for convex optimization along these lines for R.
TIA.
2007 Dec 10
4
Reading through a group of .RData files
Hi.
I have a procedure that reads a directory, loops through a set of particular .RData files, loading each one, and feeding its object(s) into a function, as follows:
cvListFiles<-list.files(fnDir);
for(i in grep(paste("^",pfnStub,".*\\.RData$",sep=""),cvListFiles)){
load(paste(fnDir,cvListFiles[i],sep="/"));
myFunction(rliObject);
rm(rliObject);
};
2008 Jan 07
3
Seeking a more efficient way to find partition maxima
Hi.
Suppose I have a vector that I partition into disjoint, contiguous subvectors. For example, let v = c(1,4,2,6,7,5), partition it into three subvectors, v1 = v[1:3], v2 = v[4], v3 = v[5:6]. I want to find the maximum element of each subvector. In this example, max(v1) is 4, max(v2) is 6, max(v3) is 7. If I knew that the successive subvector maxima would never decrease, as in the example,
2007 Feb 28
1
Efficient way to repeat rows (or columns) of a matrix?
Hi.
If I have a vector, v_1, and another vector of positive integers, i_1, the
same length as v_1, then rep(v_1,i_1) will repeat v_i[j] exactly i_1[j]
times, like so:
>rep(c(1,2,3),c(3,2,1))
[1] 1 1 1 2 2 3
>
I'd like to do the same sort of thing where I replace v_1 with a matrix, and
the jth row of the matrix is repeated i_1 times.
Obviously, I could do this with for loops, like
2007 Jan 11
1
rank function and NA in 2.3.1
Hi.
I am using R 2.3.1 on WIndows XP, and I am having trouble with the rank
function in the presence of numerical NA data. I want the NA's all to get
the same rank, but they don't. Here is an example from my session:
>ct_align_rets_f2$liq[6851:6859]
[1] 115396 NA 362595 NA 242986 340805 NA 692905 251533
2007 Feb 01
3
Can this loop be delooped?
Hi.
I have the following code in a loop. It splits a vector into subvectors of
equal size. But if the size of the original vector is not an exact multiple
of the desired subvector size, then the first few subvectors have one more
element than the last few. I know that the cut function could be used to
determine where to break up the vector, but it doesn't seem to provide
control over
2007 May 15
2
Testing for existence inside a function
Hi.
I'm having trouble testing for existence of an object inside a function.
Suppose I have a function:
f<-function(x){
...
}
and I call it with argument y:
f(y)
I'd like to check inside the function whether argument y exists. Is this
possible, or do I have to either check outside the function or pass the name
of the argument as a separate argument?
If I do exists(x) or
2007 Feb 02
1
Another loop - deloop question
Hi.
You folks are so clever, I thought perhaps you could help me make another
procedure more efficient.
Right now I have the following setup:
p is a vector of length m
g is a list of length n, g[[i]] is a vector whose elements are indices of p,
i.e., integers between 1 and m inclusive); the g[[i]] cover the full set
1:m, but they don't have to constitute an exact partition, theycan
2007 Jan 18
1
Robust PCA?
Hi.
I'm checking into robust methods for principal components analysis. There
seem to be several floating around. I'm currently focusing my attention on
a method of Hubert, Rousseeuw, and Vanden Branden
(http://wis.kuleuven.be/stat/Papers/robpca.pdf) mainly because I'm familiar
with other work by Rousseeuw and Hubert in robust methodologies. Of course,
I'd like to obtain
2007 Aug 31
1
gsub warning message
Hi.
I am using R 2.5.1 on a Windows XP machine. Here is an example of a piece
of code I was running in older versions of R on the same machine. I am
looking for underscores and replacing them with periods. This result is
from R 2.4.1:
>gsub ( "\\_+","\.","AAA_I")
[1] "AAA.I"
>
Here is what I get in R 2.5.1:
>gsub (
2007 Sep 12
1
"Save to File..." option on File menu
Hi.
There was an interesting thread about a year ago, called 'Command
equivalent of rgui "File, Save to File"?'
(http://tolstoy.newcastle.edu.au/R/e2/help/06/09/0553.html) started by
Michael Prager, and contributed to by Duncan Murdoch (I didn't notice
anything beyond the four entries they posted). The question was how to
replicate programmatically the "Save to
2007 Mar 21
1
Integer Optimization
Hello everybody,
I am looking for a function (or package) which can solve a integer
optimization problem. I have found the glpk package but I don't known
very well how to use it.
Someone has another solution ?
thx
2007 Jul 09
1
factanal frustration!
Hi.
It seems that nearly every time I try to use factanal I get the following
response:
>faa2db1<-factanal(mretdb1,factors=2,method="mle",control=list(nstart=25))
Error in factanal(mretdb1, factors = 2, method = "mle", control =
list(nstart = 25)) :
unable to optimize from these starting value(s)
>
In the case cited above, mretdb1 is synthetic data created
2006 Dec 29
1
Failure loading library into second R 2.3.1 session on Windows XP
Hi.
I am using R 2.3.1 on Windows XP. I had installed a library package into my
first session and wanted the same package in my second session, so I went
out to the CRAN mirror and tried to install the package, and got the
following message:
*********************************************************************
>utils:::menuInstallPkgs()
trying URL