check whether problem with equality constraints is correctly constrained
import numpy as np
import hopsy
A = np.zeros((0, 2))
b = np.zeros((0,))
lower_bounds = [0, -0.5]
upper_bounds = [1, 2.0]
Aeq = np.array([[2., 1.]])
beq = np.array([1])
x0 = [0, 1]
problem = hopsy.Problem(
A,
b,
None,
)
print(problem)
problem = hopsy.add_box_constraints(
problem,
lower_bounds,
upper_bounds,
simplify=False,
)
print(problem)
problem = hopsy.add_equality_constraints(
problem,
Aeq,
beq
)
print(problem)
seed = 42
rng = np.random.default_rng(seed)
mc = hopsy.MarkovChain(
problem,
proposal=hopsy.UniformCoordinateHitAndRunProposal,
starting_point=x0
)
rng_hopsy = hopsy.RandomNumberGenerator(seed=seed)
acceptance_rate, states = hopsy.sample(
mc, rng_hopsy, n_samples=10000, thinning=2
)
raises
File ~/code/CADET-Process/debug_hopsy_rosenbrock.py:38
x0 = rosenbrock_problem.create_initial_values(10)
File ~/code/CADET-Process/CADETProcess/optimization/optimizationProblem.py:2866 in create_initial_values
acceptance_rate, states = hopsy.sample(
File ~/software/miniforge3/envs/dev/lib/python3.11/site-packages/hopsy/misc.py:1220 in sample
_accrates, _states = _sequential_sampling(
File ~/software/miniforge3/envs/dev/lib/python3.11/site-packages/hopsy/misc.py:864 in _sequential_sampling
accrate, state = markov_chain.draw(rng, thinning)
ValueError: UniformStepDistribution: Upper (inf) or lower limit (-inf) is unconstrained, therefore the draw is not well-defined. Try constraining the polytope with upper and lower bounds.
Edited by Johannes Schmölder