Opt.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2006-2008 by Antonello Lobianco                         *
00003  *   http://regmas.org                                                     *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU General Public License as published by  *
00007  *   the Free Software Foundation; either version 3 of the License, or     *
00008  *   (at your option) any later version.                                   *
00009  *                                                                         *
00010  *   This program is distributed in the hope that it will be useful,       *
00011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00013  *   GNU General Public License for more details.                          *
00014  *                                                                         *
00015  *   You should have received a copy of the GNU General Public License     *
00016  *   along with this program; if not, write to the                         *
00017  *   Free Software Foundation, Inc.,                                       *
00018  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
00019  ***************************************************************************/
00020 #ifndef STDOPT_H
00021 #define STDOPT_H
00022 
00023 
00024 
00025 //regmas headers
00026 #include "BaseRegmas.h"
00027 
00028 struct matrixActivities;
00029 class Agent_base;
00030 class Pixel;
00031 class RegActivities;
00032 class ModelObject;
00033 
00035 
00047 class Opt: public BaseRegmas{
00048 public:
00049                         Opt(ThreadManager* MTHREAD_h, Agent_base* AGENT_h); 
00050                        ~Opt();
00051     void                test();  
00052     void                update(); 
00053     void                updateResourceValues();  
00054     void                debug(string debugMessage="", bool useCallCounter=false);  
00055     void                solve();  
00056     void                saveToCache();  
00057     void                restoreFromCache(); 
00058     void                addPixel(const Pixel* px_h); 
00059     void                removeLastAddedPixel(); 
00060     vector <matrixActivities*>  getActs();
00061     double              getZ(){return z;};
00062     double              getStat(){return stat;}; 
00063     double              getActivityObjValue(string name_h); 
00064 
00065 private:
00066     void                updateActivities();      
00067     void                updateResourceNames();   
00068     void                solveGlpk(); 
00069 
00070 
00071     vector <matrixActivities>               ACTS; 
00072     Agent_base*                            AGENT; 
00073     vector <string>                resourceNames; 
00074     vector <double>               resourceValues; 
00075     int                                     stat; 
00076     int                               cachedStat;
00077     double                                     z; 
00078     double                               cachedZ; 
00079     int                     actsAddedOnLastPixel; 
00080 
00081 
00082 
00083 };
00084 
00086 
00091 struct matrixActivities{
00092     bool                isSpatial(){if(plotHost){return true;} else{return false;}}; 
00093     string                                  name; 
00094     string                              fullName; 
00095 
00096     bool                                isInvest; 
00097     double                              objValue; 
00098     vector <double>                       values; 
00099     double                                     q; 
00100     double                               cachedQ; 
00101 
00102     const Pixel*                        plotHost; 
00103     RegActivities*                      actMould; 
00104     ModelObject*                        objMould; 
00105 };
00106 
00107 
00108 
00109 #endif