[Minotaur] User defined objective function
Cristiano Arbex Valle
arbex.dcc at gmail.com
Tue Nov 11 03:33:12 CST 2014
Thank you very much Nikos and Ashutosh,
We are formalising our problem so I might get back here as we progress,
thanks.
Best regards,
Cristiano
On Tue, Nov 11, 2014 at 4:15 AM, Ashutosh Mahajan <amahajan at iitb.ac.in>
wrote:
> Hi Cristiano
>
> In addition to what Nikos explained, you can define your own functions as
> well.
> You will at least need to implement routines to evaluate the function at a
> given point and a routine to evaluate the gradient. You will also need to
> write some helper functions about the number of variables in the function
> etc.
>
> An example (myNLFun3 class derived from Function class) is available in
> src/testing/NLPBnbUT.cpp
>
> If you provide more details on what kind of function you want to write, I
> can
> help you a bit more.
>
> Cheers.
> --
> Regards
> Ashutosh Mahajan
> http://www.ieor.iitb.ac.in/amahajan
>
> On Mon, Nov 10, 2014 at 02:15:18PM +0000, Nikolaos Kazazakis wrote:
> > Dear Cristiano,
> >
> > You can define the objective function through an AMPL .mod file, e.g.:
> >
> > # Start of mod file
> > var x {1..2};
> >
> > minimize obj:
> > cos(x[1]+x[2]+2)+log(x[1]);
> >
> > subject to cons0:
> > -4<=x[1]<=4;
> > subject to cons1:
> > -1<=x[2]<=3;
> > # End of mod file
> >
> > Minotaur normally reads the .mod filename through the input, i.e.:
> >
> > $ ./minotaur_exe problem_file
> >
> > and then (inside the code):
> >
> > problem =
> > iface.readInstance(options->findString("problem_file")->getValue());
> >
> > You can read another file (let's say "second_file") by:
> >
> > problem = iface.readInstance("second_file");
> >
> > You can have multiple problem instances in your code this way, i.e.
> you
> > can set minotaur to read more than one file and get multiple
> functions in
> > your code, although when I tried to have to ProblemPtr type problems
> on my
> > setup I was getting segfaults when assigning memory (with
> setNativeDer).
> >
> > If you create the second problem as a RelaxationPtr though you can
> have as
> > many problem instances as you want, it works fine!
> >
> > Kind regards,
> > Nikos
> >
> > On 10/11/14 13:15, Cristiano Arbex Valle wrote:
> >
> > Hi Ashutosh / Minotaur team
> > Is it possible to have in Minotaur an independently user-defined
> > objective function, which Minotaur would call whenever it needs to
> > compute the objective function?
> > Thank you and best regards,
> > --
> > Cristiano Arbex Valle
> >
> > _______________________________________________
> > Minotaur mailing list
> > [1]Minotaur at lists.mcs.anl.gov
> > [2]https://lists.mcs.anl.gov/mailman/listinfo/minotaur
> >
> > References
> >
> > Visible links
> > 1. mailto:Minotaur at lists.mcs.anl.gov
> > 2. https://lists.mcs.anl.gov/mailman/listinfo/minotaur
>
> > _______________________________________________
> > Minotaur mailing list
> > Minotaur at lists.mcs.anl.gov
> > https://lists.mcs.anl.gov/mailman/listinfo/minotaur
>
>
--
--
Cristiano Arbex Valle
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/minotaur/attachments/20141111/a09f655f/attachment.html>
More information about the Minotaur
mailing list