[Couenne] Is there a callable library to use Couenne in C/C++?

victor.zverovich at gmail.com victor.zverovich at gmail.com
Sat Feb 21 12:09:39 EST 2015


Hi Wendel,

You can use AMPL/MP library (https://github.com/ampl/mp) to build a problem
in ASL format and pass it to Couenne via standard AMPL (NL) interface. For
example:

#include "asl/aslbuilder.h"

using namespace mp;

int main() {
  // Build problem in ASL form.
  ASL *asl = ASL_alloc(ASL_read_fg);
  asl::internal::ASLBuilder b(asl);
  auto info = ProblemInfo();
  info.num_vars = 1;
  info.num_objs = 1;
  b.SetInfo(info);
  // Add a continuous variable with -100 <= x <= 100
  b.AddVar(-100, 100, var::CONTINUOUS);
  // Add objective minimize o: x ^ 2;
  b.AddObj(obj::MIN, b.MakeUnary(expr::POW2, b.MakeVariable(0)), 0);
  // Write .nl file.
  fg_write("test.nl", 0, ASL_write_ASCII);
  // Solve the problem with Couenne.
  std::system("couenne -s test.nl");
}

This is not particularly user friendly at the moment (apart from expression
construction which is probably OK), but does the job done. I am working on
improving and documenting the API.

HTH,
Victor

On Fri Feb 20 2015 at 11:15:54 PM Wendel Melo <wendelalexandre at gmail.com>
wrote:

> Hi experts
>
>
> Is there a callable library to use Couenne in C/C++? It would be useful to
> develop a software to my Ph. D thesis. Write my models in AMPL is not
> appropriate...
> Is there some information about that?
>
> Thanks in advanced for your attention
>
> Have a nice week
>
> --
> Wendel Melo
> _______________________________________________
> Couenne mailing list
> Couenne at list.coin-or.org
> http://list.coin-or.org/mailman/listinfo/couenne
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://list.coin-or.org/pipermail/couenne/attachments/20150221/4983b2e7/attachment.html>


More information about the Couenne mailing list