Scippy

GCG

Branch-and-Price & Column Generation for Everyone

solver_mip.c File Reference

Detailed Description

pricing solver solving the pricing problem as a sub-MIP, using SCIP

Author
Gerald Gamrath
Martin Bergner
Christian Puchert

Definition in file solver_mip.c.

#include <assert.h>
#include <string.h>
#include "gcg/solver_mip.h"
#include "scip/cons_linear.h"
#include "scip/cons_knapsack.h"
#include "gcg/gcg.h"
#include "gcg/pricer_gcg.h"
#include "gcg/pub_solver.h"
#include "scip/scipdefplugins.h"
#include "gcg/pub_gcgcol.h"

Go to the source code of this file.

Data Structures

struct  GCG_SolverData
 

Macros

#define SOLVER_NAME   "mip"
 
#define SOLVER_DESC   "pricing solver solving the pricing problem as a sub-MIP, using SCIP"
 
#define SOLVER_PRIORITY   0
 
#define SOLVER_HEURENABLED   TRUE
 
#define SOLVER_EXACTENABLED   TRUE
 
#define DEFAULT_CHECKSOLS   TRUE
 
#define DEFAULT_STARTNODELIMIT   1000LL
 
#define DEFAULT_STARTSTALLNODELIMIT   100LL
 
#define DEFAULT_STARTGAPLIMIT   0.2
 
#define DEFAULT_STARTSOLLIMIT   10
 
#define DEFAULT_NODELIMITFAC   1.0
 
#define DEFAULT_STALLNODELIMITFAC   1.0
 
#define DEFAULT_GAPLIMITFAC   0.8
 
#define DEFAULT_SOLLIMITFAC   1.0
 
#define DEFAULT_SETTINGSFILE   "-"
 
#define DEFAULT_ENABLE_WARNINGS   FALSE
 
#define solverInitMip   NULL
 
#define solverExitMip   NULL
 
#define solverUpdateMip   NULL
 

Functions

static SCIP_RETCODE resolvePricingWithoutPresolving (SCIP *pricingprob)
 
static SCIP_RETCODE checkSolNew (SCIP *pricingprob, SCIP_SOL **sols, int idx, SCIP_Bool *isnew)
 
static SCIP_Bool solutionHasInfiniteValue (SCIP *pricingprob, SCIP_SOL *sol)
 
static SCIP_RETCODE solveProblem (GCG *gcg, SCIP *pricingprob, int probnr, GCG_SOLVERDATA *solverdata, SCIP_Real *lowerbound, GCG_PRICINGSTATUS *status)
 
static GCG_DECL_SOLVERFREE (solverFreeMip)
 
static GCG_DECL_SOLVERINITSOL (solverInitsolMip)
 
static GCG_DECL_SOLVEREXITSOL (solverExitsolMip)
 
static GCG_DECL_SOLVERSOLVE (solverSolveMip)
 
static GCG_DECL_SOLVERSOLVEHEUR (solverSolveHeurMip)
 
SCIP_RETCODE createColumnFromRay (GCG *gcg, SCIP *pricingprob, SCIP *subproblem, SCIP_HASHMAP *varmap, int probnr, GCG_COL **newcol)
 
GCG_PRICINGSTATUS getPricingstatus (SCIP *pricingprob)
 
SCIP_RETCODE getColumnsFromPricingprob (GCG *gcg, SCIP *pricingprob, SCIP *subproblem, SCIP_HASHMAP *varmap, int probnr, SCIP_Bool checksols)
 
SCIP_RETCODE GCGincludeSolverMip (GCG *gcg)
 

Macro Definition Documentation

◆ SOLVER_NAME

#define SOLVER_NAME   "mip"

Definition at line 52 of file solver_mip.c.

◆ SOLVER_DESC

#define SOLVER_DESC   "pricing solver solving the pricing problem as a sub-MIP, using SCIP"

Definition at line 53 of file solver_mip.c.

◆ SOLVER_PRIORITY

#define SOLVER_PRIORITY   0

Definition at line 54 of file solver_mip.c.

◆ SOLVER_HEURENABLED

#define SOLVER_HEURENABLED   TRUE

indicates whether the heuristic solving method of the solver should be enabled

Definition at line 55 of file solver_mip.c.

◆ SOLVER_EXACTENABLED

#define SOLVER_EXACTENABLED   TRUE

indicates whether the exact solving method of the solver should be enabled

Definition at line 56 of file solver_mip.c.

◆ DEFAULT_CHECKSOLS

#define DEFAULT_CHECKSOLS   TRUE

should solutions be checked extensively

Definition at line 58 of file solver_mip.c.

◆ DEFAULT_STARTNODELIMIT

#define DEFAULT_STARTNODELIMIT   1000LL

start node limit for heuristic pricing

Definition at line 59 of file solver_mip.c.

◆ DEFAULT_STARTSTALLNODELIMIT

#define DEFAULT_STARTSTALLNODELIMIT   100LL

start stalling node limit for heuristic pricing

Definition at line 60 of file solver_mip.c.

◆ DEFAULT_STARTGAPLIMIT

#define DEFAULT_STARTGAPLIMIT   0.2

start gap limit for heuristic pricing

Definition at line 61 of file solver_mip.c.

◆ DEFAULT_STARTSOLLIMIT

#define DEFAULT_STARTSOLLIMIT   10

start solution limit for heuristic pricing

Definition at line 62 of file solver_mip.c.

◆ DEFAULT_NODELIMITFAC

#define DEFAULT_NODELIMITFAC   1.0

factor by which to increase node limit for heuristic pricing (1.0: add start limit)

Definition at line 63 of file solver_mip.c.

◆ DEFAULT_STALLNODELIMITFAC

#define DEFAULT_STALLNODELIMITFAC   1.0

factor by which to increase stalling node limit for heuristic pricing (1.0: add start limit)

Definition at line 64 of file solver_mip.c.

◆ DEFAULT_GAPLIMITFAC

#define DEFAULT_GAPLIMITFAC   0.8

factor by which to decrease gap limit for heuristic pricing (1.0: subtract start limit)

Definition at line 65 of file solver_mip.c.

◆ DEFAULT_SOLLIMITFAC

#define DEFAULT_SOLLIMITFAC   1.0

factor by which to increase solution limit for heuristic pricing (1.0: add start limit)

Definition at line 66 of file solver_mip.c.

◆ DEFAULT_SETTINGSFILE

#define DEFAULT_SETTINGSFILE   "-"

settings file to be applied in pricing problems

Definition at line 67 of file solver_mip.c.

◆ DEFAULT_ENABLE_WARNINGS

#define DEFAULT_ENABLE_WARNINGS   FALSE

should warnings (of pricing problems) be enabled by default

Definition at line 68 of file solver_mip.c.

◆ solverInitMip

#define solverInitMip   NULL

initialization method of pricing solver (called after problem was transformed and solver is active)

Definition at line 339 of file solver_mip.c.

◆ solverExitMip

#define solverExitMip   NULL

deinitialization method of pricing solver (called before transformed problem is freed and solver is active)

Definition at line 342 of file solver_mip.c.

◆ solverUpdateMip

#define solverUpdateMip   NULL

Definition at line 405 of file solver_mip.c.

Function Documentation

◆ resolvePricingWithoutPresolving()

static SCIP_RETCODE resolvePricingWithoutPresolving ( SCIP *  pricingprob)
static

solves the pricing problem again without presolving

Parameters
pricingprobpricing problem to solve again

Definition at line 102 of file solver_mip.c.

References NULL, SCIP_CALL, SCIP_OKAY, SCIPfreeTransform(), SCIPsetIntParam(), SCIPsolve(), and SCIPtransformProb().

Referenced by solveProblem().

◆ checkSolNew()

static SCIP_RETCODE checkSolNew ( SCIP *  pricingprob,
SCIP_SOL **  sols,
int  idx,
SCIP_Bool *  isnew 
)
static

checks whether the given solution is equal to one of the former solutions in the sols array

Parameters
pricingprobpricing problem SCIP data structure
solsarray of solutions
idxindex of the solution
isnewpointer to store whether the solution is new

Definition at line 119 of file solver_mip.c.

References FALSE, NULL, SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIP_SOLORIGIN_ORIGINAL, SCIPallocBufferArray, SCIPfreeBufferArray, SCIPgetNVars(), SCIPgetSolOrigObj(), SCIPgetSolVal(), SCIPgetSolVals(), SCIPgetVars(), SCIPisEQ(), SCIPisInfinity(), SCIPsolGetOrigin(), and TRUE.

Referenced by getColumnsFromPricingprob().

◆ solutionHasInfiniteValue()

static SCIP_Bool solutionHasInfiniteValue ( SCIP *  pricingprob,
SCIP_SOL *  sol 
)
static

check whether a column contains an infinite solution value

Parameters
pricingprobpricing problem SCIP data structure
solsolution to be checked

Definition at line 178 of file solver_mip.c.

References FALSE, SCIP_Bool, SCIPgetNOrigVars(), SCIPgetOrigVars(), SCIPgetSolVal(), SCIPisInfinity(), and TRUE.

Referenced by getColumnsFromPricingprob().

◆ solveProblem()

◆ GCG_DECL_SOLVERFREE()

static GCG_DECL_SOLVERFREE ( solverFreeMip  )
static

destructor of pricing solver to free user data (called when SCIP is exiting)

Definition at line 319 of file solver_mip.c.

References GCGgetDwMasterprob(), GCGsolverGetData(), GCGsolverSetData(), NULL, SCIP_OKAY, and SCIPfreeBlockMemory.

◆ GCG_DECL_SOLVERINITSOL()

static GCG_DECL_SOLVERINITSOL ( solverInitsolMip  )
static

◆ GCG_DECL_SOLVEREXITSOL()

static GCG_DECL_SOLVEREXITSOL ( solverExitsolMip  )
static

solving process deinitialization method of pricing solver (called before branch and bound process data is freed)

Definition at line 381 of file solver_mip.c.

References GCG_SolverData::curgaplimit, GCG_SolverData::curnodelimit, GCG_SolverData::cursollimit, GCG_SolverData::curstallnodelimit, GCGgetMasterprob(), GCGgetNPricingprobs(), GCGsolverGetData(), NULL, SCIP_OKAY, and SCIPfreeBlockMemoryArray.

◆ GCG_DECL_SOLVERSOLVE()

static GCG_DECL_SOLVERSOLVE ( solverSolveMip  )
static

◆ GCG_DECL_SOLVERSOLVEHEUR()

◆ createColumnFromRay()

SCIP_RETCODE createColumnFromRay ( GCG *  gcg,
SCIP *  pricingprob,
SCIP *  subproblem,
SCIP_HASHMAP *  varmap,
int  probnr,
GCG_COL **  newcol 
)

extracts ray from a subproblem used to solve a pricing problem pricing problem (or directly from the pricing problem if no subproblem is specified)

Parameters
gcgGCG data structure
pricingprobpricing problem SCIP data structure
subproblemSCIP data structure that contains the actual solution (if NULL pricingprob will be used)
varmapmapping of pricingprob vars to subproblem vars (can be NULL if subproblem is NULL)
probnrproblem number
newcolcolumn pointer to store new column

Definition at line 521 of file solver_mip.c.

References GCGcreateGcgCol(), NULL, SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIPallocBufferArray, SCIPdebugMessage, SCIPfreeBufferArray, SCIPfreeSolve(), SCIPgetNOrigVars(), SCIPgetOrigVars(), SCIPgetPrimalRayVal(), SCIPhashmapGetImage(), SCIPhasPrimalRay(), SCIPinfinity(), SCIPisInfinity(), SCIPisZero(), SCIPtransformProb(), SCIPvarGetName(), SCIPvarGetObj(), and TRUE.

Referenced by solveProblem().

◆ getPricingstatus()

◆ getColumnsFromPricingprob()

SCIP_RETCODE getColumnsFromPricingprob ( GCG *  gcg,
SCIP *  pricingprob,
SCIP *  subproblem,
SCIP_HASHMAP *  varmap,
int  probnr,
SCIP_Bool  checksols 
)

transforms feasible solutions of a subproblem used to solve a pricing problem pricing problem into columns (or directly of the pricing problem if no subproblem is specified)

Parameters
gcgGCG data structure
pricingprobpricing problem SCIP data structure
subproblemSCIP data structure that contains the actual solution (if NULL pricingprob will be used)
varmapmapping of pricingprob vars to subproblem vars (can be NULL if subproblem is NULL)
probnrproblem number
checksolsshould solutions be checked extensively

Definition at line 652 of file solver_mip.c.

References checkSolNew(), FALSE, GCGcreateGcgColFromSol(), GCGpricerAddCol(), NULL, SCIP_Bool, SCIP_CALL, SCIP_OKAY, SCIPcheckSolOrig(), SCIPcreateFiniteSolCopy(), SCIPdebugMessage, SCIPgetNSols(), SCIPgetProbName(), SCIPgetSols(), SCIPinfinity(), SCIPwarningMessage(), solutionHasInfiniteValue(), and TRUE.

Referenced by solveProblem().

◆ GCGincludeSolverMip()