Coverage Report - net.sourceforge.combean.interfaces.mathprog.lp.model.LPModelSolver
 
Classes in this File Line Coverage Branch Coverage Complexity
LPModelSolver
N/A
N/A
1
 
 1  
 /*
 2  
     This file is part of Combean.
 3  
 
 4  
     Combean is free software; you can redistribute it and/or modify
 5  
     it under the terms of the GNU General Public License as published by
 6  
     the Free Software Foundation; either version 2 of the License, or
 7  
     (at your option) any later version.
 8  
 
 9  
     Combean is distributed in the hope that it will be useful,
 10  
     but WITHOUT ANY WARRANTY; without even the implied warranty of
 11  
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 12  
     GNU General Public License for more details.
 13  
 
 14  
     You should have received a copy of the GNU General Public License
 15  
     along with Combean; if not, write to the Free Software
 16  
     Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 17  
 */
 18  
 /*
 19  
  * Created on 07.08.2005
 20  
  *
 21  
  */
 22  
 package net.sourceforge.combean.interfaces.mathprog.lp.model;
 23  
 
 24  
 import net.sourceforge.combean.interfaces.mathprog.linalg.VectorOrientation;
 25  
 import net.sourceforge.combean.interfaces.mathprog.lp.LPSolver;
 26  
 
 27  
 /**
 28  
  * A class which connects an LP model to a solver.
 29  
  * 
 30  
  * Loads the model into the solver and retrieves the solution for the
 31  
  * domain variables of the model. Responsible for assigning global
 32  
  * indices to model indices, i.e., the LP model solver places
 33  
  * the components with their abstract model indices into a combined
 34  
  * LP with global indices.
 35  
  * 
 36  
  * @author schickin
 37  
  *
 38  
  */
 39  
 public interface LPModelSolver {
 40  
     
 41  
     /**
 42  
      * Set the solver to which the model shall be connected.
 43  
      * 
 44  
      * @param lpSolver
 45  
      */
 46  
     public void setLPSolver(LPSolver lpSolver);
 47  
     
 48  
     /**
 49  
      * Get the LP solver.
 50  
      * 
 51  
      * @return the LP solver.
 52  
      */
 53  
     public LPSolver getLPSolver();
 54  
     
 55  
     /**
 56  
      * Convert a model index into a global index
 57  
      * 
 58  
      * @param modelIndex the model index
 59  
      * @param orientation orientation of the index (rowwise -> the index is a
 60  
      * column index; columnwise -> the index is a row index)
 61  
      * @return the global index in the LP
 62  
      */
 63  
     public int getGlobalIndex(LPModelIndex modelIndex,
 64  
             VectorOrientation orientation);
 65  
 
 66  
     /**
 67  
      * Load a model into the previously set LP solver.
 68  
      * 
 69  
      * @param lpModel the model to be loaded.
 70  
      */
 71  
     public void loadModel(LPModel lpModel);
 72  
     
 73  
     /**
 74  
      * Run the LP solver.
 75  
      */
 76  
     public void solve();
 77  
     
 78  
     /**
 79  
      * Return the solution value for a given variable.
 80  
      * 
 81  
      * May only be called after the LP solver has calculated a primal
 82  
      * solution.
 83  
      * 
 84  
      * @param columnIndex the column for which the solution value
 85  
      * shall be retrieved.
 86  
      * @return the solution value.
 87  
      */
 88  
     public double getSolution(LPModelIndex columnIndex);
 89  
     
 90  
     /**
 91  
      * Return the currently loaded model.
 92  
      * 
 93  
      * @return the currently loaded model or null if no model has been loaded.
 94  
      */
 95  
     public LPModel getModel();
 96  
 
 97  
 }