SCIPreplaceCommonSubexpressions

Function SCIPreplaceCommonSubexpressions 

Source
pub unsafe extern "C" fn SCIPreplaceCommonSubexpressions(
    scip: *mut SCIP,
    exprs: *mut *mut SCIP_EXPR,
    nexprs: c_int,
    replacedroot: *mut c_uint,
) -> SCIP_RETCODE
Expand description

replaces common sub-expressions in a given expression graph by using a hash key for each expression

The algorithm consists of two steps:

  1. traverse through all given expressions and compute for each of them a (not necessarily unique) hash

  2. initialize an empty hash table and traverse through all expression; check for each of them if we can find a structural equivalent expression in the hash table; if yes we replace the expression by the expression inside the hash table, otherwise we add it to the hash table

@note the hash keys of the expressions are used for the hashing inside the hash table; to compute if two expressions (with the same hash) are structurally the same we use the function SCIPexprCompare().