[Osi] Gurobi setting parameters

Yacine Gaoua y.gaoua at yahoo.com
Mon Apr 3 03:15:46 EDT 2017


Hi,
When using vc++ we should include gurobi_C++.h (not gurobi_C.h). and the setting parameters proposed by Stefan works.
Yacine, 

      De : Yacine Gaoua <y.gaoua at yahoo.com>
 À : "osi at list.coin-or.org" <osi at list.coin-or.org> 
 Envoyé le : Vendredi 31 mars 2017 16h24
 Objet : Re: Gurobi setting parameters
   
Hi,
When i added Gurobi setting parameters, i have follwing erros while i added gurobi70.lib. And when i comment setting parameters, gurobi run normaly.
error LNK2001: symbole externe non résolu "struct _GRBenv * __stdcall GRBgetenv(struct _GRBmodel *)" (?GRBgetenv@@YGPAU_GRBenv@@PAU_GRBmodel@@@Z)
error LNK2001: symbole externe non résolu "int __stdcall GRBsetdblparam(struct _GRBenv *,char const *,double)" (?GRBsetdblparam@@YGHPAU_GRBenv@@PBDN at Z)
Yacine,

      De : Stefan Vigerske <stefan at math.hu-berlin.de>
 À : Yacine Gaoua <y.gaoua at yahoo.com>; "osi at list.coin-or.org" <osi at list.coin-or.org> 
 Envoyé le : Vendredi 31 mars 2017 13h55
 Objet : Re: Gurobi setting parameters
  
Hi,

I use

GRBenv* grbenv = 
GRBgetenv(osigrb->getLpPtr(OsiGrbSolverInterface::KEEPCACHED_ALL));
GRBsetdblparam(grbenv, GRB_DBL_PAR_MIPGAP, 0.1);

Stefan

On 03/31/2017 11:45 AM, Yacine Gaoua wrote:
> Thank you Stefan.
> its working very well.
> another question about setting Gurobi parameters. i using  GRBsetdblparam(si->getEnvironmentPtr(), GRB_DBL_ATTR_MIPGAP, this->optimizationGap); but it dosent work, may be its not the good way t define it.
> Thank you in advanceYacine,
>
>
>      De : Stefan Vigerske <stefan at math.hu-berlin.de>
>  À : Yacine Gaoua <y.gaoua at yahoo.com>; "osi at list.coin-or.org" <osi at list.coin-or.org>
>  Envoyé le : Vendredi 31 mars 2017 11h04
>  Objet : Re: [Osi] OsiGrbSolverInterface Bug
>
> Hi.
>
> handling the exception may give some insight.
> try
> {
>  OsiSolverInterface *si= new OsiGrbSolverInterface();
> }
> catch( CoinError& error )
> {
>  std::cout << error.message();
> }
>
> Could be a missing Gurobi license.
>
> Stefan
>
> On 03/31/2017 08:42 AM, Yacine Gaoua wrote:
>> Hi,
>> I am using Gurobi Osi interface to solve my problem on vc++ 2010. But when i call solving method, Gurobi stop running whith an error message => (Unhandled exception to 0x751fc54f in smart_grid_CoinOR.exe: Microsoft C ++ Exception: CoinError to memory location 0x0045f010 ..).
>> For th rest of Solvers (CPLEX, XPRESS, MOSEK) it running well.
>> int main(){
>>  //OsiSolverInterface *si= new OsiCpxSolverInterface();  //OsiSolverInterface *si= new OsiXprSolverInterface();  //OsiSolverInterface *si= new OsiMskSolverInterface();
>>  OsiSolverInterface *si= new OsiGrbSolverInterface(); //Error
>>  si->readLp("test1.lp");  si->branchAndBound();
>> return 0;}
>> Thanks for help
>>
>>
>>
>> _______________________________________________
>> Osi mailing list
>> Osi at list.coin-or.org
>> https://list.coin-or.org/mailman/listinfo/osi
>>
>
>


-- 
http://www.gams.com/~stefan


   

   
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://list.coin-or.org/pipermail/osi/attachments/20170403/b44f6fcc/attachment.html>


More information about the Osi mailing list