Skip to content

Commit

Permalink
version 1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Haotian Pang authored and gaborcsardi committed Jul 11, 2013
1 parent fc74a18 commit 78a3954
Show file tree
Hide file tree
Showing 16 changed files with 709 additions and 33 deletions.
15 changes: 7 additions & 8 deletions DESCRIPTION
@@ -1,19 +1,18 @@
Package: fastclime
Type: Package
Title: A fast solver for constrained l1 minimization approach to sparse
precision matrix estimation
Version: 1.1
Date: 2013-06-18
Title: A fast solver for parameterized lp problems and constrained l1
minimization approach to sparse precision matrix estimation
Version: 1.2
Date: 2013-07-11
Author: Haotian Pang, Han Liu and Robert Vanderbei
Maintainer: Haotian Pang <hpang@princeton.edu>
Depends: R (>= 2.15.0), lattice, igraph, MASS, Matrix
Description: The package "fastclime" provides a method of recover the
precision matrix efficiently by applying parametric simplex
method. The computation is based on a linear optimization
solver. It also contains a generic LP solver using parametric
simplex method.
solver. It also contains a generic LP solver and a parameterized LP solver using parametric simplex method.
License: GPL-2
Repository: CRAN
Packaged: 2013-06-18 23:15:32 UTC; haotian
Packaged: 2013-07-11 18:46:54 UTC; haotian
NeedsCompilation: yes
Date/Publication: 2013-06-19 08:49:27
Date/Publication: 2013-07-12 07:28:25
24 changes: 14 additions & 10 deletions MD5
@@ -1,20 +1,21 @@
ef9be5f3e5a7e6bcc107597a7e8fbf94 *DESCRIPTION
8b1385871523f9e979f7b0b69cc720a2 *NAMESPACE
aadbd9dcbf1b733d80f9961eff81e690 *R/fastclime.R
8ebabce6fbf0ec5a5cea556fb5d7ce58 *R/fastclime.generator.R
f7fe243272e90e5599a05566d39e2cc0 *R/fastclime.plot.R
546eeb0435048784d1ec66cb99c38d65 *R/fastclime.roc.R
c2c02d8b30ac90676fbe6179b213d98b *R/fastlp.R
33d765adc24fda3448594a262c6a8e1f *DESCRIPTION
5bbd7fd82971d5bddb5c6d1efa208758 *NAMESPACE
c3338f877a71ecd1bbd93f66d1787ed0 *R/fastclime.R
32de2eb45c5a4cd735f1449870056282 *R/fastclime.generator.R
a179fc740230d2b6702050ae8972757b *R/fastclime.plot.R
46ab6431d4c6b002a6da2cd699a5f9e5 *R/fastclime.roc.R
b9a85abba7b7af3cd0c04bc677563dd1 *R/fastlp.R
b6acdd1a7e73c9908a19e070fbf59a99 *R/paralp.R
ec90576375b24e35502847bdd1d85b6e *data/stockdata.rda
18fca9443d532169d44c2d0dcd7fa8f5 *inst/doc/fastclime.pdf
9cf23fc8036ec97c902be03c40a08490 *inst/doc/vignette.Rnw
dfb9b711d987b84cc3523cf27a71b85b *inst/doc/vignette.pdf
457de96fcd3cfdc20abaee85fd75053e *man/fastclime-package.Rd
acb36b4fa4a40327ef852da5a5ffad1c *inst/doc/vignette.pdf
ac3cc2f9c850519fd3916973d120c492 *man/fastclime-package.Rd
c964cd215020211b41c9abdaec9a24b3 *man/fastclime.Rd
f13eef1099b8dad1091dd5764e6b6eb5 *man/fastclime.generator.Rd
64307ab02e80b23986e1f4446aa316c6 *man/fastclime.plot.Rd
05d72f126d24f37636432aa948c6f48a *man/fastclime.roc.Rd
35a34d4b383d8d9798b754ca6ebd808b *man/fastlp.Rd
e45d01c047c1c70cd41af8adb55ec220 *man/paralp.Rd
4fede98f1e2ad5f3ee859ea58504be85 *man/plot.fastclime.Rd
a1d5732ba3621562c4e5d92cd57b1b31 *man/plot.roc.Rd
66a8b6d1673d092cb2d2e15434493e3e *man/plot.sim.Rd
Expand All @@ -32,6 +33,9 @@ c5217e444b843a5a358b905e6cb1c975 *src/linalg.c
f27fb8d738a94ff945bf48498eeee3ab *src/lu.h
abc0a80ca8d0260b12e96ba9f9df608f *src/macros.h
e1be8277ecf906d37bc71e80fb591490 *src/myalloc.h
dec22a96f3a55c4d15b0e2dcdf0f1e29 *src/paralp.c
236bcdaa0532e3454d61fec79f0648d7 *src/parametric.c
38e9ff9c3d2f5b3b832010d120069caf *src/tree.c
ebd8db35929bc9a80f444621e0e0f909 *src/tree.h
cccf1b335989a7951ed1f1f1a80142a1 *vignettes/fastclime.pdf
9cf23fc8036ec97c902be03c40a08490 *vignettes/vignette.Rnw
3 changes: 2 additions & 1 deletion NAMESPACE
Expand Up @@ -7,7 +7,8 @@ export(fastclime,
print.fastclime,plot.fastclime,
print.roc,plot.roc,
print.sim,plot.sim,
fastlp
fastlp,
paralp
)

S3method("print","roc")
Expand Down
4 changes: 2 additions & 2 deletions R/fastclime.R
Expand Up @@ -3,8 +3,8 @@
# fastclime(): Main Function #
# Authors: Haotian Pang, Han Liu and Robert Vanderbei #
# Emails: <hpang@princeton.edu>, <hanliu@princeton.edu> and <rvdb@princetonedu> #
# Date: Jun 18th 2013 #
# Version: 1.1 #
# Date: Jul 11th 2013 #
# Version: 1.2 #
#-------------------------------------------------------------------------------#
fastclime <- function(x, lambda.min.ratio = NULL, nlambda = 50)
{
Expand Down
4 changes: 2 additions & 2 deletions R/fastclime.generator.R
Expand Up @@ -3,8 +3,8 @@
# fastclime.generator(): Data generator #
# Authors: Haotian Pang, Han Liu and Robert Vanderbei #
# Emails: <hpang@princeton.edu>, <hanliu@princeton.edu> and <rvdb@princetonedu> #
# Date: Jun 18th 2013 #
# Version: 1.1 #
# Date: Jul 11th 2013 #
# Version: 1.2 #
#-------------------------------------------------------------------------------#

## Main function
Expand Down
4 changes: 2 additions & 2 deletions R/fastclime.plot.R
Expand Up @@ -3,8 +3,8 @@
# fastclime.generator(): graph visualization #
# Authors: Haotian Pang, Han Liu and Robert Vanderbei #
# Emails: <hpang@princeton.edu>, <hanliu@princeton.edu> and <rvdb@princetonedu> #
# Date: Jun 18th 2013 #
# Version: 1.1 #
# Date: Jul 11th 2013 #
# Version: 1.2 #
#-------------------------------------------------------------------------------#

fastclime.plot = function(G, epsflag = FALSE, graph.name = "default", cur.num = 1, location=NULL){
Expand Down
4 changes: 2 additions & 2 deletions R/fastclime.roc.R
Expand Up @@ -4,8 +4,8 @@
# The ground truth is required #
# Authors: Haotian Pang, Han Liu and Robert Vanderbei #
# Emails: <hpang@princeton.edu>, <hanliu@princeton.edu> and <rvdb@princetonedu> #
# Date: Jun 18th 2013 #
# Version: 1.1 #
# Date: Jul 11th 2013 #
# Version: 1.2 #
#-------------------------------------------------------------------------------#

fastclime.roc = function(path, theta, verbose = TRUE){
Expand Down
4 changes: 2 additions & 2 deletions R/fastlp.R
Expand Up @@ -3,8 +3,8 @@
# fastclp(): A parametric simplex LP solver #
# Authors: Haotian Pang, Han Liu and Robert Vanderbei #
# Emails: <hpang@princeton.edu>, <hanliu@princeton.edu> and <rvdb@princetonedu> #
# Date: Jun 18th 2013 #
# Version: 1.1 #
# Date: Jul 11th 2013 #
# Version: 1.2 #
#-------------------------------------------------------------------------------#

fastlp <- function(obj, mat, rhs,lambda=0){
Expand Down
73 changes: 73 additions & 0 deletions R/paralp.R
@@ -0,0 +1,73 @@
#-------------------------------------------------------------------------------#
# Package: fastclime #
# fastclp(): A parametric simplex LP solver for parameterized LP problems #
# Authors: Haotian Pang, Han Liu and Robert Vanderbei #
# Emails: <hpang@princeton.edu>, <hanliu@princeton.edu> and <rvdb@princetonedu> #
# Date: Jul 11th 2013 #
# Version: 1.2 #
#-------------------------------------------------------------------------------#

paralp <- function(obj, mat, rhs, obj_bar, rhs_bar, lambda=0){

m<-length(rhs)
n<-length(obj)
m1<-length(rhs_bar)
n1<-length(obj_bar)
m0<-dim(mat)[1]
n0<-dim(mat)[2]

opt<-rep(0,n)
status<-0
error<-0

if (m!=m0 || n!=n0 || m!=m1 || n!=n1){
cat("Dimensions do not match! \n")
error<-1
}

if (any(obj_bar<0) || any(rhs_bar<0)){

cat("The pertubation vector obj_bar and rhs_bar must be nonnegative! \n")
error<-2

}

if (error==0){
str=.C("paralp", as.double(obj), as.double(t(mat)), as.double(rhs), as.integer(m0), as.integer(n0), as.double(opt), as.integer(status), as.double(lambda), as.double(rhs_bar), as.double(obj_bar), PACKAGE="fastclime")


opt<-unlist(str[6])
status<-unlist(str[7])

if (status==0){
cat("optimal solution found! \n")
return(opt)
}

else if(status ==1){
cat("The problem is infeasible! \n")
}

else if(status ==2){
cat("The problem is unbounded! \n")
}

}


}















Binary file removed inst/doc/fastclime.pdf
Binary file not shown.
Binary file modified inst/doc/vignette.pdf
Binary file not shown.
10 changes: 6 additions & 4 deletions man/fastclime-package.Rd
Expand Up @@ -2,10 +2,10 @@
\alias{fastclime-package}
\docType{package}
\title{
Fast Parametric Simplex Solver for CLIME
Fast Parametric Simplex Solver for CLIME and Linear Programming
}
\description{
A package for constrainted l1 minimization approach to sparse precision matrix estimation
A package for generic linear programming, parameterized linear programming and constrainted l1 minimization approach to sparse precision matrix estimation
}
\details{
\tabular{ll}{
Expand All @@ -16,14 +16,16 @@ Date: \tab 2013-05-27\cr
License: \tab GPL-2\cr
LazyLoad: \tab yes\cr
}
The package "fastclime" provides 2 main functions:\cr
The package "fastclime" provides 3 main functions:\cr
(1) the data generator creates random samples from multivariate normal distributions with different graph structures. Please refer to \code{\link{fastclime.generator}}.\cr
(2) The parametric simplex solver for constrainted l1 minimization approach to sparse precision matrix estimation. Please refer to \code{\link{fastclime}}.\cr
(3) A generic linear programming solver and a parameterized linear programming solver. Please refer to \code{\link{fastlp}} and \code{\link{paralp}}.\cr
}
\author{
Haotian Pang, Han Liu and Robert Vanderbei \cr
Maintainer: Haotan Pang<hpang@princeton.edu>;
}

\seealso{
\code{\link{fastclime.generator}}, \code{\link{fastclime}}, \code{\link{fastclime.plot}} and \code{\link{fastclime.roc}}
\code{\link{fastclime.generator}}, \code{\link{fastclime}}, \code{\link{fastclime.plot}} and \code{\link{fastclime.roc}}, \code{\link{fastlp}}, \code{\link{paralp}}
}
66 changes: 66 additions & 0 deletions man/paralp.Rd
@@ -0,0 +1,66 @@
\name{paralp}
\alias{paralp}

\title{
A solver for parameterized LP problems
}

\description{
A parameterized linear programming solver using parametric simplex method
}

\usage{
paralp(obj,mat,rhs,obj_bar,rhs_bar,lambda=0)
}

\arguments{
\item{obj}{
The objective vector of the coefficient with length n.
}
\item{mat}{
The constraint matrix of the linear programming with dimension m*n. Note this argument must be in matrix form even it is a vector.
}
\item{rhs}{
The right hand side vector of the constraint with length m.
}

\item{obj_bar}{
The vector used to time the parameter and added to the objective vector, with length n. This pertubation vector must be nonnegative.
}

\item{rhs_bar}{
The vector used to time the parameter and added to the right hand side vector, with length m. This pertubation vector must be nonnegative.
}

\item{lambda}{
The parametric simplex method will stop when the calculated paramter is smaller than lambda. The default value is zero and it corresponds to the optimal value.
}
}

\details{
This function is used to solve a general linear programming in standard inequality form: "maximize obj*x+obj_bar*lambda, subject to: mat*x<=rhs+rhs_bar*lambda, x>=0"
}


\value{
The optimal value will be returned if it exists with a proper value of chosen lambda. Otherwise the function will indicate the problem is infeasible or unbounded.
}

\author{
Haotian Pang, Han Liu and Robert Vanderbei \cr
Maintainer: Haotan Pang<hpang@princeton.edu>
}

\seealso{
\code{\link{fastclime}} and \code{\link{fastclime-package}}
}

\examples{
#generate an LP problem and solve it
A=matrix(c(-1,-1,0,1,-2,1),nrow=3)
b=c(-1,-2,1)
c=c(-2,3)
b_bar=c(1,1,1)
c_bar=c(1,1)
paralp(c,A,b,c_bar,b_bar)
}

0 comments on commit 78a3954

Please sign in to comment.