public class PolytopeRunner extends Object
RandomWalk
.Constructor and Description |
---|
PolytopeRunner(ConstraintsSystem constraintsSystem) |
PolytopeRunner(ConstraintsSystem constraintsSystem,
boolean removeRedundantConstraints,
boolean skipZeroElements) |
PolytopeRunner(ConstraintsSystem constraintsSystem,
GLPSolver glpSolver,
boolean skipZeroElements) |
PolytopeRunner(ConstraintsSystem constraintsSystem,
GLPSolver glpSolver,
boolean skipZeroElements,
double eps) |
Modifier and Type | Method and Description |
---|---|
double[][] |
chain(RandomWalk randomWalk,
ThinningFunction thinningFunction,
int numberOfSamples)
Generates a chain of samples starting from
startPoint . |
void |
chain(RandomWalk randomWalk,
ThinningFunction thinningFunction,
int numberOfSamples,
SampleConsumer consumer)
Generates a chain of samples starting from
startPoint . |
double[] |
getStartPoint()
Gets start point used as an initial point in methods
chain and neighborhood . |
double[][] |
neighborhood(RandomWalk randomWalk,
int numberOfSamples)
Generates samples from the neighborhood of
startPoint . |
void |
neighborhood(RandomWalk randomWalk,
int numberOfSamples,
SampleConsumer consumer)
Generates samples from the neighborhood of
startPoint . |
void |
setAnyStartPoint()
Sets start point for methods
chain and neighborhood . |
void |
setAnyStartPoint(GLPSolver glpSolver)
Sets start point for methods
chain and neighborhood . |
void |
setStartPoint(double[] startPoint)
Sets start point for methods
chain and neighborhood . |
public PolytopeRunner(ConstraintsSystem constraintsSystem)
constraintsSystem
- system of constraintspublic PolytopeRunner(ConstraintsSystem constraintsSystem, boolean removeRedundantConstraints, boolean skipZeroElements)
constraintsSystem
- system of constraintsremoveRedundantConstraints
- whether to remove redundant constraints (after initial transformation) or not;
use for better performance if there may be some redundant constrainsskipZeroElements
- whether RandomWalk
should iterate over array of indices of non-zero
elements or directly over entire transformed matrix A (from constraintsSystem
)public PolytopeRunner(ConstraintsSystem constraintsSystem, GLPSolver glpSolver, boolean skipZeroElements)
constraintsSystem
- system of constraintsglpSolver
- solver; if not null redundant constrains will be removed;
provide for better performance if there may be some redundant constrainsskipZeroElements
- whether RandomWalk
should iterate over array of indices of non-zero
elements or directly over entire transformed matrix A (from constraintsSystem
)public PolytopeRunner(ConstraintsSystem constraintsSystem, GLPSolver glpSolver, boolean skipZeroElements, double eps)
constraintsSystem
- system of constraintsglpSolver
- solver; if not null redundant constrains will be removed;
provide for better performance if there may be some redundant constrainsskipZeroElements
- whether RandomWalk
should iterate over array of indices of non-zero
elements or directly over entire transformed matrix A (from constraintsSystem
)eps
- absolute error to accept in floating point comparisons (non-negative, default 1e-10)public void chain(RandomWalk randomWalk, ThinningFunction thinningFunction, int numberOfSamples, SampleConsumer consumer)
startPoint
. The method uses
startPoint
for storing next steps and finally startPoint
is set
to the last sample from the chain - to be a start point in next call of chain
or neighborhood
.randomWalk
- samplerthinningFunction
- thinningFunction (see polyrun.thinning
)numberOfSamples
- number of samplesconsumer
- samples consumerpublic void neighborhood(RandomWalk randomWalk, int numberOfSamples, SampleConsumer consumer)
startPoint
. The method does not change
startPoint
.randomWalk
- samplernumberOfSamples
- number of samplesconsumer
- samples consumerpublic double[][] chain(RandomWalk randomWalk, ThinningFunction thinningFunction, int numberOfSamples)
startPoint
. The method uses
startPoint
for storing next steps and finally it is set to the last sample from the chain
to be a start point in next call of chain
or neighborhood
.randomWalk
- samplerthinningFunction
- thinning function (see polyrun.thinning
)numberOfSamples
- number of samplespublic double[][] neighborhood(RandomWalk randomWalk, int numberOfSamples)
startPoint
. The method does not change
startPoint
.randomWalk
- samplernumberOfSamples
- number of samplespublic void setAnyStartPoint() throws UnboundedSystemException, InfeasibleSystemException
chain
and neighborhood
. Set point is calculated by slack
maximization between edges.UnboundedSystemException
- if a polytope is tried to be built on top of unbounded system of constraints
(in such a case polytope cannot be sampled)InfeasibleSystemException
- if a polytope is tried to be built on top of infeasible system of constraints
(in such a case polytope cannot be sampled)public void setAnyStartPoint(GLPSolver glpSolver) throws UnboundedSystemException, InfeasibleSystemException
chain
and neighborhood
. Set point is calculated by slack
maximization between edges.glpSolver
- solver for General Linear Programing problem (e.g., CommonsMathGLPSolverWrapper
)UnboundedSystemException
- if a polytope is tried to be build on top of unbounded system of constraints
(in such a case polytope cannot be sampled)InfeasibleSystemException
- if a polytope is tried to be build on top of infeasible system of constraints
(in such a case polytope cannot be sampled)public void setStartPoint(double[] startPoint)
chain
and neighborhood
.startPoint
- point to be setIllegalArgumentException
- if a startPoint is not an interior point of the polytopepublic double[] getStartPoint()
chain
and neighborhood
.Copyright © 2021. All rights reserved.