transforming starting points for equality constraints
Check how we can transform problem.starting_point when we add equality constraints. Perhaps we can use np.linalg.lstsq and check if the starting point still fulfills the constraints.
Or perhaps hops.revert is already good enough. Then we just have to adapt hopsy.add_equality constraints to also transform the point, like hopsy.round.
For both functions we should add a check for the starting point and warn users if it did not work
Example:
problem = hopsy.Problem(np.row_stack((np.identity(num_meas), -np.identity(num_meas))),
np.concatenate((np.ones(num_meas), np.zeros(num_meas))),
hopsy.Gaussian(meas_values, np.diagflat(np.square(meas_std))))
problem.starting_point = meas_values
print(np.all(problem.A.dot(meas_values) <= problem.b))
problem = hopsy.add_equality_constraints(problem, np.ones(num_meas).reshape((1, -1)), np.ones(1))
problem.transformation = None
problem.shift = None
_, samples = hopsy.sample(hopsy.MarkovChain(problem, hopsy.TruncatedGaussianProposal),
hopsy.RandomNumberGenerator(42),
n_samples=1,
thinning=int(num_meas))
Edited by Jadebeck, Johann Fredrik