[Coin-ipopt] initializing IPOPT

Andreas Waechter andreasw at watson.ibm.com
Tue Dec 10 01:37:41 EST 2002


Hi Ned,

Many thanks for your message :)

> I have the following problem. I want to initialize IPOPT by reading
> parameters from a file and then
> varying some of them inside my program, without reading from a file.
> Would this be possible by two calls to initparams: the first one reads from
> a file, and the second takes
> values from my program?

This option has at this point not been implemented in initparams (every
call deletes everything that has been set or read earlier), but you can
easily change the code in order to fit it to your needs:

Simple replace the lines 238-246 in initparams.F, which are

-------------- 8< ----------------------------------------------------

         if( PSET(i) ) then
            write(line,120) CPARAMS(i), dp
 120        format('Parameter ',a20,
     1           ' has multiple assignments - using ',d12.5, ' .')
            call C_OUT(0,0,1,line)
         endif
C     Everything Ok, put entry into table
         PSET(i)   = .true.
         PVALUE(i) = dp

-------------- 8< ----------------------------------------------------

by

-------------- 8< ----------------------------------------------------

         if( PSET(i) ) then
            write(line,120) CPARAMS(i), dp
 120        format('Parameter ',a20,
     1           ' has multiple assignments - using original one.')
            call C_OUT(0,0,1,line)
         else
            PSET(i)   = .true.
            PVALUE(i) = dp
         endif

-------------- 8< ----------------------------------------------------

After this change, you can call initparams ONCE before calling ipopt, and
it will first consider the arguments that you provide to initparams (using
NARGS, ARGS, CARGS) to set the algorithmic parameters, and then read the
file PARAMS.DAT, where it will ignore every entry in the file that has
already been assigned.  Is this what you were looking for?

I hope this helps,

Andreas




More information about the Coin-ipopt mailing list