Example #1
0
        // Adds an indexed inequality to a dictionary
        private void AddIndexedIneq(Inequality ineq, LpNumber marginal, ListHyp hypermap)
        {
            IndexedInequality newIneq = new IndexedInequality(ineq, marginal, hypermap);
            string            name    = ineq.Id.name;

            // Ad hoc treatment of sums over faces
            if (name == "sol_sum" || name == "tau_sum")
            {
                DartList face = hypermap.Manager.TranslateIneq(hypermap, ineq.Id) as DartList;
                if (face == null)
                {
                    throw new Exception("A face is expected for the constraint " + name);
                }

                name += face.list.Count.ToString();
            }

            if (ineq.type == Inequality.IneqType.Eq && ineq.NegFlag)
            {
                name += "_neg";
            }

            if (dict.ContainsKey(name))
            {
                dict[name].Add(newIneq);
            }
            else
            {
                var list = new List <IndexedInequality>();
                list.Add(newIneq);
                dict.Add(name, list);
                ineqNames.Add(name);
            }
        }
Example #2
0
        // Adds an indexed inequality to a dictionary
        private void AddIndexedIneq(Inequality ineq, LpNumber marginal, ListHyp hypermap)
        {
            IndexedInequality newIneq = new IndexedInequality(ineq, marginal, hypermap);
            string            name    = ineq.Id.name;

            if (ineq.type == Inequality.IneqType.Eq && ineq.NegFlag)
            {
                name += "_neg";
            }

            if (dict.ContainsKey(name))
            {
                dict[name].Add(newIneq);
            }
            else
            {
                var list = new List <IndexedInequality>();
                list.Add(newIneq);
                dict.Add(name, list);
                ineqNames.Add(name);
            }
        }