Generated on Thu Jan 16 2025 00:00:00 for Gecode by doxygen 1.14.0

Example: Clique-based graph coloring More...

Public Types

enum  { MODEL_NONE , MODEL_CLIQUE }
 Model variants. More...
enum  {
  BRANCH_DEGREE , BRANCH_SIZE , BRANCH_DEGREE_SIZE , BRANCH_AFC_SIZE ,
  BRANCH_ACTION_SIZE
}
 Branching to use for model. More...
enum  { SYMMETRY_NONE , SYMMETRY_LDSB }
 Symmetry variants. More...

Public Member Functions

 GraphColor (const SizeOptions &opt)
 The actual model.
virtual IntVar cost (void) const
 Cost function.
 GraphColor (GraphColor &s)
 Constructor for cloning s.
virtual Spacecopy (void)
 Copying during cloning.
virtual void print (std::ostream &os) const
 Print the solution.
Public Member Functions inherited from Gecode::Driver::ScriptBase< Driver::IgnoreStepOption< IntMinimizeSpace > >
 ScriptBase (const Options &opt)
 Constructor.
 ScriptBase (ScriptBase &e)
 Constructor used for cloning.
virtual void compare (const Space &home, std::ostream &os) const
 Compare with s.
Public Member Functions inherited from Gecode::Driver::IgnoreStepOption< BaseSpace >
 IgnoreStepOption (const Options &)
 Constructor.
 IgnoreStepOption (BaseSpace &e)
 Constructor used for cloning.

Graph specification for graph coloring

The edges are described by an array of integers with even number of elements, terminated by the elements -1,-1. The cliques are described by an array of integers, where the first integer gives the size of the clique, the following elements are nodes for each clique. The cliques are terminated by -1 for clique size

const int g1_e []
 First example graph: edges.
const int g1_c []
 First example graph: cliques.
const GraphColorSpec g1 (200, g1_e, g1_c)
 First example graph.
const int g2_e []
 Second example graph: edges.
const int g2_c []
 Second example graph: cliques.
const GraphColorSpec g2 (200, g2_e, g2_c)
 Second example graph.
int main (int argc, char *argv[])
 Main-function.

Additional Inherited Members

Static Public Member Functions inherited from Gecode::Driver::ScriptBase< Driver::IgnoreStepOption< IntMinimizeSpace > >
static std::ostream & select_ostream (const char *sn, std::ofstream &ofs)
 Choose output stream according to sn.
static void run (const Options &opt, Script *s=NULL)

Detailed Description

Example: Clique-based graph coloring

Definition at line 311 of file graph-color.cpp.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum

Model variants.

Enumerator
MODEL_NONE 

No lower bound.

MODEL_CLIQUE 

Use maximal clique size as lower bound.

Definition at line 320 of file graph-color.cpp.

◆ anonymous enum

anonymous enum

Branching to use for model.

Enumerator
BRANCH_DEGREE 

Choose variable with largest degree.

BRANCH_SIZE 

Choose variablee with smallest size.

BRANCH_DEGREE_SIZE 

Choose variable with largest degree/size.

BRANCH_AFC_SIZE 

Choose variable with largest afc/size.

BRANCH_ACTION_SIZE 

Choose variable with smallest size/action.

Definition at line 325 of file graph-color.cpp.

◆ anonymous enum

anonymous enum

Symmetry variants.

Enumerator
SYMMETRY_NONE 

Simple symmetry.

SYMMETRY_LDSB 

Use LDSB for value symmetry breaking.

Definition at line 333 of file graph-color.cpp.

Constructor & Destructor Documentation

◆ GraphColor() [1/2]

GraphColor::GraphColor ( const SizeOptions & opt)
inline

The actual model.

Definition at line 338 of file graph-color.cpp.

◆ GraphColor() [2/2]

GraphColor::GraphColor ( GraphColor & s)
inline

Constructor for cloning s.

Definition at line 414 of file graph-color.cpp.

Member Function Documentation

◆ cost()

virtual IntVar GraphColor::cost ( void ) const
inlinevirtual

Cost function.

Definition at line 410 of file graph-color.cpp.

◆ copy()

virtual Space * GraphColor::copy ( void )
inlinevirtual

Copying during cloning.

Definition at line 420 of file graph-color.cpp.

◆ print()

virtual void GraphColor::print ( std::ostream & os) const
inlinevirtual

Print the solution.

Reimplemented from Gecode::Driver::ScriptBase< Driver::IgnoreStepOption< IntMinimizeSpace > >.

Definition at line 425 of file graph-color.cpp.

◆ g1_e

const int g1_e[]
related

First example graph: edges.

Definition at line 66 of file graph-color.cpp.

◆ g1_c

const int g1_c[]
related

First example graph: cliques.

Definition at line 118 of file graph-color.cpp.

◆ g1

const GraphColorSpec g1(200, g1_e, g1_c)
related

First example graph.

◆ g2_e

const int g2_e[]
related

Second example graph: edges.

Definition at line 192 of file graph-color.cpp.

◆ g2_c

const int g2_c[]
related

Second example graph: cliques.

Definition at line 228 of file graph-color.cpp.

◆ g2

const GraphColorSpec g2(200, g2_e, g2_c)
related

Second example graph.

◆ main()

int main ( int argc,
char * argv[] )
related

Main-function.

Definition at line 442 of file graph-color.cpp.


The documentation for this class was generated from the following file: