Scippy

SCIP

Solving Constraint Integer Programs

ObjPricerVRP Class Reference

#include <pricer_vrp.h>

Public Member Functions

 ObjPricerVRP (SCIP *scip, const char *p_name, const int p_num_nodes, const int p_capacity, const vector< int > &p_demand, const vector< vector< int > > &p_distance, const vector< vector< SCIP_VAR * > > &p_arc_var, const vector< vector< SCIP_CONS * > > &p_arc_con, const vector< SCIP_CONS * > &p_part_con)
 
virtual ~ObjPricerVRP ()
 
virtual SCIP_DECL_PRICERINIT (scip_init)
 
virtual SCIP_DECL_PRICERREDCOST (scip_redcost)
 
virtual SCIP_DECL_PRICERFARKAS (scip_farkas)
 
SCIP_RETCODE pricing (SCIP *scip, bool isfarkas)
 
SCIP_RETCODE add_tour_variable (SCIP *scip, const list< int > &tour)
 
double find_shortest_tour (const vector< vector< double > > &length, list< int > &tour)
 

Protected Member Functions

int num_nodes () const
 
int capacity () const
 
int demand (const int i) const
 
double distance (const int i, const int j) const
 
SCIP_VAR * arc_var (const int i, const int j) const
 
SCIP_CONS * arc_con (const int i, const int j) const
 
SCIP_CONS * part_con (const int i) const
 
bool have_edge (const int i, const int j) const
 

Detailed Description

pricer class

Definition at line 36 of file pricer_vrp.h.

Constructor & Destructor Documentation

ObjPricerVRP::ObjPricerVRP ( SCIP *  scip,
const char *  p_name,
const int  p_num_nodes,
const int  p_capacity,
const vector< int > &  p_demand,
const vector< vector< int > > &  p_distance,
const vector< vector< SCIP_VAR * > > &  p_arc_var,
const vector< vector< SCIP_CONS * > > &  p_arc_con,
const vector< SCIP_CONS * > &  p_part_con 
)

Constructs the pricer object with the data needed

Constructs the pricer object with the data needed

An alternative is to have a problem data class which allows to access the data.

Parameters
scipSCIP pointer
p_namename of pricer
p_num_nodesnumber of nodes
p_capacityvehicle capacity
p_demanddemand array
p_distancematrix of distances
p_arc_varmatrix of arc variables
p_arc_conmatrix of arc constraints
p_part_conarray of partitioning constraints

Definition at line 41 of file pricer_vrp.cpp.

ObjPricerVRP::~ObjPricerVRP ( )
virtual

Destructs the pricer object.

Definition at line 64 of file pricer_vrp.cpp.

Member Function Documentation

virtual ObjPricerVRP::SCIP_DECL_PRICERINIT ( scip_init  )
virtual

initialization method of variable pricer (called after problem was transformed)

virtual ObjPricerVRP::SCIP_DECL_PRICERREDCOST ( scip_redcost  )
virtual

reduced cost pricing method of variable pricer for feasible LPs

virtual ObjPricerVRP::SCIP_DECL_PRICERFARKAS ( scip_farkas  )
virtual

farkas pricing method of variable pricer for infeasible LPs

SCIP_RETCODE ObjPricerVRP::pricing ( SCIP *  scip,
bool  isfarkas 
)

perform pricing

perform pricing

Parameters
scipSCIP data structure
isfarkaswhether we perform Farkas pricing

Definition at line 97 of file pricer_vrp.cpp.

References add_tour_variable(), arc_con(), find_shortest_tour(), num_nodes(), and part_con().

SCIP_RETCODE ObjPricerVRP::add_tour_variable ( SCIP *  scip,
const list< int > &  tour 
)

add tour variable to problem

Parameters
scipSCIP data structure
tourlist of nodes in tour

Definition at line 249 of file pricer_vrp.cpp.

References arc_con(), num_nodes(), and part_con().

Referenced by pricing().

SCIP_Real ObjPricerVRP::find_shortest_tour ( const vector< vector< double > > &  length,
list< int > &  tour 
)

return negative reduced cost tour (uses restricted shortest path dynamic programming algorithm)

return negative reduced cost tour (uses restricted shortest path dynamic programming algorithm)

The algorithm uses the priority queue implementation in pqueue.h. SCIP's implementation of priority queues cannot be used, since it currently does not support removal of elements that are not at the top.

Parameters
lengthmatrix of lengths
tourlist of nodes in tour

Definition at line 364 of file pricer_vrp.cpp.

References capacity(), demand(), have_edge(), and num_nodes().

Referenced by pricing().

int ObjPricerVRP::num_nodes ( ) const
inlineprotected

return number of nodes

Definition at line 87 of file pricer_vrp.h.

Referenced by add_tour_variable(), find_shortest_tour(), and pricing().

int ObjPricerVRP::capacity ( ) const
inlineprotected

return vehicle capacity

Definition at line 93 of file pricer_vrp.h.

Referenced by find_shortest_tour().

int ObjPricerVRP::demand ( const int  i) const
inlineprotected

return demand of node i

Parameters
inode

Definition at line 99 of file pricer_vrp.h.

Referenced by find_shortest_tour().

double ObjPricerVRP::distance ( const int  i,
const int  j 
) const
inlineprotected

return distance between nodes i and j

Parameters
ifirst node
jsecond node

Definition at line 107 of file pricer_vrp.h.

SCIP_VAR* ObjPricerVRP::arc_var ( const int  i,
const int  j 
) const
inlineprotected

return variable corresponding to arc between i and j

Parameters
ifirst node
jsecond node

Definition at line 116 of file pricer_vrp.h.

SCIP_CONS* ObjPricerVRP::arc_con ( const int  i,
const int  j 
) const
inlineprotected

return constraint corresponding to arc between i and j

Parameters
ifirst node
jsecond node

Definition at line 125 of file pricer_vrp.h.

Referenced by add_tour_variable(), and pricing().

SCIP_CONS* ObjPricerVRP::part_con ( const int  i) const
inlineprotected

return partitioning constraint for node i

Parameters
inode

Definition at line 134 of file pricer_vrp.h.

Referenced by add_tour_variable(), and pricing().

bool ObjPricerVRP::have_edge ( const int  i,
const int  j 
) const
inlineprotected

whether edge between node i and j exists

Parameters
ifirst node
jsecond node

Definition at line 142 of file pricer_vrp.h.

Referenced by find_shortest_tour().