I've just realized that my objective function (minimizing the difference) makes the problem unbounded.<br>(I want to use the maximization with the division anyway.)<br>I will have to find out how to get the solver to warn me of such problems as infeasibles and undounded. But I assume this would be a question for the solver list.<br>
(I still need most of my previous questions answered though.)<br>Thanks again.<br><br><div class="gmail_quote">On Sat, Nov 28, 2009 at 7:46 PM, Mario Rappi <span dir="ltr"><<a href="mailto:marappi@wichita.edu">marappi@wichita.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">First I include the model, then the output, and at the end the questions:<br><br>*****model************************<br>
// $Id$<br>
#include "flopc.hpp"<br>
using namespace flopc;<br>
#include <OsiClpSolverInterface.hpp><br>
<br>
int main() {<br>
<br>
MP_model &model = MP_model::getDefaultModel();<br>
model.setSolver(new OsiClpSolverInterface);<br>
model.verbose();<br>
<br>
enum {storeA, storeB, storeC, storeD, numS}; <br>
enum {Input1, Input2, numI};<br>
enum {Output1, numO};<br>
<br>
MP_set S(numS); // Stores<br>
MP_set I(numI); // Inputs<br>
MP_set O(numO); // Outputs<br>
<br>
MP_subset<2> Input(S,I);<br>
Input.insert(S,I);<br>
Input.display("Input");<br>
MP_subset<2> Output(S,O);<br>
Output.insert(S,O);<br>
Output.display("Output");<br>
<br> //this will be easier with an array??<br>
MP_data InputVal(Input);<br>
InputVal(storeA,Input1)=1; InputVal(storeA,Input2)=3;<br>
InputVal(storeB,Input1)=3; InputVal(storeB,Input2)=3;<br>
InputVal(storeC,Input1)=4; InputVal(storeC,Input2)=2;<br>
InputVal(storeD,Input1)=3; InputVal(storeD,Input2)=1;<br>
<br>
MP_data OutputVal(Output);<br>
OutputVal(storeA,Output1)=1;<br>
OutputVal(storeB,Output1)=1.5;<br>
OutputVal(storeC,Output1)=2;<br>
OutputVal(storeD,Output1)=1;<br>
<br>
MP_variable x(I), y(O);<br>
x.lowerLimit(I)=0;<br>
y.lowerLimit(O)=0;<br>
<br>
MP_constraint efficiency(S);<br>
efficiency(S) = sum(I, InputVal(S, I) * x(I)) <= sum(O, OutputVal(S, O) * y(O));<br>
<br>
minimize( (sum(O, OutputVal(storeB, O) * y(O))) - (sum(I, InputVal(storeB, I) * x(I))));<br>
<br>
efficiency.display("constraints");<br>
x.display("x");<br>
y.display("y");<br>
<br>
cout<<"Test dea passed."<<endl;<br>
}<br>*****model end************************<br><br>*****output************************<br>Input<br>Output<br>FlopCpp: Constraint <br>0 1 0 0<br>1 1 0 0<br>2 1 0 0<br>3 1 0 0<br>0 2 0 0<br>1 2 0 0<br>
2 2 0 0<br>3 2 0 0<br>0 0 -0 0<br>1 0 -0 0<br>2 0 -0 0<br>3 0 -0 0<br>
FlopCpp: Number of constraint blocks: 1<br>FlopCpp: Number of individual constraints: 4<br>FlopCpp: Number of variable blocks: 2<br>FlopCpp: Number of individual variables: 3<br>FlopCpp: Number of non-zeroes (including rhs): 12<br>
Objective <br>-1 0 0<br>-1 1 -0<br>-1 2 -0<br>FlopCpp: Generation time: -2.64274e-19<br>Clp0000I Optimal - objective value 0<br>Clp0032I Optimal objective 0 - 0 iterations time 0.002<br>FlopCpp: Optimal obj. value = 0<br>
FlopCpp: Solver(m, n, nz) = 4 3 0<br>constraints<br>0 -1.79769e+308 0 0 -0<br>1 -1.79769e+308 0 0 -0<br>2 -1.79769e+308 0 0 -0<br>3 -1.79769e+308 0 0 -0<br>x<br>0 0<br>1 0<br>y<br>0 0<br>Test dea passed.<br>
*****output end************************<br><br>*****Questions:******************<br>I would like to define a set A that includes all members of O and I and then derive O and I from A.<br>This is what I am thinking in GAMS terms:<br>
A / Input1, Input2, Output1 /<br>O(A) / Input1, Input2 /<br>I(A) / Output1 /<br>Is this possible?. I thought it would allow me to write the model more easily (but may be not)<br>*******************<br>I tried to display the constraints but I didn't get what I was expecting (the actual mathematical expression). Is it possible to see the constraints in any other way?<br>
*******************<br>When I compile I get the following two warnings. Should I be concerned? How do I fix them?<br><br>c:\program files\coin-flopcpp\flopcpp\src\mp_set.hpp(259) : warning C4267: 'return' : conversion from 'size_t' to 'int', possible loss of data<br>
c:\program files\coin-flopcpp\flopcpp\src\mp_set.hpp(258) : while compiling class template member function 'int flopc::MP_subset<nbr>::size(void) const'<br> with<br> [<br> nbr=2<br>
]<br> c:\program files\coin-flopcpp\flopcpp\examples\dea.cpp(21) : see reference to class template instantiation 'flopc::MP_subset<nbr>' being compiled<br> with<br> [<br> nbr=2<br>
]<br>c:\program files\coin-flopcpp\flopcpp\src\mp_set.hpp(243) : warning C4267: 'initializing' : conversion from 'size_t' to 'const int', possible loss of data<br> c:\program files\coin-flopcpp\flopcpp\src\mp_set.hpp(232) : while compiling class template member function 'void flopc::MP_subset<nbr>::insert(const std::vector<_Ty> &)'<br>
with<br> [<br> nbr=2,<br> _Ty=int<br> ]<br><br>*******************<br>The objective function that I really want to use is<br>maximize( (sum(O, OutputVal(storeB, O) * y(O))) / (sum(I, InputVal(storeB, I) * x(I))));<br>
But it doesn't compile, I get this error:<br><br>c:\program files\coin-flopcpp\flopcpp\examples\dea.cpp(51) : error C2678: binary '/' : no operator found which takes a left-hand operand of type 'flopc::MP_expression' (or there is no acceptable conversion)<br>
c:\program files\coin-flopcpp\flopcpp\src\mp_constant.hpp(141): could be 'flopc::Constant flopc::operator /(const flopc::Constant &,const flopc::Constant &)'<br> c:\program files\coin-flopcpp\coinutils\src\coinpackedvector.hpp(483): or 'CoinPackedVector operator /(const CoinPackedVectorBase &,const CoinPackedVectorBase &)'<br>
c:\program files\coin-flopcpp\coinutils\src\coinpackedvector.hpp(583): or 'CoinPackedVector operator /(const CoinPackedVectorBase &,double)'<br> c:\program files\coin-flopcpp\coinutils\src\coinpackedvector.hpp(625): or 'CoinPackedVector operator /(double,const CoinPackedVectorBase &)'<br>
while trying to match the argument list '(flopc::MP_expression, flopc::MP_expression)'<br><br>I am using MSVCPP, I read of some problems specific to VCPP so I tried the same in Linux(I think it is build-essential in Ubuntu) but I get the same errors.<br>
How can I fix this problem with the division operation?<br>*******************<br>Is my formulation of the objective function OK in how I sum only for storeB or do I have to use such_that or any other type of control?<br>
How do I display the objective function?<br>*******************<br>What are these numbers in the output?<br>constraints<br>
0 -1.79769e+308 0 0 -0<br>
1 -1.79769e+308 0 0 -0<br>
2 -1.79769e+308 0 0 -0<br>
3 -1.79769e+308 0 0 -0<br>My four constraints are supposed to have only three terms (two on the left and one on the right)<br>********************<br>What is this?<br>Objective <br>
-1 0 0<br>
-1 1 -0<br>
-1 2 -0<br>********************<br><br>If it helps at all: the model is a simple DEA formulation (primal).<br>I understand some of my questions may be more C++ than flopcpp questions but I can't tell.<br>I will appreciate help on any of these questions and on any other comments you may have on the model formulation.<br>
Thanks in advance.<br><font color="#888888">Mario<br>
</font></blockquote></div><br>