/// <summary>
 /// Protected Constructor
 /// </summary>
 /// <param name="modelName"></param>
 /// <param name="getSolution"></param>
 /// <param name="problemType"></param>
 protected OrLinearProblemSolverBase(string modelName,
                                     GetSolutionDelegate getSolution,
                                     OptimizationProblemType problemType = DefaultProblemType)
     : base(modelName)
 {
     _getSolution = getSolution;
     _problemType = problemType;
 }
Beispiel #2
0
 /// <summary>
 /// Returns the <see cref="Google.OrTools.LinearSolver.Solver"/> <paramref name="value"/>
 /// for use.
 /// </summary>
 /// <param name="value"></param>
 /// <returns></returns>
 internal static int ForSolver(this OptimizationProblemType value)
 {
     try
     {
         return(LazyOptimizationProblemTypes.Value[value]);
     }
     catch (Exception ex)
     {
         throw new ArgumentException($"Optimization problem type '{value}' is not currently implemented",
                                     nameof(value), ex);
     }
 }
Beispiel #3
0
 // ???? p => p.o.Value()
 // Apparently not testing this: p => p.x.SolutionValue() + 7d*p.y.SolutionValue() = 17 (integer)
 protected FeasibleRegionComparisonProblemSolverBase(OptimizationProblemType problemType)
     : base(@"Feasible Integer Region", p => p.o.Value(), problemType)
 {
 }
Beispiel #4
0
 public OptimizationProblem(Func <double[], double> costFunction, OptimizationProblemType type = OptimizationProblemType.Minimization)
 {
     CostFunction = costFunction;
     Type         = type;
 }
 /// <summary>
 /// Protected Constructor
 /// </summary>
 /// <param name="modelName"></param>
 /// <param name="problemType"></param>
 protected OrLinearProblemSolverBase(string modelName,
                                     OptimizationProblemType problemType = DefaultProblemType)
     : base(modelName, p => true, problemType)
 {
 }