Пример #1
0
        /// <summary>
        /// Converts to a HOL string
        /// </summary>
        /// <param name="precision"></param>
        /// <returns></returns>
        public string ToHOLString(int precision, VariableCollection vars)
        {
            StringBuilder str = new StringBuilder();

            str.Append(lhs.ToHOLString(precision, vars));

            switch (type)
            {
            case IneqType.Eq:
                // An equality becomes an inequality
                str.Append(" <= ");
                break;

            case IneqType.Le:
                str.Append(" <= ");
                break;

            case IneqType.Ge:
                str.Append(" >= ");
                break;
            }

            str.Append(rhs.ToHOLString(precision));
            return(str.ToString());
        }
Пример #2
0
        /// <summary>
        /// Converts to a HOL string
        /// </summary>
        /// <param name="precision"></param>
        /// <returns></returns>
        public string ToHOLString(int precision, VariableCollection vars)
        {
            StringBuilder str = new StringBuilder();

            if (c.value == 0)
            {
                return("");
            }

            str.Append(c.ToHOLString(precision));
            str.Append(" * ");
            str.Append(vars[varName]);

            return(str.ToString());
        }
Пример #3
0
        /// <summary>
        /// Prints the given inequality into a stream
        /// </summary>
        private void WriteIneqText(Inequality ineq, LpNumber marginal, int precision,
                                   StreamWriter writer, ListHyp hypermap)
        {
            // Relabel
            HypermapElement element = hypermap.Manager.TranslateIneq(hypermap, ineq.Id);
            int             index   = hypermap.Manager.FindIneqIndex(hypermap, ineq.Id);

            // Write out
            if (ineq.NegFlag && ineq.type == Inequality.IneqType.Eq)
            {
                writer.Write("-");
            }
            writer.Write(ineq.Id + " & ");
            writer.Write(index + " & ");
            writer.Write(element + ": ");
            writer.Write(ineq.ToHOLString(precision, vars));
            writer.Write("\t (");
            writer.Write(marginal.ToHOLString(precision));
            writer.WriteLine(")");
        }