[Minotaur] User defined objective function
Nikolaos Kazazakis
n.kazazakis12 at imperial.ac.uk
Mon Nov 10 08:15:18 CST 2014
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
> Minotaur at lists.mcs.anl.gov
> https://lists.mcs.anl.gov/mailman/listinfo/minotaur
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/minotaur/attachments/20141110/93551fcf/attachment.html>
More information about the Minotaur
mailing list