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

Example: Placing people on a photo More...

Public Types

enum  { BRANCH_NONE , BRANCH_DEGREE , BRANCH_AFC_SIZE }
 Branching to use for model. More...

Public Member Functions

 Photo (const SizeOptions &opt)
 Actual model.
bool slave (const MetaInfo &mi)
 Slave function for restarts.
 Photo (Photo &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< 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.

Protected Attributes

const PhotoSpec spec
 Photo specification.
IntVarArray pos
 Person's position on photo.
IntVar violations
 Number of violated preferences.
Rnd rnd
 Random number generator for LNS.
double p
 Relaxation probability.

(Note that these are not member symbols.)

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: Placing people on a photo

A group of people wants to take a group photo. Each person can give preferences next to whom he or she wants to be placed on the photo. The problem to be solved is to find a placement that violates as few preferences as possible.

Definition at line 77 of file photo.cpp.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum

Branching to use for model.

Enumerator
BRANCH_NONE 

Choose variables from left to right.

BRANCH_DEGREE 

Choose variable with largest degree.

BRANCH_AFC_SIZE 

Choose variable with largest afc over size.

Definition at line 91 of file photo.cpp.

Constructor & Destructor Documentation

◆ Photo() [1/2]

Photo::Photo ( const SizeOptions & opt)
inline

Actual model.

Definition at line 97 of file photo.cpp.

◆ Photo() [2/2]

Photo::Photo ( Photo & s)
inline

Constructor for cloning s.

Definition at line 143 of file photo.cpp.

Member Function Documentation

◆ slave()

bool Photo::slave ( const MetaInfo & mi)
inline

Slave function for restarts.

Definition at line 132 of file photo.cpp.

◆ copy()

virtual Space * Photo::copy ( void )
inlinevirtual

Copy during cloning.

Definition at line 150 of file photo.cpp.

◆ print()

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

Print solution.

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

Definition at line 155 of file photo.cpp.

◆ cost()

virtual IntVar Photo::cost ( void ) const
inlinevirtual

Return solution cost.

Definition at line 160 of file photo.cpp.

◆ main()

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

Main-function.

Definition at line 169 of file photo.cpp.

Member Data Documentation

◆ spec

const PhotoSpec Photo::spec
protected

Photo specification.

Definition at line 80 of file photo.cpp.

◆ pos

IntVarArray Photo::pos
protected

Person's position on photo.

Definition at line 82 of file photo.cpp.

◆ violations

IntVar Photo::violations
protected

Number of violated preferences.

Definition at line 84 of file photo.cpp.

◆ rnd

Rnd Photo::rnd
protected

Random number generator for LNS.

Definition at line 86 of file photo.cpp.

◆ p

double Photo::p
protected

Relaxation probability.

Definition at line 88 of file photo.cpp.


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