## Simplex-specific Methods

Some of the most commonly-used methods when working with Simplex are listed in the table below.

Table 2.3. Common Simplex-specific methods

Method(s) Description
primal(int mode=0) This applies the primal algorithm. If mode is set to the default of 0, then the method uses the status variables to determine basis and solution. If mode is 1 then the method does a values pass so variables not in basis are given their current values and one pass of variables is done to clean up the basis with an equal or better objective value.
dual(int mode=0) This applies the dual algorithm. if mode is set to the default of 0, then the method uses the status variables to determine basis and solution. If mode is 1 then the method uses input duals and does a values pass so one pass of basic variables is done to clean up the duals with an equal or better objective value.
scaling(int mode=1) This method toggles scaling on (mode set to 1) and off (mode set to 0).
int crash(double gap,int mode) This method attemps to improve on an all slack basis. For dual this will move variables to the dual feasible bound if the gap between bounds is less than gap. Setting mode to 0 guesses which algorithm is better, while a value of 1 or 2 will result in more work being done. The return code is 0 if the basis was not slacks in first case, it is negative if dual is preferred or positive if primal. ±1 means an all slack basis seemed best, while ±2 means some work was done.
perturb(int mode) This method toggles perturbation on (mode set to 1) and off (mode set to 0). It should be considered a work in progress, although on some problems it gives very good results.
factorizationFrequency()
setFactorizationFrequency(int value)
These are "get" and "set" methods for the basis matrix factorization frequency. The default is to refactor every 200 iterations, but it may make more sense to use something such as 100 + the number of rows divided by 50.
dualBound()
setDualBound(double value)
These are "get" and "set" methods for the "dual bound". The CLP dual algorithm declares all problems to be dual feasible by putting non-basic variables to correct bounds for the reduced cost. If the gap between the bounds is too big then it pretends the gap is only the value specified by this set method. In essence, this gives a composite dual rather than a pure Phase I- Phase II method.
infeasibilityCost()
setInfeasibilityCost(double value)
These are the primal analogs to the "dual bound" methods.
numberPrimalInfeasibilities()
sumPrimalInfeasibilities()
After a solve, there may be infeasibilities. These methods serve to check for said infeasibilities. One could check the solution explicitly as well. For a code fragement illustrating this, see Example 2.3, “Presolve code fragment”.