steel-mill.cpp
Go to the documentation of this file.
/* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
/*
* Main authors:
* Mikael Lagerkvist <lagerkvist@gecode.org>
*
* Copyright:
* Mikael Lagerkvist, 2008
*
* This file is part of Gecode, the generic constraint
* development environment:
* http://www.gecode.org
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
*/
#include <gecode/driver.hh>
#include <gecode/int.hh>
#include <gecode/minimodel.hh>
#include <fstream>
using namespace Gecode;
typedef int (*order_t)[2];
extern const int order_weight;
extern const int order_color;
extern int csplib_capacities[];
extern unsigned int csplib_ncapacities;
extern unsigned int csplib_maxcapacity;
extern int csplib_loss[];
extern int csplib_orders[][2];
extern unsigned int csplib_ncolors;
extern unsigned int csplib_norders;
class SteelMillOptions : public Options {
private:
unsigned int _size;
int* _capacities;
int _ncapacities;
int _maxcapacity;
int* _loss;
order_t _orders;
int _ncolors;
unsigned int _norders;
public:
SteelMillOptions(const char* n)
: Options(n), _size(csplib_norders),
_capacities(csplib_capacities), _ncapacities(csplib_ncapacities),
_maxcapacity(csplib_maxcapacity),
_loss(csplib_loss), _orders(&(csplib_orders[0])), _ncolors(csplib_ncolors),
_norders(csplib_norders) {}
virtual void help(void);
bool parse(int& argc, char* argv[]);
unsigned int size(void) const { return _size; }
int* capacities(void) const { return _capacities; }
int ncapacities(void) const { return _ncapacities; }
int maxcapacity(void) const { return _maxcapacity; }
int* loss(void) const { return _loss; }
order_t orders(void) const { return _orders; }
int ncolors(void) const { return _ncolors; }
int norders(void) const { return _norders; }
};
class SortByWeight {
public:
order_t orders;
SortByWeight(order_t _orders) : orders(_orders) {}
bool operator() (int i, int j) {
// Order i comes before order j if the weight of i is larger than
// the weight of j.
return (orders[i][order_weight] > orders[j][order_weight]) ||
(orders[i][order_weight] == orders[j][order_weight] && i<j);
}
};
class SteelMill : public IntMinimizeScript {
protected:
int* capacities;
int ncapacities;
int maxcapacity;
int* loss;
int ncolors;
order_t orders;
unsigned int norders;
unsigned int nslabs;
IntVarArray slab,
slabload,
slabcost;
IntVar total_cost;
public:
enum {
SYMMETRY_NONE,
SYMMETRY_BRANCHING,
SYMMETRY_LDSB
};
SteelMill(const SteelMillOptions& opt)
: // Initialize instance data
IntMinimizeScript(opt),
capacities(opt.capacities()), ncapacities(opt.ncapacities()),
maxcapacity(opt.maxcapacity()), loss(opt.loss()),
ncolors(opt.ncolors()), orders(opt.orders()),
norders(opt.size()), nslabs(opt.size()),
// Initialize problem variables
slab(*this, norders, 0,nslabs-1),
slabload(*this, nslabs, 0,45),
slabcost(*this, nslabs, 0, Int::Limits::max),
total_cost(*this, 0, Int::Limits::max)
{
// Boolean variables for slab[o]==s
BoolVarArgs boolslab(norders*nslabs);
for (unsigned int i = 0; i < norders; ++i) {
BoolVarArgs tmp(nslabs);
for (int j = nslabs; j--; ) {
boolslab[j + i*nslabs] = tmp[j] = BoolVar(*this, 0, 1);
}
channel(*this, tmp, slab[i]);
}
// Packing constraints
for (unsigned int s = 0; s < nslabs; ++s) {
IntArgs c(norders);
BoolVarArgs x(norders);
for (int i = norders; i--; ) {
c[i] = orders[i][order_weight];
x[i] = boolslab[s + i*nslabs];
}
linear(*this, c, x, IRT_EQ, slabload[s]);
}
// Redundant packing constraint
int totalweight = 0;
for (unsigned int i = norders; i-- ; )
totalweight += orders[i][order_weight] ;
linear(*this, slabload, IRT_EQ, totalweight);
// Color constraints
IntArgs nofcolor(ncolors);
for (int c = ncolors; c--; ) {
nofcolor[c] = 0;
for (int o = norders; o--; ) {
if (orders[o][order_color] == c) nofcolor[c] += 1;
}
}
BoolVar f(*this, 0, 0);
for (unsigned int s = 0; s < nslabs; ++s) {
BoolVarArgs hascolor(ncolors);
for (int c = ncolors; c--; ) {
if (nofcolor[c]) {
BoolVarArgs hasc(nofcolor[c]);
int pos = 0;
for (int o = norders; o--; ) {
if (orders[o][order_color] == c)
hasc[pos++] = boolslab[s + o*nslabs];
}
assert(pos == nofcolor[c]);
hascolor[c] = BoolVar(*this, 0, 1);
rel(*this, BOT_OR, hasc, hascolor[c]);
} else {
hascolor[c] = f;
}
}
linear(*this, hascolor, IRT_LQ, 2);
}
// Compute slabcost
IntArgs l(maxcapacity, loss);
for (int s = nslabs; s--; ) {
element(*this, l, slabload[s], slabcost[s]);
}
linear(*this, slabcost, IRT_EQ, total_cost);
// Add branching
if (opt.symmetry() == SYMMETRY_BRANCHING) {
// Symmetry breaking branching
SteelMillBranch::post(*this);
} else if (opt.symmetry() == SYMMETRY_NONE) {
branch(*this, slab, INT_VAR_MAX_MIN(), INT_VAL_MIN());
} else { // opt.symmetry() == SYMMETRY_LDSB
// There is one symmetry: the values (slabs) are interchangeable.
Symmetries syms;
syms << ValueSymmetry(IntArgs::create(nslabs,0));
// For variable order we mimic the custom brancher. We use
// min-size domain, breaking ties by maximum weight (preferring
// to label larger weights earlier). To do this, we first sort
// (stably) by maximum weight, then use min-size domain.
SortByWeight sbw(orders);
IntArgs indices(norders);
for (unsigned int i = 0 ; i < norders ; i++)
indices[i] = i;
Support::quicksort(&indices[0],norders,sbw);
IntVarArgs sorted_orders(norders);
for (unsigned int i = 0 ; i < norders ; i++) {
sorted_orders[i] = slab[indices[i]];
}
branch(*this, sorted_orders, INT_VAR_SIZE_MIN(), INT_VAL_MIN(), syms);
}
}
virtual void
print(std::ostream& os) const {
os << "What slab=" << slab << std::endl;
os << "Slab load=" << slabload << std::endl;
os << "Slab cost=" << slabcost << std::endl;
os << "Total cost=" << total_cost << std::endl;
int nslabsused = 0;
int nslabscost = 0;
bool unassigned = false;
for (int i = nslabs; i--; ) {
if (!slabload[i].assigned() || !slabcost[i].assigned()) {
unassigned = true;
break;
}
if (slabload[i].min()>0) ++nslabsused;
if (slabcost[i].min()>0) ++nslabscost;
}
if (!unassigned)
os << "Number of slabs used=" << nslabsused
<< ", slabs with cost=" << nslabscost
<< std::endl;
os << std::endl;
}
SteelMill(SteelMill& s)
: IntMinimizeScript(s),
capacities(s.capacities), ncapacities(s.ncapacities),
maxcapacity(s.maxcapacity), loss(s.loss),
ncolors(s.ncolors), orders(s.orders),
norders(s.norders), nslabs(s.nslabs) {
slab.update(*this, s.slab);
slabload.update(*this, s.slabload);
slabcost.update(*this, s.slabcost);
total_cost.update(*this, s.total_cost);
}
virtual Space*
copy(void) {
return new SteelMill(*this);
}
virtual IntVar cost(void) const {
return total_cost;
}
class SteelMillBranch : Brancher {
protected:
mutable int start;
class Choice : public Gecode::Choice {
public:
int pos;
int val;
Choice(const Brancher& b, unsigned int a, int pos0, int val0)
: Gecode::Choice(b,a), pos(pos0), val(val0) {}
virtual void archive(Archive& e) const {
Gecode::Choice::archive(e);
e << alternatives() << pos << val;
}
};
SteelMillBranch(Home home)
: Brancher(home), start(0) {}
SteelMillBranch(Space& home, SteelMillBranch& b)
: Brancher(home, b), start(b.start) {
}
public:
virtual bool status(const Space& home) const {
const SteelMill& sm = static_cast<const SteelMill&>(home);
for (unsigned int i = start; i < sm.norders; ++i)
if (!sm.slab[i].assigned()) {
start = i;
return true;
}
// No non-assigned orders left
return false;
}
virtual Gecode::Choice* choice(Space& home) {
SteelMill& sm = static_cast<SteelMill&>(home);
assert(!sm.slab[start].assigned());
// Find order with a) minimum size, b) largest weight
unsigned int size = sm.norders;
int weight = 0;
unsigned int pos = start;
for (unsigned int i = start; i<sm.norders; ++i) {
if (!sm.slab[i].assigned()) {
if (sm.slab[i].size() == size &&
sm.orders[i][order_weight] > weight) {
weight = sm.orders[i][order_weight];
pos = i;
} else if (sm.slab[i].size() < size) {
size = sm.slab[i].size();
weight = sm.orders[i][order_weight];
pos = i;
}
}
}
unsigned int val = sm.slab[pos].min();
// Find first still empty slab (all such slabs are symmetric)
unsigned int firstzero = 0;
while (firstzero < sm.nslabs && sm.slabload[firstzero].min() > 0)
++firstzero;
assert(pos < sm.nslabs &&
val < sm.norders);
return new Choice(*this, (val<firstzero) ? 2 : 1, pos, val);
}
virtual Choice* choice(const Space&, Archive& e) {
unsigned int alt; int pos, val;
e >> alt >> pos >> val;
return new Choice(*this, alt, pos, val);
}
virtual ExecStatus commit(Space& home, const Gecode::Choice& _c,
unsigned int a) {
SteelMill& sm = static_cast<SteelMill&>(home);
const Choice& c = static_cast<const Choice&>(_c);
if (a)
return me_failed(Int::IntView(sm.slab[c.pos]).nq(home, c.val))
? ES_FAILED : ES_OK;
else
return me_failed(Int::IntView(sm.slab[c.pos]).eq(home, c.val))
? ES_FAILED : ES_OK;
}
virtual void print(const Space&, const Gecode::Choice& _c,
unsigned int a,
std::ostream& o) const {
const Choice& c = static_cast<const Choice&>(_c);
o << "slab[" << c.pos << "] "
<< ((a == 0) ? "=" : "!=")
<< " " << c.val;
}
virtual Actor* copy(Space& home) {
return new (home) SteelMillBranch(home, *this);
}
static void post(Home home) {
(void) new (home) SteelMillBranch(home);
}
virtual size_t dispose(Space&) {
return sizeof(*this);
}
};
};
int
main(int argc, char* argv[]) {
SteelMillOptions opt("Steel Mill Slab design");
opt.symmetry(SteelMill::SYMMETRY_BRANCHING);
opt.symmetry(SteelMill::SYMMETRY_NONE,"none");
opt.symmetry(SteelMill::SYMMETRY_BRANCHING,"branching");
opt.symmetry(SteelMill::SYMMETRY_LDSB,"ldsb");
opt.solutions(0);
if (!opt.parse(argc,argv))
return 1;
Script::run<SteelMill,BAB,SteelMillOptions>(opt);
return 0;
}
void
SteelMillOptions::help(void) {
Options::help();
std::cerr << "\t(string), optional" << std::endl
<< "\t\tBenchmark to load." << std::endl
<< "\t\tIf none is given, the standard CSPLib instance is used."
<< std::endl;
std::cerr << "\t(unsigned int), optional" << std::endl
<< "\t\tNumber of orders to use, in the interval [0..norders]."
<< std::endl
<< "\t\tIf none is given, all orders are used." << std::endl;
}
bool
SteelMillOptions::parse(int& argc, char* argv[]) {
Options::parse(argc,argv);
// Check number of arguments
if (argc >= 4) {
std::cerr << "Too many arguments given, max two allowed (given={";
for (int i = 1; i < argc; ++i) {
std::cerr << "\"" << argv[i] << "\"";
if (i < argc-1) std::cerr << ",";
}
std::cerr << "})." << std::endl;
return false;
}
// Parse options
while (argc >= 2) {
bool issize = true;
for (int i = strlen(argv[argc-1]); i-- && issize; )
issize &= (isdigit(argv[argc-1][i]) != 0);
if (issize) {
_size = atoi(argv[argc-1]);
} else {
std::ifstream instance(argv[argc-1]);
if (instance.fail()) {
std::cerr << "Argument \"" << argv[argc-1]
<< "\" is neither an integer nor a readable file"
<< std::endl;
return false;
}
// Read file instance
instance >> _ncapacities;
_capacities = new int[_ncapacities];
_maxcapacity = -1;
for (int i = 0; i < _ncapacities; ++i) {
instance >> _capacities[i];
_maxcapacity = std::max(_maxcapacity, _capacities[i]);
}
instance >> _ncolors >> _norders;
_orders = new int[_norders][2];
for (unsigned int i = 0; i < _norders; ++i) {
instance >> _orders[i][order_weight] >> _orders[i][order_color];
}
}
--argc;
}
// Compute loss
{
_loss = new int[_maxcapacity+1];
_loss[0] = 0;
int currcap = 0;
for (int c = 1; c < _maxcapacity; ++c) {
if (c > _capacities[currcap]) ++currcap;
_loss[c] = _capacities[currcap] - c;
}
}
// Set size, if none given
if (_size == 0) {
_size = _norders;
}
// Check size reasonability
if (_size == 0 || _size > _norders) {
std::cerr << "Size must be between 1 and " << _norders << std::endl;
return false;
}
return true;
}
// Positions in order array
const int order_weight = 0;
const int order_color = 1;
// CSPLib instance
int csplib_capacities[] =
{12, 14, 17, 18, 19,
20, 23, 24, 25, 26,
27, 28, 29, 30, 32,
35, 39, 42, 43, 44};
unsigned int csplib_ncapacities = 20;
unsigned int csplib_maxcapacity = 44;
int csplib_loss[45];
unsigned int csplib_ncolors = 89;
unsigned int csplib_norders = 111;
int csplib_orders[][2] = {
{4, 1},
{22, 2},
{9, 3},
{5, 4},
{8, 5},
{3, 6},
{3, 4},
{4, 7},
{7, 4},
{7, 8},
{3, 6},
{2, 6},
{2, 4},
{8, 9},
{5, 10},
{7, 11},
{4, 7},
{7, 11},
{5, 10},
{7, 11},
{8, 9},
{3, 1},
{25, 12},
{14, 13},
{3, 6},
{22, 14},
{19, 15},
{19, 15},
{22, 16},
{22, 17},
{22, 18},
{20, 19},
{22, 20},
{5, 21},
{4, 22},
{10, 23},
{26, 24},
{17, 25},
{20, 26},
{16, 27},
{10, 28},
{19, 29},
{10, 30},
{10, 31},
{23, 32},
{22, 33},
{26, 34},
{27, 35},
{22, 36},
{27, 37},
{22, 38},
{22, 39},
{13, 40},
{14, 41},
{16, 27},
{26, 34},
{26, 42},
{27, 35},
{22, 36},
{20, 43},
{26, 24},
{22, 44},
{13, 45},
{19, 46},
{20, 47},
{16, 48},
{15, 49},
{17, 50},
{10, 28},
{20, 51},
{5, 52},
{26, 24},
{19, 53},
{15, 54},
{10, 55},
{10, 56},
{13, 57},
{13, 58},
{13, 59},
{12, 60},
{12, 61},
{18, 62},
{10, 63},
{18, 64},
{16, 65},
{20, 66},
{12, 67},
{6, 68},
{6, 68},
{15, 69},
{15, 70},
{15, 70},
{21, 71},
{30, 72},
{30, 73},
{30, 74},
{30, 75},
{23, 76},
{15, 77},
{15, 78},
{27, 79},
{27, 80},
{27, 81},
{27, 82},
{27, 83},
{27, 84},
{27, 79},
{27, 85},
{27, 86},
{10, 87},
{3, 88}
};
// STATISTICS: example-any
Gecode::ActorLink::Actor
friend class Actor
Definition core.hpp:590
Gecode::Archive
Archive representation
Definition archive.hpp:42
Gecode::BaseOptions::help
virtual void help(void)
Print help text.
Definition options.cpp:494
Gecode::BaseOptions::parse
void parse(int &argc, char *argv[])
Parse options from arguments argv (number is argc).
Definition options.cpp:548
Gecode::BoolVarArgs
Passing Boolean variables.
Definition int.hh:712
Gecode::BoolVar
Boolean integer variables.
Definition int.hh:512
Gecode::Brancher::Space
friend class Space
Definition core.hpp:1444
Gecode::Brancher::Brancher
Brancher(Home home)
Constructor for creation.
Definition core.hpp:3605
Gecode::Brancher::Choice
friend class Choice
Definition core.hpp:1445
Gecode::Choice
Choice for performing commit
Definition core.hpp:1412
Gecode::Choice::archive
virtual void archive(Archive &e) const
Archive into e.
Definition core.cpp:891
Gecode::Choice::alternatives
unsigned int alternatives(void) const
Return number of alternatives.
Definition core.hpp:3770
Gecode::Driver::ScriptBase< Driver::IgnoreStepOption< Space > >::run
static void run(const Options &opt, Script *s=NULL)
Gecode::Home
Home class for posting propagators
Definition core.hpp:856
Gecode::IntArgs
Passing integer arguments.
Definition int.hh:628
Gecode::IntArgs::create
static IntArgs create(int n, int start, int inc=1)
Allocate array with n elements such that for all .
Definition array.hpp:76
Gecode::IntVarArgs
Passing integer variables.
Definition int.hh:656
Gecode::IntVarArray
Integer variable array.
Definition int.hh:763
Gecode::IntVar
Integer variables.
Definition int.hh:371
Gecode::Int::IntView
Integer view for integer variables.
Definition view.hpp:129
Gecode::Int::IntView::nq
ModEvent nq(Space &home, int n)
Restrict domain values to be different from n.
Definition int.hpp:157
Gecode::Int::IntView::eq
ModEvent eq(Space &home, int n)
Restrict domain values to be equal to n.
Definition int.hpp:166
Gecode::Options::Options
Options(const char *s)
Initialize options for script with name s.
Definition options.cpp:576
Gecode::Space
Computation spaces.
Definition core.hpp:1742
Gecode::Symmetries
Collection of symmetries.
Definition int.hh:5292
Gecode::VarArray::assigned
bool assigned(void) const
Test if all variables are assigned.
Definition array.hpp:1026
Gecode::VarArray::size
int size(void) const
Return size of array (number of elements).
Definition array.hpp:926
SortByWeight
Sort orders by weight.
Definition steel-mill.cpp:115
SortByWeight::SortByWeight
SortByWeight(order_t _orders)
Initialize orders.
Definition steel-mill.cpp:120
SortByWeight::operator()
bool operator()(int i, int j)
Sort order.
Definition steel-mill.cpp:122
SortByWeight::orders
order_t orders
The orders.
Definition steel-mill.cpp:118
SteelMillOptions
SteelMillOptions for examples with size option and an additional optional file name parameter.
Definition steel-mill.cpp:73
SteelMillOptions::size
unsigned int size(void) const
Return size.
Definition steel-mill.cpp:97
SteelMillOptions::ncapacities
int ncapacities(void) const
Return number of capacities.
Definition steel-mill.cpp:101
SteelMillOptions::maxcapacity
int maxcapacity(void) const
Return maximum of capacities.
Definition steel-mill.cpp:103
SteelMillOptions::ncolors
int ncolors(void) const
Return number of colors.
Definition steel-mill.cpp:109
SteelMillOptions::capacities
int * capacities(void) const
Return capacities.
Definition steel-mill.cpp:99
SteelMillOptions::orders
order_t orders(void) const
Return orders.
Definition steel-mill.cpp:107
SteelMillOptions::norders
int norders(void) const
Return number of orders.
Definition steel-mill.cpp:111
SteelMillOptions::loss
int * loss(void) const
Return loss values.
Definition steel-mill.cpp:105
SteelMillOptions::help
virtual void help(void)
Print help text.
Definition steel-mill.cpp:484
SteelMillOptions::SteelMillOptions
SteelMillOptions(const char *n)
Initialize options for example with name n.
Definition steel-mill.cpp:85
SteelMillOptions::parse
bool parse(int &argc, char *argv[])
Parse options from arguments argv (number is argc).
Definition steel-mill.cpp:497
SteelMill::SteelMillBranch::Choice
Choice
Definition steel-mill.cpp:356
SteelMill::SteelMillBranch::Choice::archive
virtual void archive(Archive &e) const
Archive into e.
Definition steel-mill.cpp:368
SteelMill::SteelMillBranch::Choice::Choice
Choice(const Brancher &b, unsigned int a, int pos0, int val0)
Definition steel-mill.cpp:365
SteelMill::SteelMillBranch::Choice::val
int val
Value of variable.
Definition steel-mill.cpp:361
SteelMill::SteelMillBranch::Choice::pos
int pos
Position of variable.
Definition steel-mill.cpp:359
SteelMill::SteelMillBranch::start
int start
Cache of first unassigned value.
Definition steel-mill.cpp:354
SteelMill::SteelMillBranch::dispose
virtual size_t dispose(Space &)
Delete brancher and return its size.
Definition steel-mill.cpp:459
SteelMill::SteelMillBranch::print
virtual void print(const Space &, const Gecode::Choice &_c, unsigned int a, std::ostream &o) const
Print explanation.
Definition steel-mill.cpp:442
SteelMill::SteelMillBranch::copy
virtual Actor * copy(Space &home)
Copy brancher.
Definition steel-mill.cpp:451
SteelMill::SteelMillBranch::commit
virtual ExecStatus commit(Space &home, const Gecode::Choice &_c, unsigned int a)
Perform commit for choice _c and alternative a.
Definition steel-mill.cpp:430
SteelMill::SteelMillBranch::SteelMillBranch
SteelMillBranch(Space &home, SteelMillBranch &b)
Copy constructor.
Definition steel-mill.cpp:378
SteelMill::SteelMillBranch::choice
virtual Gecode::Choice * choice(Space &home)
Return choice.
Definition steel-mill.cpp:395
SteelMill::SteelMillBranch::SteelMillBranch
SteelMillBranch(Home home)
Construct brancher.
Definition steel-mill.cpp:375
SteelMill::SteelMillBranch::post
static void post(Home home)
Post brancher.
Definition steel-mill.cpp:455
SteelMill::SteelMillBranch::status
virtual bool status(const Space &home) const
Check status of brancher, return true if alternatives left.
Definition steel-mill.cpp:384
SteelMill::SteelMillBranch::choice
virtual Choice * choice(const Space &, Archive &e)
Return choice from e.
Definition steel-mill.cpp:424
SteelMill::ncapacities
int ncapacities
Number of capacities.
Definition steel-mill.cpp:164
SteelMill::SteelMill
SteelMill(const SteelMillOptions &opt)
Actual model.
Definition steel-mill.cpp:191
SteelMill::SYMMETRY_BRANCHING
@ SYMMETRY_BRANCHING
Breaking symmetries with symmetry.
Definition steel-mill.cpp:186
SteelMill::SYMMETRY_LDSB
@ SYMMETRY_LDSB
Use LDSB for symmetry breaking.
Definition steel-mill.cpp:187
SteelMill::SYMMETRY_NONE
@ SYMMETRY_NONE
Simple symmetry.
Definition steel-mill.cpp:185
SteelMill::norders
unsigned int norders
Number of orders.
Definition steel-mill.cpp:169
SteelMill::print
virtual void print(std::ostream &os) const
Print solution.
Definition steel-mill.cpp:297
SteelMill::cost
virtual IntVar cost(void) const
Return solution cost.
Definition steel-mill.cpp:338
SteelMill::main
int main(int argc, char *argv[])
Main-function.
Definition steel-mill.cpp:469
SteelMill::slab
IntVarArray slab
Slab assigned to order i.
Definition steel-mill.cpp:176
SteelMill::copy
virtual Space * copy(void)
Copy during cloning.
Definition steel-mill.cpp:334
SteelMill::maxcapacity
int maxcapacity
Maximum capacity.
Definition steel-mill.cpp:165
SteelMill::nslabs
unsigned int nslabs
Number of slabs.
Definition steel-mill.cpp:170
SteelMill::slabcost
IntVarArray slabcost
Cost of slab j.
Definition steel-mill.cpp:178
SteelMill::total_cost
IntVar total_cost
Total cost.
Definition steel-mill.cpp:179
SteelMill::loss
int * loss
Loss for all sizes.
Definition steel-mill.cpp:166
SteelMill::ncolors
int ncolors
Number of colors.
Definition steel-mill.cpp:167
SteelMill::slabload
IntVarArray slabload
Load of slab j.
Definition steel-mill.cpp:177
SteelMill::capacities
int * capacities
Capacities.
Definition steel-mill.cpp:163
SteelMill::orders
order_t orders
Orders.
Definition steel-mill.cpp:168
SteelMill::SteelMill
SteelMill(SteelMill &s)
Constructor for cloning s.
Definition steel-mill.cpp:321
Test::Options::parse
void parse(int argc, char *argv[])
Parse commandline arguments.
Definition test.cpp:120
driver.hh
int.hh
Gecode::me_failed
bool me_failed(ModEvent me)
Check whether modification event me is failed.
Definition modevent.hpp:54
Gecode::IntMinimizeScript
Driver::ScriptBase< Driver::IgnoreStepOption< IntMinimizeSpace > > IntMinimizeScript
Base-class for scripts for finding solution of lowest integer cost.
Definition driver.hh:808
Gecode::branch
void branch(Home home, const FloatVarArgs &x, FloatVarBranch vars, FloatValBranch vals, FloatBranchFilter bf=nullptr, FloatVarValPrint vvp=nullptr)
Branch over x with variable selection vars and value selection vals.
Definition branch.cpp:39
Gecode::linear
void linear(Home home, const FloatVarArgs &x, FloatRelType frt, FloatVal c)
Post propagator for .
Definition linear.cpp:41
Gecode::rel
void rel(Home home, FloatVar x0, FloatRelType frt, FloatVar x1)
Post propagator for .
Definition rel.cpp:68
Gecode::IRT_EQ
@ IRT_EQ
Equality ( ).
Definition int.hh:926
Gecode::IRT_LQ
@ IRT_LQ
Less or equal ( ).
Definition int.hh:928
Gecode::BOT_OR
@ BOT_OR
Disjunction.
Definition int.hh:952
minimodel.hh
Gecode::Int::Limits
Numerical limits for integer variables.
Definition int.hh:114
Gecode::Int
Finite domain integers.
Gecode::Support::quicksort
void quicksort(Type *l, Type *r, Less &less)
Standard quick sort.
Definition sort.hpp:130
Gecode
Gecode toplevel namespace
Gecode::ValueSymmetry
SymmetryHandle ValueSymmetry(const IntArgs &v)
Values in v are interchangeable.
Definition ldsb.cpp:81
Gecode::channel
void channel(Home home, FloatVar x0, IntVar x1)
Post propagator for channeling a float and an integer variable .
Definition channel.cpp:41
Gecode::min
void min(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
Definition arithmetic.cpp:67
Gecode::element
void element(Home home, IntSharedArray n, IntVar x0, IntVar x1, IntPropLevel ipl=IPL_DEF)
Post domain consistent propagator for .
Definition element.cpp:39
Gecode::INT_VAR_MAX_MIN
IntVarBranch INT_VAR_MAX_MIN(BranchTbl tbl=nullptr)
Select variable with smallest max.
Definition var.hpp:196
Gecode::INT_VAL_MIN
IntValBranch INT_VAL_MIN(void)
Select smallest value.
Definition val.hpp:55
Gecode::ExecStatus
ExecStatus
Definition core.hpp:472
Gecode::ES_OK
@ ES_OK
Execution is okay.
Definition core.hpp:476
Gecode::ES_FAILED
@ ES_FAILED
Execution has resulted in failure.
Definition core.hpp:474
Gecode::max
void max(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
Definition arithmetic.cpp:49
Gecode::INT_VAR_SIZE_MIN
IntVarBranch INT_VAR_SIZE_MIN(BranchTbl tbl=nullptr)
Select variable with smallest domain size.
Definition var.hpp:206
csplib_maxcapacity
unsigned int csplib_maxcapacity
Maximum capacity.
Definition steel-mill.cpp:574
order_weight
const int order_weight
Weight-position in order-array elements.
Definition steel-mill.cpp:564
csplib_capacities
int csplib_capacities[]
Constants for CSPLib instance of the Steel Mill Slab Design Problem.
Definition steel-mill.cpp:568
csplib_ncolors
unsigned int csplib_ncolors
Number of colors.
Definition steel-mill.cpp:576
order_color
const int order_color
Color-position in order-array elements.
Definition steel-mill.cpp:565
csplib_orders
int csplib_orders[][2]
Orders.
Definition steel-mill.cpp:578
csplib_norders
unsigned int csplib_norders
Number of orders.
Definition steel-mill.cpp:577
csplib_loss
int csplib_loss[]
Loss for all sizes.
Definition steel-mill.cpp:575
order_t
int(* order_t)[2]
Order-specifications.
Definition steel-mill.cpp:48
csplib_ncapacities
unsigned int csplib_ncapacities
Number of capacities.
Definition steel-mill.cpp:573