[Scip] Collecting feasible solutions in SCIP

sheetal murkute shvm11 at gmail.com
Tue May 29 20:45:13 MEST 2012


Thanks,

I could get the count of feasible solutions, However, Within 1 minute I get
around 20,000 feasible solutions,
with MIP gap = "Inf". Also, when I specify the limit on number of feasible
solutions,  using
(SCIP_CALL( SCIPsetLongintParam( scip, "constraints/countsols/sollimit",
2000) );
All the solutions are with MIP gap = "Inf".

Is it possible in SCIP to collect specified number of solutions with less
than a specified MIP gap. ( For example,
I want to collect 2000 feasible solutions with less than 30% MIP gap).



- Thanks with Best Regards,
  Sheetal

On Sat, May 26, 2012 at 4:39 AM, Stefan Heinz <heinz at zib.de> wrote:

> Hi,
>
> first check the following page:
>
> http://scip.zib.de/doc/html/**COUNTER.html<http://scip.zib.de/doc/html/COUNTER.html>
>
>
>
> On 05/25/2012 06:24 PM, sheetal murkute wrote:
>
>> Hello,
>>
>> I want to collect all the feasible solutions for MIP in SCIP. I want to
>> store these solution values (for the original
>> variables) either in file or in some class so that I can access these
>> later.
>>
> In case of the counting feature the solutions are stored w.r.t. the
> transformed problem only. That means, you have to use SCIP functions to
> convert these solutions into the original space. This functionality is
> implemented by the "write/allsolutions" dialog
>
> http://scip.zib.de/doc/html_**devel/cons__countsols_8c.html#**
> a1c3b0e8f05febeac36ad6f77ce45b**f66<http://scip.zib.de/doc/html_devel/cons__countsols_8c.html#a1c3b0e8f05febeac36ad6f77ce45bf66>
>
> you can copy the corresponding code or use in the interactive shell that
> dialog.
>
>
>  I have written the code as follows. However, I do not know how to store
>> all
>> these solutions to a file or
>> in my own array/class. Also when I display *nsols ( total number of
>> counted
>> solutions), it displays "0".
>>
>> ****************************************************************
>> **************************************************************
>> SCIP_CALL_EXC(SCIPsolve(scip))**;
>>
>>         SCIP_Bool valid;
>> int a, b;
>>         SPARSESOLUTION ** feassols;
>> SCIP_VAR** curvars;
>> int* nsols;
>> int* nvars;
>>
>>         assert( scip != NULL );
>>  a = SCIPgetNVars(scip);
>> nvars =&a;
>> curvars = SCIPgetVars(scip);
>>  valid = FALSE;
>>         b = SCIPgetNCountedSols(scip,&**valid);
>> nsols =&b;
>>
>> //SCIP_CALL( SCIPsetLongintParam( scip, "constraints/countsols/**
>> sollimit",
>> 1000) );
>> SCIP_CALL( SCIPsetBoolParam( scip, "constraints/countsols/**collect",
>> TRUE) );
>>
>> SCIPgetCountedSparseSolutions(**scip,&curvars, nvars,&feassols,nsols);
>>
>> cout<<  "total nuber of feasible solutions :"<<  *nsols<<  endl;
>>
> First you set up your problem as usual and set the parameter:
>
>
> SCIP_CALL( SCIPsetBoolParam( scip, "constraints/countsols/**collect",
> TRUE) );
>
> Second you call SCIPcount() instead of SCIPsolve().
> http://scip.zib.de/doc/html/**cons__countsols_8h.html#**
> aef183d6883f1917bffb15159f7b85**6fd<http://scip.zib.de/doc/html/cons__countsols_8h.html#aef183d6883f1917bffb15159f7b856fd>
>
> After that you use the method SCIPgetCountedSparseSolutions(**) the get
> all sparse solution
> http://scip.zib.de/doc/html/**cons__countsols_8h.html#**
> acbf587cc73efb9556f2ea7deba3da**d37<http://scip.zib.de/doc/html/cons__countsols_8h.html#acbf587cc73efb9556f2ea7deba3dad37>
>
> Having these you can use the code of the "write/allsolutions" dialog
>
> http://scip.zib.de/doc/html_**devel/cons__countsols_8c.html#**
> a1c3b0e8f05febeac36ad6f77ce45b**f66<http://scip.zib.de/doc/html_devel/cons__countsols_8c.html#a1c3b0e8f05febeac36ad6f77ce45bf66>
>
> the get the sparse solutions unrolled and transformed into the original
> space.
>
>
>  ****************************************************************
>> ****************************************************************
>> *****************
>>
>> Are the feasible solutions stored in SPARSESOLUTION ** feassols ?
>> I tried to display solutions as
>>         SPARSESOLUTION * feas;
>> feas = *feassols;
>>
>> for(i=0; i<= nvars; ++i)
>> cout<<  feas[i];
>> However, this gives segmentation fault.
>>
>> ****************************************************************
>> ****************************************************************
>> ************
>>
> Note that SPARSESOUTION is a struct with two SCIP_Longint arrays which you
> can access directly (which is actually not the way it should).
> http://scip.zib.de/doc/html/**cons__countsols_8h_source.**html#l00043<http://scip.zib.de/doc/html/cons__countsols_8h_source.html#l00043>
>
> Best Stefan
>
>>
>> Could you please help me with this?
>>
>>
>>
>>
>> ______________________________**_________________
>> Scip mailing list
>> Scip at zib.de
>> http://listserv.zib.de/**mailman/listinfo/scip<http://listserv.zib.de/mailman/listinfo/scip>
>>
>
>


-- 
Thanks with Best Regards,
Sheetal

:)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://listserv.zib.de/mailman/private/scip/attachments/20120529/b1dbea38/attachment.html


More information about the Scip mailing list