GRBfeasrelax
GRBfeasrelax
㈡ | GRBfeasrelax( | GRBmodel | *model, |
㈡ | relaxobjtype, | ||
㈡ | minrelax, | ||
double | *lbpen, | ||
double | * UBPEN, | ||
double | *rhspen, | ||
double | *feasobjP ) |
Modifies the input model to create a feasibility relaxation. Note that you need to callGRBoptimizeon 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 routine provides a number of options for specifying the relaxation.
如果you specifyrelaxobjtype=0
, the objective of the feasibility relaxation is to minimize the sum of the weighted magnitudes of the bound and constraint violations. Thelbpen.
,Ubpen.
, andrhspen
arguments specify the cost per unit violation in the lower bounds, upper bounds, and linear constraints, respectively.
如果you specifyrelaxobjtype=1
, the objective of the feasibility relaxation is to minimize the weighted sum of the squares of the bound and constraint violations. Thelbpen.
,Ubpen.
, andrhspen
arguments specify the coefficients on the squares of the lower bound, upper bound, and linear constraint violations, respectively.
如果you specifyrelaxobjtype=2
,可行性放松的目的是最大限度地减少绑定和约束违规的加权计数。这lbpen.
,Ubpen.
, andrhspen
arguments specify the cost of violating a lower bound, upper bound, and linear constraint, respectively.
To give an example, a violation of 2.0 on constrainti
would contribute2*rhspen[i]
to the feasibility relaxation objective forrelaxobjtype=0
, it would contribute2*2*rhspen[i]
forrelaxobjtype=1
, and it would contributerhspen[i]
forrelaxobjtype=2
.
这minrelax
参数是一个布尔值,可控制创建的可行性放松类型。如果minrelax=0
, optimizing the returned model gives a solution that minimizes the cost of the violation. Ifminrelax=1
, 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 thatGRBfeasrelax
必须解决优化问题,以找到最低可能的放松minrelax=1
,这将是相当昂贵的。
In all cases, you can specify a penalty ofGRB_INFINITY
to indicate that a specific bound or linear constraint may not be violated.
Note that this is a destructive routine: it modifies the model passed to it. If you don't want to modify your original model, useGRBcopymodelto create a copy before calling this routine.
Return value:
A non-zero return value indicates that a problem occurred while computing the feasibility relaxation. Refer to theError Codetable for a list of possible return values. Details on the error can be obtained by callinggrbgeterramsg..
Arguments:
model:original (infeasible) model. The model is modified by this routine.
relaxobjtype:cost function used when finding the minimum cost relaxation.
minrelax:type of feasibility relaxation to perform.
lbpen.:与违反下限相关的罚款。可NULL, in which case no lower bound violations are allowed.
Ubpen.:penalty associated with violating an upper bound. Can beNULL,在这种情况下,不允许违规违规。
rhspen:penalty associated with violating a linear constraint. Can beNULL, in which case no constraint violations are allowed.
feasobjP: Whenminrelax=1, this returns the objective value for the minimum cost relaxation.
示例用法:
double penalties[]; error = GRBfeasrelax(model, 0, 0, NULL, NULL, penalties, NULL); error = GRBoptimize(model);