[gecode-users] generation of a solution with success but no display at the console
Vincent Barichard
Vincent.Barichard at univ-angers.fr
Sat Jul 6 09:24:28 CEST 2013
Hi,
I wrote you a new test.cpp file. I found very basic mistakes in your file.
Please read Gecode documentation and try a little harder, you would have
probably found these errors yourself.
Best regards,
Vincent
2013/7/6 manel askri <askri.manel1 at gmail.com>
> hi evry one !
>
> i have modified a littel bit my code but i still get the same error : no
> solution
>
> so i have a question : because i work with two solvers gecode and choco :
> is it necessairy if choco finds a solution for a problem gecode will to????
> ( because my code here does have a solution with choco but with gecode no
> and i dont know if is it because my code is incorrect or what ????,,)
>
> See the test.cpp attached files
>
> so if any one have any idea about my question i will be so greatful
>
> Thanks very much
>
> ASKRI MAnel
>
>
> 2013/7/4 Vincent Barichard <Vincent.Barichard at univ-angers.fr>
>
>> You should read the files in the "examples" directory.
>> By making your example inherits from Script, you see that it has no
>> solution.
>> See the test.cpp attached file.
>>
>> Vincent
>>
>>
>> 2013/7/4 Christian Schulte <cschulte at kth.se>
>>
>>> Please read MPG, at least the introductory material (especially Chapter
>>> 3 answers your question). This mailing list assumes that you read the
>>> documentation and not that it is being spoon-fed to you on the users
>>> mailing list.****
>>>
>>> ** **
>>>
>>> Christian****
>>>
>>> ** **
>>>
>>> --****
>>>
>>> Christian Schulte, Professor of Computer Science, KTH,
>>> www.ict.kth.se/~cschulte/****
>>>
>>> ** **
>>>
>>> *From:* users-bounces at gecode.org [mailto:users-bounces at gecode.org] *On
>>> Behalf Of *manel askri
>>> *Sent:* Thursday, July 04, 2013 4:21 AM
>>> *To:* users at gecode.org; users-request at gecode.org; users-owner at gecode.org
>>> *Subject:* [gecode-users] generation of a solution with success but no
>>> display at the console****
>>>
>>> ** **
>>>
>>> hi every one!****
>>>
>>> ** **
>>>
>>> i m new with gecode and this is my first model, it consists in
>>> displaying the following result :****
>>>
>>> ** **
>>>
>>> 2 19 22 12 10****
>>>
>>> 11 13 18 17 6****
>>>
>>> 21 16 1 7 20****
>>>
>>> 8 14 15 24 4****
>>>
>>> 23 3 9 5 25****
>>>
>>> CSTE_65:65 ****
>>>
>>> ** **
>>>
>>> so this is my code :****
>>>
>>> #include <gecode/int.hh>****
>>>
>>> #include <gecode/driver.hh>****
>>>
>>> #include <gecode/minimodel.hh>****
>>>
>>> #include <gecode/search.hh>****
>>>
>>> ** **
>>>
>>> using namespace Gecode;****
>>>
>>> ** **
>>>
>>> class E1 : public Space {****
>>>
>>> private :****
>>>
>>> ****
>>>
>>> static const int n =5;****
>>>
>>> protected:****
>>>
>>> ** **
>>>
>>> IntVarArray v1;****
>>>
>>> ** **
>>>
>>> IntVar v2;****
>>>
>>> ** **
>>>
>>> public:****
>>>
>>> ** **
>>>
>>> E1(void) : v1(*this, n*n,1,n*n),
>>> v2(*this,n*(n*n+1)/2,n*(n*n+1)/2){****
>>>
>>> ****
>>>
>>> distinct (*this, v1);****
>>>
>>> IntVarArgs rowArray (*this,n , 1, n);****
>>>
>>> IntVarArgs colArray (*this,n , 1, n);****
>>>
>>> IntVarArgs diag1Array (*this,n , 1, n);****
>>>
>>> IntVarArgs diag2Array (*this,n , 1, n);****
>>>
>>> ** **
>>>
>>> ****
>>>
>>> ****
>>>
>>> //IntVarArgs sumConstraints ;****
>>>
>>> ** **
>>>
>>> for (int i =0; i<n;i++)****
>>>
>>> {****
>>>
>>> for (int j=0; j<n; j++)****
>>>
>>> {****
>>>
>>> rowArray[j]= v1[i*n+1];*
>>> ***
>>>
>>> colArray[j]= v1[j*n+1];*
>>> ***
>>>
>>> }****
>>>
>>> ****
>>>
>>> // rel (*this, sum(rowArray),IRT_EQ, v2);****
>>>
>>> // rel ( *this , sum(colArray), IRT_EQ ,v2);****
>>>
>>> ** **
>>>
>>> linear( *this , rowArray, IRT_EQ, v2);****
>>>
>>> linear( *this , colArray, IRT_EQ, v2);****
>>>
>>> diag1Array[i]=v1[i * n + i];****
>>>
>>> diag2Array[i]= v1[i*n+n-i-1];****
>>>
>>> }****
>>>
>>> ** **
>>>
>>> //rel(*this , sum(diag1Array), IRT_EQ,v2);****
>>>
>>> //rel(*this, sum(diag2Array), IRT_EQ,v2);****
>>>
>>> ** **
>>>
>>> ****
>>>
>>> linear( *this , diag1Array, IRT_EQ, v2);****
>>>
>>> linear( *this , diag2Array, IRT_EQ, v2);****
>>>
>>> ** **
>>>
>>> ** **
>>>
>>> // post branching****
>>>
>>> branch(*this, v1, INT_VAR_SIZE_MIN(),
>>> INT_VAL_MIN());****
>>>
>>> ** **
>>>
>>> }****
>>>
>>> // search support****
>>>
>>> E1(bool share, E1& s) : Space(share, s) {****
>>>
>>> v1.update(*this, share, s.v1);****
>>>
>>> ****
>>>
>>> }****
>>>
>>> ** **
>>>
>>> virtual Space* copy(bool share) {****
>>>
>>> return new E1(share,*this);****
>>>
>>> }****
>>>
>>> ** **
>>>
>>> // print solution****
>>>
>>> void print(void) const {****
>>>
>>> for(int i = 0; i < n; i++) {****
>>>
>>> for(int j = 0; j < n; j++) {****
>>>
>>> v1[i * n + j];****
>>>
>>> std::cout << v1[i * n +
>>> j] << std::endl;****
>>>
>>> ****
>>>
>>> }****
>>>
>>> }****
>>>
>>> }****
>>>
>>> ** **
>>>
>>> };****
>>>
>>> // main function****
>>>
>>> int main(int argc, char* argv[]) {****
>>>
>>> // create model and search engine****
>>>
>>> E1* m = new E1;****
>>>
>>> DFS<E1> e(m);****
>>>
>>> delete m;****
>>>
>>> // search and print all solutions****
>>>
>>> while (E1* s = e.next()) {****
>>>
>>> s->print(); delete s;****
>>>
>>> }****
>>>
>>> return 0;****
>>>
>>> }****
>>>
>>> ** **
>>>
>>> my problem is that when i generat the solution i do it successfly but
>>> when i use the command prompt to execute the executable the console
>>> displays nothing****
>>>
>>> so please if any one have any idea obout this i will be so greatful ****
>>>
>>> ** **
>>>
>>> thanks very much for any help****
>>>
>>> ** **
>>>
>>> ASKRI Manel****
>>>
>>> ** **
>>>
>>> ****
>>>
>>> ** **
>>>
>>> ** **
>>>
>>> _______________________________________________
>>> Gecode users mailing list
>>> users at gecode.org
>>> https://www.gecode.org/mailman/listinfo/gecode-users
>>>
>>>
>>
>>
>> --
>> Vincent Barichard Université d'Angers (LERIA)
>> Tel: 02 41 73 52 06 Département Informatique
>> Fax: 02 41 73 50 73 H203
>>
>
>
--
Vincent Barichard Université d'Angers (LERIA)
Tel: 02 41 73 52 06 Département Informatique
Fax: 02 41 73 50 73 H203
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.gecode.org/pipermail/users/attachments/20130706/ed6f43ac/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.cpp
Type: text/x-c++src
Size: 1486 bytes
Desc: not available
URL: <http://www.gecode.org/pipermail/users/attachments/20130706/ed6f43ac/attachment-0001.cpp>
More information about the users
mailing list