| 概述 | 组 | 树 | 图形 | 不推荐 | 索引 | 概念 |

IloAnd实例代表一个连接约束。 换句话说,它定义了任意数量约束条件之间的逻辑连接-AND。 它可以让你在模型中表示约束上的约束。 由于 "IloAnd实例本身就是一个约束条件,因此可以通过成员函数 "IloAnd::add向 "IloAnd实例添加约束条件,从而建立广泛的连接关系。 You can also remove constraints from an instance of IloAnd by means of the member function IloAnd::remove.
连接约束的元素必须在同一环境中。
为了使约束生效,必须使用模板 "IloAdd或成员函数 "IloModel::add将其添加到模型中,并使用成员函数 "IloAlgorithm::extract提取算法模型。
该类中的大多数成员函数都包含 "assert语句。 有关宏 "NDEBUG(打开或关闭这些 "assert语句的方法)的解释,请参阅Assert 和 NDEBUG 概念。
目标的结合
如果您想在模型中表示目标(而不是约束条件)的连接,那么您应该考虑使用函数 "IloAndGoal(记录在《IBMILOG 求解器参考手册》中)。
提取的内容
All the constraints (that is, instances of IloConstraint or one of its subclasses) that have been added to a conjunctive constraint (an instance of IloAnd) and that have not been removed from it will be extracted when an algorithm such as IloCplex, IloCP, or IloSolver extracts the constraint.
示例
例如,您可以编写:
IloAndand(env); and.add(constraint1); and.add(constraint2); and.add(constraint3);
这些线条相当于 :
IloAndand =constraint1&&constraint2&&constraint3;
另请参阅:
IloConstraint,IloOr,operator&&
| 方法概要 | |
|---|---|
public void | add(const IloConstraintArray array) const |
public void | add(const IloConstraint constraint) const |
public IloAndI * | getImpl() const |
public | IloAnd() |
public | IloAnd(IloAndI * impl) |
public | IloAnd(const IloEnv env, const char * name=0) |
public void | remove(const IloConstraintArray array) const |
public void | remove(const IloConstraint constraint) const |
从 "IloConstraint继承的方法 |
|---|
getImpl, IloConstraint, IloConstraint |
从 "IloIntExprArg继承的方法 |
|---|
getImpl, IloIntExprArg, IloIntExprArg |
从 "IloNumExprArg继承的方法 |
|---|
getImpl, IloNumExprArg, IloNumExprArg |
| 方法详细信息 |
|---|
该构造函数创建了一个连接约束,用于环境 "env。 为了使约束生效,必须使用模板 "IloAdd或成员函数 "IloModel::add将其添加到模型中,并使用成员函数 "IloAlgorithm::extract提取算法模型。
可选参数 "name默认设置为 "0。
该成员函数使 "array中的所有元素都成为调用连接约束的元素。 换句话说,它将调用的连接约束应用于 "array的所有元素。
add会向 Concert Technology 算法通知调用对象的这一变化。该成员函数使 "constraint成为调用连接约束的元素之一。 换句话说,它将调用的连接约束应用于 "constraint。
add会向 Concert Technology 算法通知调用对象的这一变化。该成员函数从调用的连接约束中移除 "array的所有元素,使调用的连接约束不再适用于这些元素中的任何一个。
remove会向 Concert Technology 算法通知调用对象的这一变化。该成员函数将 "constraint从调用的连接约束中移除,使调用的连接约束不再适用于 "constraint。
remove会向 Concert Technology 算法通知调用对象的这一变化。