GRBModel.feasRelax()


GRBModel.feasRelax()

Modifies theGRBModel对象创建可行性放松。请注意,您需要打电话优化on the result to compute the actual relaxed solution.

这feasibility relaxation is a model that, when solved, minimizes the amount by which the solution violates the bounds and linear constraints of the original model. This method provides a number of options for specifying the relaxation.

如果您指定relaxobjtype=0,可行性放松的目的是最小化绑定和约束违规的加权量子的总和。这lbpen.,Ubpen., 和rhspenarguments specify the cost per unit violation in the lower bounds, upper bounds, and linear constraints, respectively.

如果您指定relaxobjtype=1, the objective of the feasibility relaxation is to minimize the weighted sum of the squares of the bound and constraint violations. Thelbpen.,Ubpen., 和rhspenarguments specify the coefficients on the squares of the lower bound, upper bound, and linear constraint violations, respectively.

如果您指定relaxobjtype=2,可行性放松的目的是最大限度地减少绑定和约束违规的加权计数。这lbpen.,Ubpen., 和rhspenarguments specify the cost of violating a lower bound, upper bound, and linear constraint, respectively.

To give an example, if a constraint withrhspen价值pis violated by 2.0, it would contribute2*pto the feasibility relaxation objective forrelaxobjtype=0, it would contribute2*2*pforrelaxobjtype=1, 和it would contributepforrelaxobjtype=2.

minrelax参数是一个布尔值,可控制创建的可行性放松类型。如果minrelax=false, optimizing the returned model gives a solution that minimizes the cost of the violation. Ifminrelax=true, optimizing the returned model finds a solution that minimizes the original objective, but only from among those solutions that minimize the cost of the violation. Note thatfeasRelaxmust solve an optimization problem to find the minimum possible relaxation whenminrelax=true,这将是相当昂贵的。

这re are two signatures for this method. The more complex one takes a list of variables and constraints, as well as penalties associated with relaxing the corresponding lower bounds, upper bounds, and constraints. If a variable or constraint is not included in one of these lists, the associated bounds or constraints may not be violated. The simpler signature takes a pair of boolean arguments,vrelaxcrelax,表示可以违反可变界限和/或约束。如果vrelax/crelaxis真的, then every bound/constraint is allowed to be violated, respectively, and the associated cost is 1.0.

Note that this is a destructive method: it modifies the model on which it is invoked. If you don't want to modify your original model, use thegrbmodel构造函数在调用此方法之前创建副本。

double feasRelax( relaxobjtype,
布尔 minrelax,
GRBVar[] vars,
双倍的[] lbpen.,
双倍的[] Ubpen.,
GRBConstr[] 约束,
双倍的[] rhspen )
    Create a feasibility relaxation model.

    Arguments:

    relaxobjtype: The cost function used when finding the minimum cost relaxation.

    minrelax: The type of feasibility relaxation to perform.

    vars:允许违反其范围的变量。

    lbpen.:违反可变下限的惩罚。参数中每个变量的一个条目vars.

    Ubpen.: Penalty for violating a variable upper bound. One entry for each variable in argumentvars.

    constrs: Linear constraints that are allowed to be violated.

    rhspen: Penalty for violating a linear constraint. One entry for each constraint in argumentconstrs.

    Arguments:

    Return value:

    Zero ifminrelaxis false. Ifminrelaxis true, the return value is the objective value for the relaxation performed. If the value is less than 0, it indicates that the method failed to create the feasibility relaxation.

double feasRelax( relaxobjtype,
布尔 minrelax,
布尔 vrelax,
布尔 CRELAX)
    制造可行性放松模型的简化方法。

    Arguments:

    relaxobjtype: The cost function used when finding the minimum cost relaxation.

    minrelax: The type of feasibility relaxation to perform.

    vrelax: Indicates whether variable bounds can be relaxed (with a cost of 1.0 for any violations.

    crelax: Indicates whether linear constraints can be relaxed (with a cost of 1.0 for any violations.

    Return value:

    Zero ifminrelaxis false. Ifminrelaxis true, the return value is the objective value for the relaxation performed. If the value is less than 0, it indicates that the method failed to create the feasibility relaxation.