/************************************************************************
* retroLP solves linear programs using the simplex method.             *
* Copyright (C) 2001, 2003, 2005 Gavriel Yarmish & Richard Van Slyke.  *
* For further information, and gpl licensing, see the end of this file.*
************************************************************************/


#ifndef PARAMETER_H
#define PARAMETER_H


// Support for modifying program parameters
// struct parameter_attributes
// map(string pname, parameter_attributes p_other)
// Given a parameter name,name, and a proposed
//  new value, value the function
//  long index p_update(string name, double value)
// 1. Looks up name in the map keys
// 2. If not there prints out appropriated message,
//     but doesn't do anything except return with index 0.
// 3. If name in the map:
//  a. Check to see if type matches p_other.type
//  b. If not -> 2.
//  c. See if p_other.lb <= value <= p_other.ub
//  d. If not -> 2
// 4. Save old value, set to new value, print out
//    old and new values
// 5. Return index of key.
//
// long i p_default(string name) assigns default value to 
// parameter name. If name is empty, all parameters are 
// set to default values.

// There are four types of parameters. Two are numeric.
// INTEGER and DOUBLE, BOOLEAN is true/false, yes/no etc.
// ACTION is to do something; e.g., quit, export, help....

#include <map>
#include <string>

enum p_type {QUIT = 0, INTEGER, DOUBLE, BOOLEAN, ACTION};

// structure for integer parmameters
struct ip_attributes
{
  std::string name;    // name of parameter
  long        cvalue;  // current value
  long        dvalue;  // default value
  std::string help;    // help for parameter
  long        lb;      // Lower bond for numerics
  long        ub;      // Upper bound for numerics
};

// structure for double parameters
struct dp_attributes
{
  std::string name;    // name of parameter
  double      cvalue;  // current value
  double      dvalue;  // default value
  std::string help;    // help for parameter
  double      lb;      // Lower bond for numerics
  double      ub;      // Upper bound for numerics
};

// structure for boolean parameters
struct bp_attributes
{
  std::string name;    // name of parameter
  bool        cvalue;  // current value
  bool        dvalue;  // default value
  std::string help;    // help for parameter
};

// structure for actions
struct ap_attributes
{
  std::string name;    // name of parameter
  std::string help;    // help for parameter
};

// structure for p_map entries
struct p_index
{
  int type;
  int index;
};

std::string p_name;

std::map<std::string, p_index> look_up;

#endif

/************************************************************************
* retroLP solves linear programs using the simplex method.             *
* Copyright (C) 2001, 2003, 2005 Gavriel Yarmish & Richard Van Slyke.  *
*                                                                      *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or    *
* (at your option) any later version.                                  *
*                                                                      *
* This program is distributed in the hope that it will be useful,      *
* but WITHOUT ANY WARRANTY; without even the implied warranty of       *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        *
* GNU General Public License for more details.                         *
*                                                                      *
* You should have received a copy of the GNU General Public License    *  
* along with this program; if not, write to the Free Software          *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,           *
*                                                                      *
************************************************************************/
