Ejemplo n.º 1
0
            private ResourceConstraint _findEarliestConstraint()
            {
                var lowestRemaining = double.MaxValue;
                ResourceConstraint nearestConstraint = null;

                foreach (var constraint in this._constraints)
                {
                    var remSec = constraint.RemainingSeconds;
                    if (!(remSec < lowestRemaining))
                    {
                        continue;
                    }
                    nearestConstraint = constraint;
                    lowestRemaining   = remSec;
                }
                return(nearestConstraint);
            }
        public ResourceConstraintModel(ResourceConstraint resourceConstraint)
        {
            Id           = resourceConstraint.Id;
            Index        = resourceConstraint.Index;
            Negated      = resourceConstraint.Negated;
            SelectedMode = resourceConstraint.Mode;
            Description  = resourceConstraint.Description;

            ForPersons = new List <PersonInConstraint>();


            ConstraintType = new List <string>();
            ConstraintType.Add("Dependency");
            ConstraintType.Add("Blocking");
            ConstraintType.Add("Quantity");


            Mode = new List <ConstraintMode>();
            Mode.Add(ConstraintMode.all);
            Mode.Add(ConstraintMode.each);
        }
Ejemplo n.º 3
0
        private Node[] ReadNodes(GAMSDatabase gdxFile)
        {
            var n = gdxFile.GetSet(_str.NodeSet);
            var s = gdxFile.GetParameter(_str.StartTimes);
            var e = gdxFile.GetParameter(_str.EndTimes);

            Node[] nodes = new Node[n.NumberRecords];
            double v     = 0;
            double w     = 0;
            int    c     = 0;

            foreach (GAMSSetRecord r in n)
            {
                var startTime = s.FindRecord(r.Keys);
                var endTime   = s.FindRecord(r.Keys);
                v = (startTime != null) ? startTime.Value : 0.0;
                w = (endTime != null) ? endTime.Value : 0.0;
                ResourceConstraint[] constraint = new ResourceConstraint[] { new ResourceConstraint(v, w) };
                nodes[c] = new Node(c, r.Keys[0], constraint, c, c);
                c++;
            }
            return(nodes);
        }
 internal void AddConstraint(ResourceConstraint constraint)
 {
     this._constraints.Add(constraint);
 }
Ejemplo n.º 5
0
 internal void AddConstraint(ResourceConstraint constraint)
 {
     this._constraints.Add(constraint);
 }