All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.chocosolver.solver.constraints.unary.NotMember Maven / Gradle / Ivy

There is a newer version: 4.10.17
Show newest version
/*
 * This file is part of choco-solver, http://choco-solver.org/
 *
 * Copyright (c) 2023, IMT Atlantique. All rights reserved.
 *
 * Licensed under the BSD 4-clause license.
 *
 * See LICENSE file in the project root for full license information.
 */
package org.chocosolver.solver.constraints.unary;

import org.chocosolver.solver.constraints.Constraint;
import org.chocosolver.solver.constraints.ConstraintsName;
import org.chocosolver.solver.constraints.Propagator;
import org.chocosolver.solver.variables.IntVar;
import org.chocosolver.util.objects.setDataStructures.iterable.IntIterableRangeSet;

/**
 * 
* * @author Charles Prud'homme * @since 26 nov. 2010 */ public class NotMember extends Constraint { private final IntVar var; private final IntIterableRangeSet values; private final int lb, ub; // for JSON @SuppressWarnings("WeakerAccess") protected NotMember(IntVar var, int lb, int ub, IntIterableRangeSet values, Propagator prop) { super(ConstraintsName.NOTMEMBER, prop); this.var = var; this.values = values; this.lb = lb; this.ub = ub; } public NotMember(IntVar var, IntIterableRangeSet values) { this(var, 0, 0, values, new PropNotMember(var, values, false)); } public NotMember(IntVar var, int lowerbound, int upperbound) { this(var, lowerbound, upperbound, null, new PropNotMember(var, new IntIterableRangeSet(lowerbound, upperbound), false)); } @Override public Constraint makeOpposite() { if (values == null) { return new Member(var, lb, ub); } else { return new Member(var, values); } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy