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

Example: Packing squares into a rectangle More...

Public Types

enum  { PROP_REIFIED , PROP_CUMULATIVES }
 Propagation to use for model. More...

Public Member Functions

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

IntVarArray x
 Array of x-coordinates of squares.
IntVarArray y
 Array of y-coordinates of squares.

Specifications for perfect square problems

The first element is the number of squares to be placed, the second the size of the master square, and the remaining the sizes of the squares to be packed.

The data is taken from: C. J. Bouwkamp and A. J. W. Duijvestijn, Catalogue of Simple Perfect Squared Squares of Orders 21 Through 25, Eindhoven Univ. Technology, Dept. of Math., Report 92-WSK-03, Nov. 1992.

const int s00 []
 Main-function.
const int s01 []
 Main-function.
const int s02 []
 Main-function.
const int s03 []
 Main-function.
const int s04 []
 Main-function.
const int s05 []
 Main-function.
const int s06 []
 Main-function.
const int s07 []
 Main-function.
const int s08 []
 Main-function.
const int s09 []
 Main-function.
const int s10 []
 Main-function.
const int s11 []
 Main-function.
const int s12 []
 Main-function.
const int s13 []
 Main-function.
const int s14 []
 Main-function.
const int s15 []
 Main-function.
const int s16 []
 Main-function.
const int s17 []
 Main-function.
const int s18 []
 Main-function.
const int s19 []
 Main-function.
const int s20 []
 Main-function.
const int s21 []
 Main-function.
const int s22 []
 Main-function.
const int s23 []
 Main-function.
const int s24 []
 Main-function.
const int s25 []
 Main-function.
const int s26 []
 Main-function.
const int * specs []
 Main-function.
const unsigned int n_specs = sizeof(specs) / sizeof(int*)
 Main-function.
int main (int argc, char *argv[])
 Main-function.

Additional Inherited Members

Static Public Member Functions inherited from Gecode::Driver::ScriptBase< Driver::IgnoreStepOption< Space > >
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: Packing squares into a rectangle

See problem 9 at http://www.csplib.org/.

Definition at line 185 of file perfect-square.cpp.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum

Propagation to use for model.

Enumerator
PROP_REIFIED 

Use reified constraints.

PROP_CUMULATIVES 

Use cumulatives constraint.

Definition at line 193 of file perfect-square.cpp.

Constructor & Destructor Documentation

◆ PerfectSquare() [1/2]

PerfectSquare::PerfectSquare ( const SizeOptions & opt)
inline

Actual model.

Definition at line 198 of file perfect-square.cpp.

◆ PerfectSquare() [2/2]

PerfectSquare::PerfectSquare ( PerfectSquare & s)
inline

Constructor for cloning s.

Definition at line 273 of file perfect-square.cpp.

Member Function Documentation

◆ copy()

virtual Space * PerfectSquare::copy ( void )
inlinevirtual

Copy during cloning.

Definition at line 279 of file perfect-square.cpp.

◆ print()

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

Print solution.

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

Definition at line 284 of file perfect-square.cpp.

◆ s00

const int s00[]
related
Initial value:
= {
21, 112,
50,42,37,35,33,29,27,25,24,19,18,17,16,15,11,9,8,7,6,4,2
}

Main-function.

Definition at line 57 of file perfect-square.cpp.

◆ s01

const int s01[]
related
Initial value:
= {
22, 110,
60,50,28,27,26,24,23,22,21,18,17,16,15,14,13,12,8,7,6,4,3,2
}

Main-function.

Definition at line 61 of file perfect-square.cpp.

◆ s02

const int s02[]
related
Initial value:
= {
22, 192,
86,71,62,59,57,49,47,41,37,36,35,31,28,26,19,17,14,12,10,9,8,4
}

Main-function.

Definition at line 65 of file perfect-square.cpp.

◆ s03

const int s03[]
related
Initial value:
= {
23, 110,
44,41,38,37,32,31,29,28,21,19,16,15,14,13,12,10,8,7,5,4,3,2,1
}

Main-function.

Definition at line 69 of file perfect-square.cpp.

◆ s04

const int s04[]
related
Initial value:
= {
23, 332,
129,123,120,112,91,89,83,68,58,56,53,50,49,48,47,38,31,30,26,24,17,15,1
}

Main-function.

Definition at line 73 of file perfect-square.cpp.

◆ s05

const int s05[]
related
Initial value:
= {
24, 120,
47,46,41,40,34,33,32,25,23,20,19,17,16,15,14,13,12,10,9,8,6,5,4,3
}

Main-function.

Definition at line 77 of file perfect-square.cpp.

◆ s06

const int s06[]
related
Initial value:
= {
24, 479,
175,174,164,160,155,150,140,130,86,77,68,60,52,44,43,35,29,28,26,24,23,17,6,5
}

Main-function.

Definition at line 81 of file perfect-square.cpp.

◆ s07

const int s07[]
related
Initial value:
= {
25, 147,
74,73,41,40,34,33,32,27,25,23,20,19,17,16,15,14,13,12,10,9,8,6,5,4,3
}

Main-function.

Definition at line 85 of file perfect-square.cpp.

◆ s08

const int s08[]
related
Initial value:
= {
25, 661,
262,248,238,210,203,196,175,161,111,106,102,84,83,77,73,64,41,38,36,31,23,18,17,7,5
}

Main-function.

Definition at line 89 of file perfect-square.cpp.

◆ s09

const int s09[]
related
Initial value:
= {
26, 212,
99,85,65,62,57,56,55,48,39,38,32,28,26,24,23,20,19,17,16,12,7,6,5,4,2,1
}

Main-function.

Definition at line 93 of file perfect-square.cpp.

◆ s10

const int s10[]
related
Initial value:
= {
26, 214,
86,72,67,64,61,56,55,44,43,39,36,35,34,32,30,29,27,26,23,20,19,10,9,8,6,5
}

Main-function.

Definition at line 97 of file perfect-square.cpp.

◆ s11

const int s11[]
related
Initial value:
= {
26, 825,
304,302,288,277,246,235,233,189,157,135,127,117,109,92,90,83,81,76,57,53,49,37,26,25,8,5
}

Main-function.

Definition at line 101 of file perfect-square.cpp.

◆ s12

const int s12[]
related
Initial value:
= {
27, 180,
89,56,51,50,48,43,41,40,39,36,34,31,29,25,23,21,19,16,15,13,12,10,9,7,6,4,1
}

Main-function.

Definition at line 105 of file perfect-square.cpp.

◆ s13

const int s13[]
related
Initial value:
= {
27, 1179,
484,440,387,379,360,352,316,308,198,194,168,149,145,119,114,108,82,80,69,66,63,50,42,35,29,24,18
}

Main-function.

Definition at line 109 of file perfect-square.cpp.

◆ s14

const int s14[]
related
Initial value:
= {
28, 201,
77,70,68,67,64,56,54,39,38,36,34,32,30,24,22,21,18,17,16,13,12,11,10,6,4,3,2,1
}

Main-function.

Definition at line 113 of file perfect-square.cpp.

◆ s15

const int s15[]
related
Initial value:
= {
28, 1544,
649,615,510,473,456,439,419,385,260,216,214,208,203,175,147,135,125,116,104,94,81,55,49,17,12,7,6,4
}

Main-function.

Definition at line 117 of file perfect-square.cpp.

◆ s16

const int s16[]
related
Initial value:
= {
29, 255,
112,107,84,75,68,64,59,51,49,43,37,36,31,29,28,27,26,25,24,22,17,15,13,11,8,7,6,2,1
}

Main-function.

Definition at line 121 of file perfect-square.cpp.

◆ s17

const int s17[]
related
Initial value:
= {
29, 2134,
855,769,761,717,648,604,562,518,338,293,292,286,265,226,224,204,186,179,174,165,161,109,100,91,69,45,43,17,9
}

Main-function.

Definition at line 125 of file perfect-square.cpp.

◆ s18

const int s18[]
related
Initial value:
= {
30, 237,
88,82,79,76,73,56,53,46,45,43,40,39,36,34,33,32,29,27,25,24,23,21,20,16,11,10,9,5,3,1
}

Main-function.

Definition at line 129 of file perfect-square.cpp.

◆ s19

const int s19[]
related
Initial value:
= {
30, 2710,
992,981,948,936,826,782,781,737,465,440,418,289,272,264,260,242,227,210,208,154,140,124,122,108,92,64,29,16,15,4
}

Main-function.

Definition at line 133 of file perfect-square.cpp.

◆ s20

const int s20[]
related
Initial value:
= {
40, 510,
219,173,156,135,134,128,124,118,114,95,81,79,71,65,63,59,58,55,54,51,49,46,34,33,32,31,28,24,21,20,19,18,17,16,14,10,8,4,3,1
}

Main-function.

Definition at line 137 of file perfect-square.cpp.

◆ s21

const int s21[]
related
Initial value:
= {
40, 1121,
409,408,396,345,317,316,242,238,221,198,166,159,157,143,130,123,120,117,109,102,101,93,87,79,76,67,64,55,53,49,46,44,39,33,21,19,14,13,5,3
}

Main-function.

Definition at line 141 of file perfect-square.cpp.

◆ s22

const int s22[]
related
Initial value:
= {
50, 788,
301,300,246,242,187,182,177,168,145,139,135,128,114,110,103,93,87,84,82,81,79,73,69,63,58,57,52,51,49,47,41,40,34,33,26,23,22,21,20,19,18,15,13,11,10,9,8,7,4,2
}

Main-function.

Definition at line 145 of file perfect-square.cpp.

◆ s23

const int s23[]
related
Initial value:
= {
50, 1034,
588,446,305,283,175,163,160,138,132,130,128,124,120,116,110,107,106,103,101,100,94,86,85,82,80,77,74,64,63,62,61,60,57,54,47,46,45,43,40,39,32,30,28,27,26,25,22,7,6,1
}

Main-function.

Definition at line 149 of file perfect-square.cpp.

◆ s24

const int s24[]
related
Initial value:
= {
60, 1097,
645,452,268,264,204,188,184,176,172,165,161,143,132,127,116,114,108,104,100,94,92,90,88,84,75,74,72,71,69,68,67,64,62,61,56,51,46,36,34,30,29,28,26,25,21,20,19,18,17,16,15,14,12,10,9,7,5,4,2,1
}

Main-function.

Definition at line 153 of file perfect-square.cpp.

◆ s25

const int s25[]
related
Initial value:
= {
60, 1192,
638,554,335,303,285,271,219,180,174,159,149,148,136,125,110,98,94,85,77,76,75,74,72,71,69,65,63,62,61,60,59,57,55,51,50,49,48,47,46,45,44,43,40,39,37,35,32,31,25,16,15,14,12,10,9,8,6,4,2,1
}

Main-function.

Definition at line 157 of file perfect-square.cpp.

◆ s26

const int s26[]
related
Initial value:
= {
75, 1412,
793,619,473,320,287,207,188,181,179,170,167,153,151,149,142,140,132,127,121,117,116,106,105,103,97,93,92,91,90,87,84,83,82,76,74,73,72,71,70,69,67,66,65,64,63,61,54,53,49,45,39,38,35,34,33,32,30,29,28,27,26,24,21,20,19,18,15,14,13,11,10,9,6,5,3
}

Main-function.

Definition at line 161 of file perfect-square.cpp.

◆ specs

const int* specs[]
related
Initial value:
= {
&s00[0],&s01[0],&s02[0],&s03[0],&s04[0],
&s05[0],&s06[0],&s07[0],&s08[0],&s09[0],
&s10[0],&s11[0],&s12[0],&s13[0],&s14[0],
&s15[0],&s16[0],&s17[0],&s18[0],&s19[0],
&s20[0],&s21[0],&s22[0],&s23[0],&s24[0],
&s25[0],&s26[0]
}
const int s22[]
Main-function.
const int s20[]
Main-function.
const int s12[]
Main-function.
const int s05[]
Main-function.
const int s04[]
Main-function.
const int s15[]
Main-function.
const int s08[]
Main-function.
const int s02[]
Main-function.
const int s19[]
Main-function.
const int s21[]
Main-function.
const int s06[]
Main-function.
const int s23[]
Main-function.
const int s07[]
Main-function.
const int s09[]
Main-function.
const int s24[]
Main-function.
const int s03[]
Main-function.
const int s17[]
Main-function.
const int s14[]
Main-function.
const int s00[]
Main-function.
const int s10[]
Main-function.
const int s01[]
Main-function.
const int s11[]
Main-function.
const int s26[]
Main-function.
const int s16[]
Main-function.
const int s25[]
Main-function.
const int s18[]
Main-function.
const int s13[]
Main-function.

Main-function.

Definition at line 167 of file perfect-square.cpp.

◆ n_specs

const unsigned int n_specs = sizeof(specs) / sizeof(int*)
related

Main-function.

Definition at line 175 of file perfect-square.cpp.

◆ main()

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

Main-function.

Definition at line 296 of file perfect-square.cpp.

Member Data Documentation

◆ x

IntVarArray PerfectSquare::x
protected

Array of x-coordinates of squares.

Definition at line 188 of file perfect-square.cpp.

◆ y

IntVarArray PerfectSquare::y
protected

Array of y-coordinates of squares.

Definition at line 190 of file perfect-square.cpp.


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