<commit_before>#include <util/foreach.h>
#include "LinearConstraint.h"

LinearConstraint::LinearConstraint() :
	_relation(LessEqual) {}

void
LinearConstraint::setCoefficient(unsigned int varNum, double coef) {

	if (coef == 0) {

		_coefs.erase(_coefs.find(varNum));

	} else {

		_coefs[varNum] = coef;
	}
}

void
LinearConstraint::setRelation(Relation relation) {
<commit_msg>bugfix: LinearConstraints froze if unset coefficient was set to zero<commit_after>#include <util/foreach.h>
#include "LinearConstraint.h"

LinearConstraint::LinearConstraint() :
	_relation(LessEqual) {}

void
LinearConstraint::setCoefficient(unsigned int varNum, double coef) {

	if (coef == 0) {

		std::map<unsigned int, double>::iterator i = _coefs.find(varNum);
		if (i != _coefs.end())
			_coefs.erase(_coefs.find(varNum));

	} else {

		_coefs[varNum] = coef;
	}
}

void
LinearConstraint::setRelation(Relation relation) {

{'fraction_non_alphanumeric': 0.13671444321940462, 'fraction_numerical': 0.002205071664829107, 'mean_word_length': 5.827067669172933, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '806266', 'n_tokens_mistral': 341, 'n_tokens_neox': 314, 'n_words': 61}