Using Microsoft Solver Foundation, I have only solved linear problem so far. I'm now trying to solve a very simple non-linear problem but for some reasons, Microsoft solver cannot solve it.
The problem is maximising a0*a1 , with a0<10 and a1<20 . Here is the code I'm using:
using System;
using Microsoft.SolverFoundation.Services;
namespace SolverFoundationDemo
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("\nBegin Solver demo\n");
var solver = SolverContext.GetContext();
var model = solver.CreateModel();
var decision1 = new Decision(Domain.RealNonnegative, "a0"); model.AddDecision(decision1);
var decision2 = new Decision(Domain.RealNonnegative, "a1"); model.AddDecision(decision2);
model.AddConstraint("Constraint0", "a0 <=10");
model.AddConstraint("Constraint1", "a1 <=20");
model.AddGoal("Goal", GoalKind.Maximize, " a0*a1 ");
var solution = solver.Solve();
Console.WriteLine("\nEnd Solver demo\n");
Console.ReadLine();
}
}
}
The error I get is " The model is not convex" , which is true but I was expecting Microsoft solver to be smart enough to find a solution anyway.
Thanks a lot for your feedback.
Regards,