Exemplo n.º 1
0
        private void AddConsoACPConstraints()
        {
            int nbrVar = linesDico.Values.Count;

            double[] coefs = new double[nbrVar];

            for (int k = 0; k < axesDico.Values.Count; k++)
            {
                Axe axe = axesDico.Values.ElementAt(k);
                for (int i = 0; i < axe.EntitiesDico.Values.Count; i++)
                {
                    Entity entity = axe.EntitiesDico.Values.ElementAt(i);
                    if (entity is Facility)
                    {
                        for (int e = 0; e < nbrVar; e++)
                        {
                            coefs[e] = 0.0;
                        }
                        for (int j = 0; j < linesDico.Values.Count; j++)
                        {
                            Unit unit = linesDico.Values.ElementAt(j);
                            if (entity.Units.Contains(unit))
                            {
                                if (unit.ProductItProduces == Legende.PRODUCT_ACP)
                                {
                                    coefs[j] = -1.0;
                                }
                                else
                                {
                                    coefs[j] = unit.ACPConsumption;
                                }
                            }
                        }
                        constrIndex++;
                        solverAdapter.AddConstraint(solver, (double[])coefs.Clone(), SolverAdapterConstraintTypes.LE, 0.0);
                        solverAdapter.SetConstraintName(solver, constrIndex, "Contrainte_ACPConso_in" + entity.EntityName);
                    }
                }
            }
        }
Exemplo n.º 2
0
        public Entity GetEntity(string axeName, string entityName)
        {
            Axe axe = GetOrCreateAxe(axeName);

            return(axe.GetEntity(entityName));
        }