[Coin-discuss] usage of OsiSolverInterface::copyParameters()
    Kish Shen 
    kish.shen at crosscoreop.com
       
    Fri Sep  8 18:06:09 EDT 2006
    
    
  
Hi,
I want to be able to set `default' parameter values for a solver (i.e. an OsiSolverInterface). The
way I am trying to do this is to create a `default' solver, for which the user can set the parameter
values. and when the user then create a new OsiSolverInterface, the parameter values from 
the `default' solver are copied to the new solver.
I tried to do this copying with the OsiSolverInterface::copyParameters() method, but this does
not seem to copy the parameters I tried. There is not much documentation describing what
this function does, but from looking at the code, 
Solver1->copyParameters(*Solver2);
parameters values are copied into Solver2, I assume from Solver1.
However, in the following code:
    lp->Solver->getIntParam(OsiMaxNumIteration,p1);
    def->Solver->getIntParam(OsiMaxNumIteration,p2);
    std::cout<<"before"<<p1<<" "<<p2<<std::endl;
    if (def) def->Solver->copyParameters(*lp->Solver);
    lp->Solver->getIntParam(OsiMaxNumIteration,p1);
    def->Solver->getIntParam(OsiMaxNumIteration,p2);
    std::cout<<"after"<<p1<<" "<<p2<<std::endl;}
where lp->Solver and def->Solver are OsiSolverInterface* (I actually tried OsiClpSolverInterface
and OsiSymSolverInterface), and both lp and def's solver's OsiMaxNumIteration remained
unchanged after the call to copyParameters().
For example, for OsiClpSolverInterface, I got the following output:
before2147483647 5
after2147483647 5
I had expected the value 5 for both Solver in the `after' case.
Tracing the code, I am not sure I understand what this code is doing. I expect 
   CoinDisjointCopyN(rhs.intParam_, OsiLastIntParam, intParam_);
in the copyParameters() procedure to be doing the copying of the integer parameters, but the
two parameters values that are copied are neither 2147483647 nor 5, both were  9999999. Is 
some other parameter array being copied?
Thanks in advance for any information!
--Kish Shen
    
    
More information about the Coin-discuss
mailing list