Skip to content

Commit

Permalink
version 0.1-7
Browse files Browse the repository at this point in the history
  • Loading branch information
markvanderloo authored and gaborcsardi committed Jun 10, 2015
1 parent ccc101c commit f6d48bd
Show file tree
Hide file tree
Showing 15 changed files with 682 additions and 47 deletions.
21 changes: 10 additions & 11 deletions DESCRIPTION
@@ -1,21 +1,20 @@
Package: rspa
Maintainer: Mark van der Loo <mark.vanderloo@gmail.com>
License: GPL-3
Title: Adapt Numerical Records To Fit (In)Equality Restrictions
Title: Adapt Numerical Records to Fit (in)Equality Restrictions
Type: Package
LazyLoad: yes
Author: Mark van der Loo
Description: Based on (optionally sparse) quadratic optimization with the main
algorithms implemented in C. Includes features for easy processing of many
(smaller) records. The algorithm has been tested on fairly large
optimization problems with up to a few million variables and several
hundred thousand restrictions.
Version: 0.1-6
Depends: R (>= 2.13.0), editrules
Description: Based on (optionally sparse) quadratic optimization with the main algorithms implemented in C. Includes features for easy processing of many (smaller) records. The algorithm has been tested on fairly large optimization problems with up to a few million variables and several hundred thousand restrictions.
Version: 0.1-7
Depends: R (>= 2.13.0)
Imports: editrules
URL: https://github.com/markvanderloo/rspa
Date: 2013-10-21
BugReports: https://github.com/markvanderloo/rspa/issues
VignetteBuilder: knitr
Date: 2015-06-10
Suggests: knitr, testthat
Packaged: 2014-11-26 11:05:13 UTC; mark
NeedsCompilation: yes
Packaged: 2015-06-10 12:27:26 UTC; mark
Repository: CRAN
Date/Publication: 2014-11-26 12:44:09
Date/Publication: 2015-06-10 15:10:52
24 changes: 14 additions & 10 deletions MD5
@@ -1,23 +1,27 @@
6202b47e0de8c098f1db3118ad173cfa *DESCRIPTION
1f4388f10ba22273dd619ea7e6c4ab90 *NAMESPACE
1ebe5c935603fb99b184480a315b0b90 *NEWS
a20e83c1793cff5540652529c8a4ceb2 *DESCRIPTION
18649633fb08c967f454239082e043b5 *NAMESPACE
e8e6bec0c5964a7c5ac165769a11885e *NEWS
bdcab7e3f9d2d62fade703fef62ced65 *R/adjust.R
b6b1dbe35f7e8b18cc49342eba000603 *R/adjustRecords.R
f6a77c7dc1625d4f40b5814190ac808c *R/adjusted.R
532d06c3f2552af4cbcfe617b7adb996 *R/adjustedRecords.R
0b09877d585499ec120d9dbde7190aae *R/rspa.R
fcc73dda50e39edb359269e20d0e9a60 *R/sparseConstraints.R
50c964a7ba218f3b4f747be9125035c8 *R/utils.R
2833bba9deb832eaf7376f3efaa82e6d *build/vignette.rds
0ead49b33f1b85cc7590cedf354e712e *inst/doc/getting_started.R
514cd578d1014e9f66d80deb1b54945b *inst/doc/getting_started.Rnw
19a5e73c06a08dd2d8fd4c5efe2fec94 *inst/doc/getting_started.pdf
7dee6197917ec8b1e3fad28ff28310a4 *inst/tests/test_adjust.R
d3faeb95a8770b8b72cd0e15d1802fd3 *inst/tests/test_adjustRecords.R
0dafb0ae5bc71821ffafaebf7056a746 *inst/tests/test_sparseConstraints.R
6903ddfcb7907477e3dc8e0ba3eb9585 *inst/tests/test_utils.R
7e9e317e8c5134139beb8948367f9532 *man/adjust.Rd
376c9efd102eda2cb40173e56cc3da4f *man/adjustRecords.Rd
45ade9e206ec9789218931f0b750a4b4 *man/adjusted.Rd
28ce0733ef313fe69f83c98834c3fda8 *man/adjustedRecords.Rd
13fce124c79bf3233ff89b18719f2b51 *man/rspa-package.Rd
688f04fa3c2a900c8258c8f047cef4b7 *man/sparseConstraints.Rd
2fe2770223151f483032fa6abeec6070 *man/adjust.Rd
977a6713e793b31b9078ad9a9243db7d *man/adjustRecords.Rd
8eb7c3138ff0488353c22532421fc9c7 *man/adjusted.Rd
91a7f37e6752db78bcbbb30b0c1bd490 *man/adjustedRecords.Rd
2fc2500f39b6013e9da8629feb1c70da *man/rspa-package.Rd
24e25a823768b433b17110ada1a769d2 *man/sparseConstraints.Rd
f8885b67f4fc499e74fc57607bbbc6f4 *src/R_all_finite.c
2f1446818ea54a7264366f7cf9613256 *src/R_dc_spa.c
74a0a8cd0055162708b23c9f05c1cbc3 *src/R_sc_arith.c
Expand All @@ -36,5 +40,5 @@ ea74ad3b00e8763083e25fc493a76aa9 *src/maxdist.c
ba2fdbffa8d7f870ec541c707d3927ed *src/sparseConstraints.c
bb44c9d5a5459060d7c7b6b4511a864c *src/sparseConstraints.h
46f386d870ef0a990eb1da40ee094457 *tests/testpackage.R
d5dc0587fe211b26f9842626642062eb *vignettes/getting_started.Rnw
514cd578d1014e9f66d80deb1b54945b *vignettes/getting_started.Rnw
5f70943c0b32f1d8df0d50606cfd6ade *vignettes/rspa.bib
2 changes: 1 addition & 1 deletion NAMESPACE
@@ -1,4 +1,4 @@
# Generated by roxygen2 (4.0.2): do not edit by hand
# Generated by roxygen2 (4.1.1): do not edit by hand

S3method(adjust,editmatrix)
S3method(adjust,matrix)
Expand Down
7 changes: 5 additions & 2 deletions NEWS
@@ -1,8 +1,11 @@
version-0.1.6
version 0.1.7
- solved issues with vignette building on CRAN side

version 0.1.6
- bugfix in adjustRecords: weights were ignored (thanks to Daan Zult).
- several updates on unit tests.

version-0.1.4
version 0.1.4
- Vignette now built using weave engine specification (allowed since R3.0).

version 0.1.3
Expand Down
Binary file added build/vignette.rds
Binary file not shown.
123 changes: 123 additions & 0 deletions inst/doc/getting_started.R
@@ -0,0 +1,123 @@
## ----echo=FALSE, results="hide",include=FALSE----------------------------
library(knitr)
library(rspa)
library(editrules)
opts_chunk$set(size='small')

## ----tidy=FALSE----------------------------------------------------------
E <- editmatrix(expression(
x5 == x1 + x8,
x5 == x3 + x4,
x8 == x6 + x7,
x4 > 0))

## ----tidy=FALSE----------------------------------------------------------
x <- c(
x1=330,
x2=20,
x3=1000,
x4=30,
x5=950,
x6=500,
x7=200,
x8=700)

## ------------------------------------------------------------------------
violatedEdits(E,x,tol=1e-2)

## ------------------------------------------------------------------------
E <- reduce(substValue(E,'x5',x['x5']))

## ------------------------------------------------------------------------
(y <- adjust(E, x))

## ------------------------------------------------------------------------
violatedEdits(E, y$x, tol = 1e-2)

## ----echo=FALSE----------------------------------------------------------
set.seed(1976)

## ----tidy=FALSE----------------------------------------------------------
F <- editmatrix(expression(
x + y == z,
x >= 0,
y >= 0,
z >=0
))
N <- 100
dat <- data.frame(
x = runif(100),
y = rnorm(100),
z = rlnorm(100)
)

## ------------------------------------------------------------------------
A <- adjustRecords(F,dat)
summary(A)

## ------------------------------------------------------------------------
plot(A)

## ------------------------------------------------------------------------
E

## ----echo=TRUE,tidy=FALSE------------------------------------------------
rc <- data.frame(
row = c( 1, 1, 2, 2, 3, 3, 3, 4),
col = c( 1, 2, 3, 4, 2, 5, 6, 4),
coef = c(-1,-1,-1,-1, 1,-1,-1,-1)
)
b <- c(-950, -950, 0,0)

## ------------------------------------------------------------------------
e <- sparseConstraints(rc, b, neq=3, sorted=TRUE)
e

## ------------------------------------------------------------------------
x_sparse <- c(330, 700, 1000, 30, 500, 200)
(adjust(e, x_sparse))

## ----eval=FALSE,tidy=FALSE,highlight=FALSE-------------------------------
# library(LaF)
# ## Loading required package: Rcpp
# library(rspa)
# ## Loading required package: editrules
#
# # read A-matrix
# laf <- laf_open_fwf(
# file = "prob2A.txt",
# column_types = c("integer","integer","double"),
# column_widths = c(10,10,4)
# )
# rowcol <- laf[]
# laf <- close(laf)
#
# # read b-vector
# b <- read.csv("prob2b.txt",header=FALSE)[,1]
#
# # read x-vector
# x <- read.csv("prob2x.txt",header=FALSE)[,1]
#
# e <- sparseConstraints(rowcol,b,neq=length(b))
# e
# ## Sparse numerical constraints.
# ## Variables : 474948
# ## Restrictions: 60675 (printing 0)
#
# y <- adjust(e, x)
# y
# ## Object of class 'adjusted'
# ## Status : success (using 'sparse' method)
# ## Accuracy : 0.00770226
# ## Objective : 47430.5
# ## Iterations: 552
# ## Timing (s): 5.661
# ## Solution (truncated at 10):
# ## [1] 5.4028322 3.5246546 3.7979088 1.1202164 2.5304367 0.2037056
# ## [7] 97.9161357 1.5714899 4.5743395 -1.1756605

## ------------------------------------------------------------------------
e <- editmatrix(expression( x < 0, x > 1))
isFeasible(e)
adjust(e,c(x=0.5))

0 comments on commit f6d48bd

Please sign in to comment.