<?xml version="1.0" encoding="utf-8"?>
<!-- edited with XMLSPY v2004 rel. 3 U (http://www.xmlspy.com) by Richard Kipp Martin (University of Chicago) -->
<!--
/*
 * Copyright (c) 2003 Robert Fourer and Leonardo Lopes of
 * Northwestern University and Kipp Martin of The University of Chicago.
 * All rights reserved.

 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted (with the exception given in Condition 7)
 * provided that the following conditions are met:

 * 1. Redistributions of source code must retain the above copyright
 * notice, this list of conditions and the DISCLAIMER below.
 *
 * 2. Redistributions in binary form must reproduce the above copyright
 * notice, this list of conditions and the DISCLAIMER below in the
 * documentation and/or other materials provided with the distribution.
 *
 * 3. Neither the names of Northwestern or the University of Chicago
 * nor the names of its contributors (Robert Fourer, Leo Lopes, and
 * Kipp Martin) may be used to endorse or promote
 * products derived from this software.
 *
 * 4. This software includes software developed by the
 * Apache Software Foundation (http://www.apache.org/)
 * Copyright (c) 1999-2000 The Apache Software Foundation.
 * All rights reserved.
 *
 * 5. The names "Xerces" and "Apache Software Foundation" must
 * not be used to endorse or promote products derived from this
 * software without prior written permission. For written
 * permission, please contact apache\@apache.org.
 *
 * 6. Products derived from this software may not be called "Apache",
 * nor may "Apache" appear in their name, without prior written
 * permission of the Apache Software Foundation.
 *
 * 7. The Demo version of the LINDO API is included with this distribution
 * with the permission of LINDO SYSTEMS, INC.  http://www.lindo.com.
 * The LINDO binaries may not be redistributed without the permission
 * of LINDO SYSTEMS, INC.
 *
 ====================================================================
 *
 * DISCLAIMER:
 *
 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED.  IN NO EVENT SHALL NORTHWESTERN UNIVERSITY, THE       
 * UNIVERSITY OF CHICAGO, THE APACHE SOFTWARE FOUNDATION OR
 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 *
 ====================================================================
 *
 */
-->
<!-- $Id: lpfml.xsd,v 1.18 2003/11/09 22:31:24 kipp Exp $   -->
<xs:schema targetNamespace="http://FML/lpfml.xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://FML/lpfml.xsd" elementFormDefault="qualified">
	<xs:element name="mathProgram">
		<xs:annotation>
			<xs:documentation> This is the only allowed root element.  The potential children are linearProgram, sparseVector,                   sparseMatrix, and linearProgramSolution. None of these children are requried and there is no limit on how many are present.            </xs:documentation>
		</xs:annotation>
		<xs:complexType>
			<xs:sequence>
				<xs:element name="sparseVector" type="sparseVector" minOccurs="0" maxOccurs="unbounded"/>
				<xs:element name="sparseMatrix" type="sparseMatrix" minOccurs="0" maxOccurs="unbounded"/>
				<xs:element name="linearProgramDescription" type="linearProgramDescription"/>
				<xs:element name="linearProgramData" type="linearProgramData" minOccurs="0" maxOccurs="unbounded"/>
				<xs:element name="linearProgramSolution" type="linearProgramSolution" minOccurs="0" maxOccurs="unbounded"/>
				<xs:element name="linearProgramIterative" type="linearProgramIterative" minOccurs="0"/>
			</xs:sequence>
		</xs:complexType>
	</xs:element>
	<xs:complexType name="sparseVector">
		<xs:annotation>
			<xs:documentation>A sparseVector is composed of two  vectors.  They are idx which is an index vector and nonz which is the vector of nonzero elements.</xs:documentation>
		</xs:annotation>
		<xs:sequence>
			<xs:element name="idx" type="intVector" maxOccurs="unbounded"/>
			<xs:element name="nonz" type="doubleVector"/>
		</xs:sequence>
	</xs:complexType>
	<xs:complexType name="sparseMatrix">
		<xs:annotation>
			<xs:documentation>This is a sparse matrix stored either by columns or rows. The vector pntANonz points to the end of a column (row) of nonzero elements. The nonzero elements are stored in the matrix aNonz.  The vector numNonz,  if present, stores the number of nonzero elements in the column (row).  If numNonz is not present, then nonz stores the columns (rows) in matrix order. If the matrix is stored by column (row)  rowIdx (colIdx) is the vector of row (colulmn) indices.</xs:documentation>
		</xs:annotation>
		<xs:sequence>
			<xs:element name="pntANonz" type="intVector"/>
			<xs:choice>
				<xs:element name="rowIdx" type="intVector"/>
				<xs:element name="colIdx" type="intVector"/>
			</xs:choice>
			<xs:element name="numNonz" type="intVector" minOccurs="0"/>
			<xs:element name="nonz" type="doubleVector"/>
		</xs:sequence>
		<xs:attribute name="majorGap" type="xs:int" use="optional"/>
		<xs:attribute name="minorGap" type="xs:int" use="optional"/>
	</xs:complexType>
	<xs:complexType name="linearProgramData">
		<xs:annotation>
			<xs:documentation> The primary construct, it is made up of columns section, rows section, sparseMatrix section, and lpDescription section.</xs:documentation>
		</xs:annotation>
		<xs:sequence>
			<xs:element name="rows">
				<xs:complexType>
					<xs:sequence>
						<xs:element name="row" minOccurs="0" maxOccurs="unbounded">
							<xs:complexType>
								<xs:attribute name="rowName" type="xs:string" use="optional"/>
								<xs:attribute name="rowUB" type="xs:double" use="optional"/>
								<xs:attribute name="rowLB" type="xs:double" use="optional"/>
								<xs:attribute name="mult" type="xs:int" use="optional"/>
							</xs:complexType>
						</xs:element>
					</xs:sequence>
				</xs:complexType>
			</xs:element>
			<xs:element name="columns">
				<xs:complexType>
					<xs:sequence>
						<xs:element name="col" minOccurs="0" maxOccurs="unbounded">
							<xs:complexType>
								<xs:attribute name="objVal" type="xs:double" use="optional" default="0.0"/>
								<xs:attribute name="colName" type="xs:string"/>
								<xs:attribute name="colType" type="colType"/>
								<xs:attribute name="colUB" type="xs:double"/>
								<xs:attribute name="colLB" type="xs:double"/>
								<xs:attribute name="mult" type="xs:int" use="optional"/>
							</xs:complexType>
						</xs:element>
					</xs:sequence>
				</xs:complexType>
			</xs:element>
			<xs:element name="amatrix">
				<xs:complexType>
					<xs:choice>
						<xs:element name="sparseMatrix" type="sparseMatrix"/>
					</xs:choice>
				</xs:complexType>
			</xs:element>
			<xs:element name="metaData" type="metaData" minOccurs="0" maxOccurs="unbounded"/>
		</xs:sequence>
	</xs:complexType>
	<xs:complexType name="linearProgramSolution">
		<xs:annotation>
			<xs:documentation> The result of solving the linear program. At present it is composed of sparseVectors for the primal and dual solution. Plus a status element and a non-required solver message.</xs:documentation>
		</xs:annotation>
		<xs:sequence>
			<xs:element name="primalSolution" minOccurs="0">
				<xs:complexType>
					<xs:sequence maxOccurs="unbounded">
						<xs:element name="sol" type="sol" maxOccurs="unbounded"/>
					</xs:sequence>
				</xs:complexType>
			</xs:element>
			<xs:element name="dualSolution" minOccurs="0">
				<xs:complexType>
					<xs:sequence maxOccurs="unbounded">
						<xs:element name="sol" type="sol" maxOccurs="unbounded"/>
					</xs:sequence>
				</xs:complexType>
			</xs:element>
			<xs:element name="optimalValue" type="xs:double" minOccurs="0"/>
			<xs:element name="status">
				<xs:complexType>
					<xs:simpleContent>
						<xs:extension base="xs:string">
							<xs:attribute name="statusId" type="statusId" use="required"/>
						</xs:extension>
					</xs:simpleContent>
				</xs:complexType>
			</xs:element>
			<xs:element name="solverMessage" type="xs:string" minOccurs="0"/>
			<xs:element name="metaData" type="metaData" minOccurs="0" maxOccurs="unbounded"/>
		</xs:sequence>
	</xs:complexType>
	<xs:complexType name="intVector">
		<xs:annotation>
			<xs:documentation> A  dense vector of integers or base64 binary data.</xs:documentation>
		</xs:annotation>
		<xs:choice>
			<xs:element name="base64BinaryData" type="base64BinaryData"/>
			<xs:element name="el" minOccurs="0" maxOccurs="unbounded">
				<xs:complexType>
					<xs:simpleContent>
						<xs:extension base="xs:int">
							<xs:attribute name="mult" type="xs:int" use="optional"/>
							<xs:attribute name="incr" type="xs:int" use="optional"/>
						</xs:extension>
					</xs:simpleContent>
				</xs:complexType>
			</xs:element>
		</xs:choice>
	</xs:complexType>
	<xs:complexType name="doubleVector">
		<xs:annotation>
			<xs:documentation> A  dense vector of doubles or base64.</xs:documentation>
		</xs:annotation>
		<xs:choice>
			<xs:element name="base64BinaryData" type="base64BinaryData"/>
			<xs:element name="el" minOccurs="0" maxOccurs="unbounded">
				<xs:complexType>
					<xs:simpleContent>
						<xs:extension base="xs:double">
							<xs:attribute name="mult" type="xs:int" use="optional"/>
							<xs:attribute name="incr" type="xs:int" use="optional"/>
						</xs:extension>
					</xs:simpleContent>
				</xs:complexType>
			</xs:element>
		</xs:choice>
	</xs:complexType>
	<xs:complexType name="base64BinaryData">
		<xs:annotation>
			<xs:documentation> Since XML is so verbose, we may wish to store sparseMatrix as base64Binary data.  Especially the pntANonz vector. We can store any of the sparseMatrix vectors as simply base64BinaryData instead of as a MathML vector.  There is also an attribute on this element sizeOf which is the number of  bytes in the attribute numericType. </xs:documentation>
		</xs:annotation>
		<xs:simpleContent>
			<xs:extension base="xs:base64Binary">
				<xs:attribute name="numericType" type="numericType" use="required"/>
				<xs:attribute name="sizeOf" type="xs:int" use="required"/>
			</xs:extension>
		</xs:simpleContent>
	</xs:complexType>
	<xs:complexType name="linearProgramDescription">
		<xs:annotation>
			<xs:documentation> The basic properities of the linear program, such as the source number of rows and columns</xs:documentation>
		</xs:annotation>
		<xs:sequence>
			<xs:element name="source" type="xs:string" minOccurs="0"/>
			<xs:element name="maxOrMin" type="objType"/>
			<xs:element name="objConstant" type="xs:double" minOccurs="0"/>
			<xs:element name="numberRows" type="xs:int"/>
			<xs:element name="numberVars" type="xs:int"/>
			<xs:element name="option" minOccurs="0" maxOccurs="unbounded">
				<xs:complexType>
					<xs:attribute name="name" type="xs:string" use="required"/>
					<xs:attribute name="value" type="xs:string" use="required"/>
					<xs:attribute name="solver" type="xs:string" use="optional"/>
				</xs:complexType>
			</xs:element>
		</xs:sequence>
	</xs:complexType>
	<xs:complexType name="mathMLnonLinearExpression">
		<xs:annotation>
			<xs:documentation> This is for the future -- allow our sparseMatrix of nonzero elements, nonz, to contain nonlinear expressions. For exmaple, if it is a Jacobian.</xs:documentation>
		</xs:annotation>
		<xs:sequence>
			<xs:any namespace="http://www.w3.org/1998/Math/MathML" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
		</xs:sequence>
	</xs:complexType>
	<xs:complexType name="linearProgramIterative">
		<xs:sequence>
			<xs:element name="newColumn" minOccurs="0" maxOccurs="unbounded"/>
			<xs:element name="newRow" minOccurs="0" maxOccurs="unbounded"/>
			<xs:element name="metaData" minOccurs="0" maxOccurs="unbounded"/>
		</xs:sequence>
	</xs:complexType>
	<xs:complexType name="sol">
		<xs:annotation>
			<xs:documentation>A primal or dual solution vector</xs:documentation>
		</xs:annotation>
		<xs:attribute name="idx" type="xs:int" use="required"/>
		<xs:attribute name="name" type="xs:string" use="optional"/>
		<xs:attribute name="val" type="xs:double" use="required"/>
	</xs:complexType>
	<xs:complexType name="metaData">
		<xs:sequence>
			<xs:element name="sparseVector" type="sparseVector" minOccurs="0" maxOccurs="unbounded"/>
		</xs:sequence>
		<xs:attribute name="info" type="xs:string" use="required"/>
		<xs:attribute name="object" type="xs:string" use="required"/>
	</xs:complexType>
	<xs:simpleType name="colType">
		<xs:annotation>
			<xs:documentation> This is an attribute in the column element. It can take on the values of rhs, continuous, binary, or integer.</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:string">
			<xs:enumeration value="C"/>
			<xs:enumeration value="B"/>
			<xs:enumeration value="I"/>
		</xs:restriction>
	</xs:simpleType>
	<xs:simpleType name="objType">
		<xs:annotation>
			<xs:documentation> This goes in the lpDescription and tells us if we have a max or min to solve</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:string">
			<xs:enumeration value="max"/>
			<xs:enumeration value="min"/>
		</xs:restriction>
	</xs:simpleType>
	<xs:simpleType name="numericType">
		<xs:annotation>
			<xs:documentation> If we are storing data as base64BinaryData we need to know what we are storing. Current values are double, float, decimal, int, long, and string.</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:string">
			<xs:enumeration value="double"/>
			<xs:enumeration value="float"/>
			<xs:enumeration value="decimal"/>
			<xs:enumeration value="int"/>
			<xs:enumeration value="long"/>
			<xs:enumeration value="string"/>
		</xs:restriction>
	</xs:simpleType>
	<xs:simpleType name="statusId">
		<xs:annotation>
			<xs:documentation>The result of solving the linear program. The possibilities are optimalSolutionFound, unbounded, infeasible, or alternativeOptima</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:string">
			<xs:enumeration value="optimalSolutionFound"/>
			<xs:enumeration value="unbounded"/>
			<xs:enumeration value="infeasible"/>
			<xs:enumeration value="alternativeOptima"/>
		</xs:restriction>
	</xs:simpleType>
</xs:schema>
