SCIPgetProbvarLinearSum

Function SCIPgetProbvarLinearSum 

Source
pub unsafe extern "C" fn SCIPgetProbvarLinearSum(
    scip: *mut SCIP,
    vars: *mut *mut SCIP_VAR,
    scalars: *mut f64,
    nvars: *mut c_int,
    varssize: c_int,
    constant: *mut f64,
    requiredsize: *mut c_int,
) -> SCIP_RETCODE
Expand description

Transforms a given linear sum of variables, that is a_1x_1 + … + a_nx_n + c into a corresponding linear sum of active variables, that is b_1y_1 + … + b_my_m + d.

If the number of needed active variables is greater than the available slots in the variable array, nothing happens except that an upper bound on the required size is stored in the variable requiredsize; otherwise, the active variable representation is stored in the arrays.

The reason for this approach is that we cannot reallocate memory, since we do not know how the memory has been allocated (e.g., by a C++ ‘new’ or SCIP functions). Note that requiredsize is an upper bound due to possible cancelations.

@return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref SCIP_Retcode “SCIP_RETCODE” for a complete list of error codes.

@pre This method can be called if @p scip is in one of the following stages: - \ref SCIP_STAGE_TRANSFORMED - \ref SCIP_STAGE_INITPRESOLVE - \ref SCIP_STAGE_PRESOLVING - \ref SCIP_STAGE_EXITPRESOLVE - \ref SCIP_STAGE_PRESOLVED - \ref SCIP_STAGE_INITSOLVE - \ref SCIP_STAGE_SOLVING - \ref SCIP_STAGE_SOLVED - \ref SCIP_STAGE_EXITSOLVE - \ref SCIP_STAGE_FREETRANS

@note The resulting linear sum is stored into the given variable array, scalar array, and constant. That means the given entries are overwritten.

@note That method can be used to convert a single variables into variable space of active variables. Therefore call the method with the linear sum 1.0*x + 0.0.