[Coin-discuss] Question about the bcp_main() function

diarrass at isima.fr diarrass at isima.fr
Sat Aug 4 04:02:57 EDT 2007


Hello.
Thank you very much for your answer. While waiting for someone's help I
decided to enter the source code of Bcp (I am using Bcp-1.0.0) and check
what happened in the bcp_main() function. I found that this function
indirectly calls the member function
BCP_single_environement::register_process(). However, this function
(located in the file Bcp-1.0.0/Bcp/src/Member/BCP_message_single.cpp)
contains the instruction "exit(0)" at its end. So I tried to delete this
exit() and I observe that the main program does not exit after the first
call of bcp_main(). Thus, I conclude that the problem was create by this
instruction.

Best regards.

> It's a "feature"... BCP was originally written as the main function, and
> the
> user only provided functions (classes) to compile the whole thing
> together.
> Later, for compilation convenience, bcp_main was created, so that BCP can
> be
> compiled as a library, but still, BCP acts as if it were the main function
> and
> exits upon finishing the work. This could be changed; the user would have
> to
> create a BCP_tm_prob object, populate it properly, then invoke bcp_main.
> Not
> too difficult, but does require some thought on what to expose.
> For now the easiest solution is to write your code to solve the problem
> only
> once, then invoke your code from a shell script several times with
> different
> parameters.
>
> --Laci
>
> On Thu, 2 Aug 2007 diarrass at isima.fr wrote:
>
>> Hi.
>> I am a new user of Coin-Or Bcp module. I send this e-mail because I
>> found
>> a problem when developping a program using BCP. In fact, in this program
>> I
>> have to solve a series of integer programs using the
>> branch-and-cut method and each integer program depends on an integer
>> parameter v going from 0 to N (The main() function of this program is
>> given below).
>> I tried to call several times the bcp_main() function in a loop from 0
>> to
>> N but this loop only executes the first iteration (giving the correct
>> result) and exits. It appears that the program exits just after the
>> first
>> call of the bcp_main() function.
>> Is this a bug in BCP or is their a way or a new version of BCP to
>> correct it?
>>
>> int main(int argc, char* argv[])
>> {
>>         int v;
>>
>>         //Lancement de la boucle sur v
>>         for(v=0;v<10;v++)
>>         {
>>                 cout << "BB_TM V == " << v << endl;
>>
>>                 BB_init bb_init(&v);
>>                 int res = bcp_main(argc, argv, &bb_init);
>>
>>                 cout << "APRES BCP_MAIN RES = " << res << endl;
>>         }
>>
>>         cout << "FIN DE L'OPTIMISATION" << endl;
>>
>>         return(0);
>> }
>>
>>
>>
>>
>>
>> _______________________________________________
>> Coin-discuss mailing list
>> Coin-discuss at list.coin-or.org
>> http://list.coin-or.org/mailman/listinfo/coin-discuss
>>
>
> _______________________________________________
> Coin-discuss mailing list
> Coin-discuss at list.coin-or.org
> http://list.coin-or.org/mailman/listinfo/coin-discuss
>




More information about the Coin-discuss mailing list