[Coin-discuss] How to get dual values.

Laszlo Ladanyi ladanyi at us.ibm.com
Tue May 31 23:02:20 EDT 2005


I'm sorry if the documentation is not clear on this, but BCP treats every
problem as a minimization problem for now. You have to multiply all your
objective coefficients with -1.

--Laci

On Tue, 31 May 2005, Heesu Hwang wrote:

> Hi, all
> I am solving maximization problem, so my objective has all negative
> coefficients.
> Also, I want to generate variables using dual values, thus I've tried to get
> the dual values in
> 
> double DCG_lp::compute_lower_bound(const double old_lower_bound,
> 				   const BCP_lp_result& lpres,
> 				   const BCP_vec<BCP_var*>& vars,
> 				   const BCP_vec<BCP_cut*>& cuts){
> 
> 	cout << "# of constraints: " << cuts.size() << endl;
> 	int cs = cuts.size();
> 
> 	const double * pitmp = lpres.pi();
> 	for(int i=0; i<cs; i++)
> 		cout << "(" << i+1 << ")" << pitmp[i] << " ";
> 	cout << endl;
> 
> }
> 
> However, result was strange, i.e., I can't get negative dual values, but all
> 0's.
> 
> LP: *** Starting iteration 1 ***
> DCG_lp::modify_lp_parameters
> LP   node   written   in   file   lpnode.mps
> LP:   Matrix size: 11 vars x 30 cuts
> LP:   Solution value: -1022840.4200 / 2 , 0
>  LP: Default display_lp_solution() executed.
>   LP : Displaying LP solution (RelaxedSolution) :
>   LP : Displaying solution :
>   Algo  var (internal index:      1                    ) at 1.0000
>   Algo  var (internal index:      2                    ) at 1.0000
>   Algo  var (internal index:      3                    ) at 1.0000
>   Algo  var (internal index:      4                    ) at 1.0000
>   Algo  var (internal index:      5                    ) at 1.0000
>   Algo  var (internal index:      6                    ) at 1.0000
>   Algo  var (internal index:      7                    ) at 1.0000
>   Algo  var (internal index:      8                    ) at 1.0000
>   Algo  var (internal index:      9                    ) at 1.0000
>   Algo  var (internal index:     10                    ) at 1.0000
> .........................................
> # of constraints: 30
> (1)0 (2)0 (3)0 (4)0 (5)0 (6)0 (7)0 (8)0 (9)0 (10)0 (11)0 (12)0 (13)0 (14)0
> (15)0 (16)0 (17)0 (18)0 (19)0 (20)0 (21)0 (22)0 (23)0 (24)0 (25)0 (26)0
> (27)0 (28)0 (29)0 (30)0
> 
> Help me to get dual values.
> 
> Thanks in advance,
> 
> Peter.
> 
> _______________________________________________
> 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