how to use decision in exponential for solver using c#

138 Views Asked by At

In my application i'm using solver.In this i created a Decision function that is working fine. But i want to use Decision function in Math.Exp function. For better understanding refer source code below,

using Microsoft.SolverFoundation.Services;
using Microsoft.SolverFoundation.Solvers;

SolverContext context = SolverContext.GetContext();
Model model = context.CreateModel();

Decision sv = new Decision(Domain.RealNonnegative, "decision");           
model.AddDecision(sv);  

model.AddConstraint("limits", 5 <= sv <= 20);

model.AddGoal("Result", GoalKind.Minimize, (1 - Math.Exp(sv));//here i'm getting exception

Please guide me how to use solver decision in Math.Exp function. This one required for my project requrement.

2

There are 2 best solutions below

2
On

As per the reference in google for Math.Exp() function we have to use double as a parameter.

0
On

Try using: Model.Exp() instead of Math.Exp()