[Scip] Meaning of SPARSESOLUTION Member Data

Stefan Heinz heinz at zib.de
Sat May 26 10:14:21 MEST 2012


Hi Hélène,

On 05/25/2012 10:38 AM, Hélène Toussaint wrote:
> Thank you. I spent time studing this function and I understand a 
> little better but I don't succeed in extracting the solutions from the 
> sparsesolution data structure :
>
> 1. I see that the SCIPdialogExecWriteAllsolutions seems to do what I 
> want. Can I call it even though I don't use the interactive shell ? If 
> yes how can I do ?
>
Well basically it would be possible but a bad hack. I suggest you copy 
just the code.
> 2. I don't find getter to access to the members of the countsols 
> constraint handler so I have tried to access directly but in vain :
>
> conshdlr = SCIPfindConshdlr(env->_scip, consHdlrName.c_str());//ok
> conshdlrdata = SCIPconshdlrGetData(conshdlr); //ok
> c_allvars = conshdlrdata->allvars; //not allowed
>
> How can I access to these members ?
You need to call the method SCIPgetCountedSparseSolution()

http://scip.zib.de/doc/html/cons__countsols_8h.html#acbf587cc73efb9556f2ea7deba3dad37

This one gives you the array of all sparse solution, the variable array, 
and the number of variables. Note that the solution life in the 
transformed problem space. That means in particular the vars array 
contains only active variables. BTW did you saw that:

http://scip.zib.de/doc/html/COUNTER.html


>
> 3. I have one constraint handler and one pricer. I wonder if it could 
> involve some problems in the countsols constraint handler ? Indeed the 
> number of feasible solutions returned by SCIPgetNCountedSols seems to 
> me to be large.
Upps in case of active pricers counting as it is implemented does not 
work. To be able to count all feasible solution it is most likely that 
all variables are generated. W.r.t. I would suggest that for a smaller 
problem you generate all variables and state the model explicitly and 
use the count function.


Best  Stefan
>
> Best regards,
> Hélène
>
>
> Le 24/05/2012 11:02, Stefan Heinz a écrit :
>> Hi,
>>
>> in cons_countsols.c exist a method called writeExpandedSolutions 
>> <http://scip.zib.de/doc/html_devel/cons__countsols_8c.html#a1fdec7b56aadb0cb9a21042be8ff582e>() 
>> which unrolls the sparse solutions
>>
>> http://scip.zib.de/doc/html_devel/cons__countsols_8c.html#a1fdec7b56aadb0cb9a21042be8ff582e 
>>
>>
>> Does that help?
>>
>> Stefan
>>
>> On 05/24/12 10:30, Hélène Toussaint wrote:
>>> Hi all,
>>>
>>> I have tried to collect all feasible solutions generated by my BCP 
>>> algorithm using SCIPcount().
>>>
>>> 1. I have fixed the collect parameter to TRUE like this:
>>> SCIPsetBoolParam( env._scip, "constraints/countsols/collect", TRUE) ;
>>>
>>> 2. After solving (using SCIPcount() ) I have used the 
>>> SCIPgetCountedSparseSolutions to obtain the solutions like this:
>>>
>>> SCIP_VAR **vars;
>>> intnvars, nsols;
>>> SPARSESOLUTION **sols;
>>> SCIPgetCountedSparseSolutions( env._scip, &vars, &nvars,&sols, 
>>> &nsols );
>>>
>>> I have had a look to the values stored in nsols and vars but I don't 
>>> understand their meanings and so I am not able to construct the 
>>> solutions. Could you please help me with these data: how can I get 
>>> the solutions (objective value and variables values) ?
>>>
>>> Best regards,
>>> Hélène
>>>
>>>
>>> _______________________________________________
>>> Scip mailing list
>>> Scip at zib.de
>>> http://listserv.zib.de/mailman/listinfo/scip
>>
>>
>



More information about the Scip mailing list