IBM ILOG Solver User's Manual > Local Search > Basic Local Search > More about neighborhoods > Basic neighborhoods

The following code generates a neighborhood which has a number of neighbors equal to the size of vars. Each neighbor sets one element of vars to the value value.

IloNHood IloSetToValue(IloEnv env,
                       IloNumVarArray vars,
                       IloInt value,
                       const char *name = 0);

The following code generates a neighborhood which has a number of neighbors equal to the size of vars times max - min + 1. The neighbors try to assign each variable an integer value ranging from min to max.

IloNHood IloChangeValue(IloEnv env,
                        IloNumVarArray vars,
                        IloInt min,
                        IloInt max,
                        const char *name = 0);

The following code generates a neighborhood which swaps the values of all pairs of variables in vars. Given that n is the size of the array vars, the size of this neighborhood is n * (n - 1) / 2.

IloNHood IloSwap(IloEnv env,
                 IloNumVarArray vars,
                 const char *name = 0);