[Scip] How can I read the values of fixed variables in the collected feasible solutions
Gerald Gamrath
gamrath at zib.de
Sun Aug 12 13:26:04 MEST 2012
Dear Sheetal,
you can find all methods that access the variable data structure
directly in pub_var.h:
http://scip.zib.de/doc/html/pub__var_8h.shtml
There, you can also find the methods mentioned by Michael, which are the
correct way to get the value of a fixed variable.
You can find public methods of SCIP either in pub_xyz.h for things that
deal with structure xyz, e.g. var, cons, sol,...
Methods that need more data, e.g. the problem (for transferring solution
values), settings, and a solution can be found in scip.h.
Additionally, all methods for a specific plugin, e.g. cons_linear can be
found in the corresponding .h-file.
Thus, if you are searching for a specific method, there are just two
places to look: the corresponding pub_xyz.h file and scip.h (which is
also devided into sections concerning different topics).
However, back to your primary question, if you just want to get the
solution with respect to the original variables, you can also do the
following:
1) Get the original variables and their number by calling
SCIPgetOrigvarsData():
http://scip.zib.de/doc/html/scip_8h.shtml#a26493edb8b80908a3c46ed8d66e335e9
(alternatively, you can also use SCIPgetOrigVars() and
SCIPgetNOrigvars():
http://scip.zib.de/doc/html/scip_8h.shtml#abec020b8686cac2812d1028deece85f9)
and
http://scip.zib.de/doc/html/scip_8h.shtml#aac6e0dce5ed1e58242b015a469b7ce16)
2) Get the solution values of these variables via SCIPgetSolVal() or
SCIPgetSolVals(), which gives you all values in one call:
http://scip.zib.de/doc/html/scip_8h.shtml#adbd8d051e9c1b3f2d84be42fb140c112
http://scip.zib.de/doc/html/scip_8h.shtml#a982669e32c6756f863a1cc3741ecf32c
SCIP will automatically compute the value of an original variable when
asked for its value in a transformed solution. That means that it
handles fixed variables, but also (multi-)aggregated variables, which
you would also have to do if you want to do everything by hand.
Best,
Gerald
Am 12.08.2012 10:11, schrieb michael.winkler at zib.de:
> Hi,
>
> you need to loop over all fixedvars and ask for
> SCIPvarGetLbGlobal(fixedvars[..]) (or SCIPvarGetUbGlobal(fixedvars[..])).
> For fixed variables the global lowerbound and upperbound should be the same.
>
> Best, Michael
>
>> Hello,
>>
>> I want to obtain the values of all the variables in the collected feasible
>> solutions in SCIP.
>> I could collect the feasible solutions and could transform those variable
>> to the original variable space.
>>
>> I want to obtain the values of the fixed variables.
>> I have used the following methods for getting number and SCIP_VAR**
>> structure array of the fixed variables.
>>
>> SCIP_VAR** fixedvars;
>> fixnum = SCIPgetNFixedVars(scip);
>> fixedvars = SCIPgetFixedVars(scip);
>>
>> Could you please let me know how I can read the values of the fixed
>> variables in the collected feasible solutions.
>> How can I read the values of structure elements for SCIP_VAR**?
>>
>> --
>> Thanks with Best Regards,
>> Sheetal
>>
>> :)
>> _______________________________________________
>> Scip mailing list
>> Scip at zib.de
>> http://listserv.zib.de/mailman/listinfo/scip
>>
> _______________________________________________
> Scip mailing list
> Scip at zib.de
> http://listserv.zib.de/mailman/listinfo/scip
More information about the Scip
mailing list