[Cbc] getting sos to work through cbcinterface dll

John Forrest john.forrest at fastercoin.com
Wed Feb 14 06:24:20 EST 2018


James,

In standalone Cbc bounds are added to SOS variables to make sure they 
are in region -1.0e15 <= 1.0e15.  This cures the problem that the 
relaxed solution is unbounded.

Adding

HS_pos <= 1.0e15
HS_P0_diff <= 1.0e15

to the input gives correct result.

I have added readLp.  Not sure what correct course of action is for 
unbounded case.

John Forrest


On 14/02/18 01:53, James Howey wrote:
>
> After applying recent SOS fixes, the below model is solved correctly 
> with an objective value of zero.
>
> However, I am trying to use the cbc interface dll. As it has no 
> readLp, I added one.
>
> COINLIBAPIintCOINLINKAGE
>
> Cbc_readLp(Cbc_Model* model, constchar*filename)
>
> {
>
> constcharprefix[] = "Cbc_C_Interface::Cbc_readLp(): ";
>
> // const int  VERBOSE = 2;
>
> if(VERBOSE > 0) printf("%s begin\n", prefix);
>
> if(VERBOSE > 1) printf("%s filename = '%s'\n", prefix, filename);
>
> autoclpSolver = dynamic_cast< OsiClpSolverInterface*> 
> (model->model_->solver());
>
> intresult = 1;
>
> //result = model->model_->solver()->readLp(filename);
>
> result = clpSolver->readLp(filename);
>
> assert(result == 0);
>
> if(VERBOSE > 0) printf("%s return %i\n", prefix, result);
>
> returnresult;
>
> }
>
> When I route the model thru the interface, It appears to lose the SOS 
> sets and gives me an unbounded result.
>
> I would value any insights or better, a workaround/fix to enable my 
> scenario. Is it CbcModel vs. Cbc_Model?
>
> Thanks for any assistance,
>
> jkh
>
> MAXIMIZE
>
> +HS_pos
>
> SUBJECT TO
>
> HS_free: -HS_ at free +HS_free  = 0
>
> HS_P0_diff: +HS_free +HS_P0_diff -HS_pos  = 0
>
> HS_P0_sum: +HS_P0_y +HS_P0_z  = 1
>
> HS_pos: -HS_ at pos +HS_pos  = 0
>
> BOUNDS
>
> HS_ at free free
>
> HS_ at pos free
>
> HS_free = -50000
>
> BINARY
>
> HS_P0_y HS_P0_z
>
> SOS
>
> S0: S1:: HS_pos:1 HS_P0_y:2
>
> S1: S1:: HS_P0_diff:1 HS_P0_z:2
>
> END
>
>
>
> _______________________________________________
> Cbc mailing list
> Cbc at list.coin-or.org
> https://list.coin-or.org/mailman/listinfo/cbc


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://list.coin-or.org/pipermail/cbc/attachments/20180214/d047cc57/attachment-0001.html>


More information about the Cbc mailing list