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

Example: Independent sets in a graph More...

Public Member Functions

 IndSet (const SizeOptions &opt)
 Actual model.
 IndSet (IndSet &s)
 Constructor for cloning s.
virtual Spacecopy (void)
 Copy during cloning.
virtual void print (std::ostream &os) const
 Print solution.
virtual IntVar cost (void) const
 Return solution cost.
Public Member Functions inherited from Gecode::Driver::ScriptBase< Driver::IgnoreStepOption< IntMaximizeSpace > >
 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.

Protected Attributes

const Graphg
 Graph used
BoolVarArray v
 Whether vertex included in independent set.
IntVar k
 How many elements has indipendent set.

Graph specification for independent sets

const int e_20_10 []
 Main-function.
const Graph g_20_10 (20, 10, e_20_10)
 Main-function.
const int e_40_20 []
 Main-function.
const Graph g_40_20 (40, 20, e_40_20)
 Main-function.
int main (int argc, char *argv[])
 Main-function.

Additional Inherited Members

Static Public Member Functions inherited from Gecode::Driver::ScriptBase< Driver::IgnoreStepOption< IntMaximizeSpace > >
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: Independent sets in a graph

Definition at line 80 of file ind-set.cpp.

Constructor & Destructor Documentation

◆ IndSet() [1/2]

IndSet::IndSet ( const SizeOptions & opt)
inline

Actual model.

Definition at line 90 of file ind-set.cpp.

◆ IndSet() [2/2]

IndSet::IndSet ( IndSet & s)
inline

Constructor for cloning s.

Definition at line 104 of file ind-set.cpp.

Member Function Documentation

◆ copy()

virtual Space * IndSet::copy ( void )
inlinevirtual

Copy during cloning.

Definition at line 110 of file ind-set.cpp.

◆ print()

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

Print solution.

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

Definition at line 115 of file ind-set.cpp.

◆ cost()

virtual IntVar IndSet::cost ( void ) const
inlinevirtual

Return solution cost.

Definition at line 120 of file ind-set.cpp.

◆ e_20_10

const int e_20_10[]
related
Initial value:
= {
0, 4, 2,12, 12,14, 18,19, 7,10,
9,12, 5,11, 6,15, 3,18, 7,16
}

Main-function.

Definition at line 56 of file ind-set.cpp.

◆ g_20_10

const Graph g_20_10(20, 10, e_20_10)
related

Main-function.

◆ e_40_20

const int e_40_20[]
related
Initial value:
= {
21,30, 11,30, 19,38, 20,25, 11,24,
20,33, 8,39, 4, 5, 6,16, 5,32,
0, 9, 5,24, 25,28, 36,38, 14,20,
19,25, 11,22, 13,30, 7,36, 15,33
}

Main-function.

Definition at line 63 of file ind-set.cpp.

◆ g_40_20

const Graph g_40_20(40, 20, e_40_20)
related

Main-function.

◆ main()

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

Main-function.

Definition at line 130 of file ind-set.cpp.

Member Data Documentation

◆ g

const Graph& IndSet::g
protected

Graph used

Definition at line 83 of file ind-set.cpp.

◆ v

BoolVarArray IndSet::v
protected

Whether vertex included in independent set.

Definition at line 85 of file ind-set.cpp.

◆ k

IntVar IndSet::k
protected

How many elements has indipendent set.

Definition at line 87 of file ind-set.cpp.


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