示例#1
0
        private void addResources()
        {
            //create a variable for each resource
            var  firstTerm    = true;
            Term resourceTerm = null;

            resources = new Dictionary <string, Decision>();
            foreach (var op in AifFile.OperationTypes)
            {
                var decision = new Decision(Domain.IntegerNonnegative, op);
                ProblemModel.AddDecision(decision);
                resources[op] = decision;

                resourceTerm = firstTerm ? decision : resourceTerm + decision;
                firstTerm    = false;
            }

            Log.Debug("Resource Types: " + string.Join(", ", AifFile.OperationTypes));

            Log.Trace("Constraint (ResourceLowerBounds): " + ProblemModel.AddConstraints("ResourceLowerBounds", resources.Values
                                                                                         .Select(decision => decision >= 1)
                                                                                         .ToArray()).Expression);

            Log.Trace($"Resources Goal: {ProblemModel.AddGoal("resources", GoalKind.Minimize, resourceTerm).Expression}");
        }