[gecode-users] use the print () method
naguissa light
naguissa1989 at gmail.com
Fri Nov 15 22:49:36 CET 2013
I had a problem with the print () method actually ENTERING AND
MaximizeSpace I want to maximize my profit in the hand when I wanted
affichier the result with the print method the compiler m 'displays the
following error:
insufficient arguments in the apple function
I based my decision on this model already developed by you SendMoreMoney
model
below is an excerpt of my model
class manel : public MaximizeSpace {
protected:
IntVarArray l;
IntVar gain;
static const int n=3;//nbre des testeurs
static const int m=3;// nbre des noeuds
BoolVarArray a;
public:
manel(void): a(*this,m*n,0,1),gain(*this,0,100000) {
Matrix <BoolVarArray> X (a,m,n);
vector<int> R;
R.push_back(20);R.push_back(30);R.push_back(40);
vector<int> C;
C.push_back(50);C.push_back(60);C.push_back(70);
vector<int> B;
B.push_back(80);B.push_back(90);B.push_back(70);
vector<int> Dr;
Dr.push_back(10);Dr.push_back(15);Dr.push_back(5);
vector<int> Dc;
Dc.push_back(7);Dc.push_back(5);Dc.push_back(2);
vector<int> Db;
Db.push_back(10);Db.push_back(7);Db.push_back(2);
vector<vector<int>> g;
for(unsigned int i(0); i < n; ++i)
g.emplace_back(std::vector<int>(m));
for(int i=0; i<n; i++)
{
for (int j =0; j<m;j++)
g[i][j]==50;
}
//creation of constraints
// ... over rows
for ( int j=0; j<n;j++)
{
linear(*this , X.row(j),IRT_EQ,1);
}
//... over columns
for (int i = 0; i < m; i++) {
linear(*this, Dr,X.col(i),IRT_LQ,R[i]);
}
for (int i = 0; i < m; i++) {
linear (*this, Dc, X.col(i), IRT_LQ,C[i]);
}
for (int i = 0; i <m; i++) {
linear (*this, Db, X.col(i), IRT_LQ,B[i]);
}
//objectiv function
for (int i = 0; i < n; i++)
{
linear(*this, g[i],X.row(i), IRT_EQ, gain);
}
branch(*this, a, INT_VAR_SIZE_MAX(), INT_VAL_MAX());
}
manel(bool share, manel& s)
: MaximizeSpace(share, s) {
a.update(*this, share, s.a);
gain.update(*this, share, s.gain);
}
virtual Space* copy(bool share) {
return new manel(share,*this);// erreur : object de type classe
abstrait non autorisé
}
void print(std::ostream& os) const {
Matrix <BoolVarArray> X (a,m,n);
for(int i = 0; i < n; i++) {
for(int j = 0; j < m; j++)
// os << std::setw(4) << a[i * n + j];
std::cout << a<< std::endl;
os << std::endl;
}
os << std::endl;
}
// cost function
virtual IntVar cost(void) const {
return gain;
}
};
int main(int argc, char* argv[]) {
manel* m = new manel;
BAB<manel> e(m);
delete m;
while (manel* s = e.next()) {
(void) s->status();
s->print(); delete s;// arguments insuffisants dans l'apple de la
fonction
}
system("pause");
return 0;
i hope that you can help me with That
Naguissa
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.gecode.org/pipermail/users/attachments/20131115/1dad842e/attachment.html>
More information about the users
mailing list