[FlopCpp] Constraint index with '-' operation

Marcos Roberto Silva marcos.roberto.silva at uol.com.br
Sun Jul 24 15:26:20 EDT 2011


Hi Tim,
I tried with (K,I,T_ - MP_index_expression(tij(K,I))) but I got the
following error:

marcos at marcos-Infoway:~/Documentos/FlopC++-1.0.6/FlopCpp/examples$ make vap2
g++ -g -I../../include/coin vap2.cpp -L../../lib -Wl,-rpath,../../lib
-lFlopCpp -lOsiCbc -lCbc -lOsiClp -lClp -lCgl -lOsi -lCoinUtils -o vap2
vap2.cpp: In function ‘int main(int, char**)’:
vap2.cpp:179:114: error: ‘MP_index_expression’ was not declared in this
scope
vap2.cpp:179:137: error: no match for ‘operator-’ in ‘T_ -
tij.flopc::MP_data::operator()(((const flopc::MP_index_exp&)(&
flopc::MP_index_exp(((flopc::MP_index&)(&
K.flopc::MP_set::<anonymous>.flopc::MP_set_base::<anonymous>))))), ((const
flopc::MP_index_exp&)(& flopc::MP_index_exp(((flopc::MP_index&)(&
I.flopc::MP_set::<anonymous>.flopc::MP_set_base::<anonymous>))))), ((const
flopc::MP_index_exp&)((const
flopc::MP_index_exp*)flopc::MP_index_exp::getEmpty())), ((const
flopc::MP_index_exp&)((const
flopc::MP_index_exp*)flopc::MP_index_exp::getEmpty())), ((const
flopc::MP_index_exp&)((const
flopc::MP_index_exp*)flopc::MP_index_exp::getEmpty())))’
../../include/coin/MP_constant.hpp:60:12: note: candidates are:
flopc::Constant flopc::operator-(const flopc::Constant&)
../../include/coin/MP_constant.hpp:130:12: note:
flopc::Constant flopc::operator-(const flopc::Constant&, const
flopc::Constant&)
../../include/coin/MP_index.hpp:107:12: note:
flopc::Constant flopc::operator-(flopc::MP_index&, flopc::MP_index&)
../../include/coin/MP_index.hpp:217:25: note:
flopc::MP_index_exp flopc::operator-(flopc::MP_index&, const int&)
../../include/coin/MP_expression.hpp:177:17: note:
flopc::MP_expression flopc::operator-(const flopc::MP_expression&, const
flopc::MP_expression&)
../../include/coin/MP_expression.hpp:179:17: note:
flopc::MP_expression flopc::operator-(const flopc::MP_expression&, const
flopc::Constant&)
../../include/coin/MP_expression.hpp:181:17: note:
flopc::MP_expression flopc::operator-(const flopc::Constant&, const
flopc::MP_expression&)
/usr/include/c++/4.5/bits/stl_bvector.h:179:3: note:
ptrdiff_t std::operator-(const std::_Bit_iterator_base&, const
std::_Bit_iterator_base&)
../../include/coin/CoinPackedVector.hpp:602:1: note:
CoinPackedVector operator-(double, const CoinPackedVectorBase&)
../../include/coin/CoinPackedVector.hpp:564:1: note:
CoinPackedVector operator-(const CoinPackedVectorBase&, double)
../../include/coin/CoinPackedVector.hpp:462:25: note:
CoinPackedVector operator-(const CoinPackedVectorBase&, const
CoinPackedVectorBase&)
make: ** [vap2] Erro 1
marcos at marcos-Infoway:~/Documentos/FlopC++-1.0.6/FlopCpp/examples$

After that, I saw in the MP_index.hpp that there is a method MP_index_exp,
and I also tried this, but without success:

I tried (K,I,T_ - MP_index_exp(tij(K,I))) and:


marcos at marcos-Infoway:~/Documentos/FlopC++-1.0.6/FlopCpp/examples$ make vap2
g++ -g -I../../include/coin vap2.cpp -L../../lib -Wl,-rpath,../../lib
-lFlopCpp -lOsiCbc -lCbc -lOsiClp -lClp -lCgl -lOsi -lCoinUtils -o vap2
vap2.cpp: In function ‘int main(int, char**)’:
vap2.cpp:179:107: error: no match for ‘operator-’ in ‘T_ -
flopc::MP_index_exp(((const flopc::Constant&)(& flopc::Constant(((const
flopc::DataRef&)((const
flopc::DataRef*)tij.flopc::MP_data::operator()(((const
flopc::MP_index_exp&)(& flopc::MP_index_exp(((flopc::MP_index&)(&
K.flopc::MP_set::<anonymous>.flopc::MP_set_base::<anonymous>))))), ((const
flopc::MP_index_exp&)(& flopc::MP_index_exp(((flopc::MP_index&)(&
I.flopc::MP_set::<anonymous>.flopc::MP_set_base::<anonymous>))))), ((const
flopc::MP_index_exp&)((const
flopc::MP_index_exp*)flopc::MP_index_exp::getEmpty())), ((const
flopc::MP_index_exp&)((const
flopc::MP_index_exp*)flopc::MP_index_exp::getEmpty())), ((const
flopc::MP_index_exp&)((const
flopc::MP_index_exp*)flopc::MP_index_exp::getEmpty())))))))))’
../../include/coin/MP_constant.hpp:60:12: note: candidates are:
flopc::Constant flopc::operator-(const flopc::Constant&)
../../include/coin/MP_constant.hpp:130:12: note:
flopc::Constant flopc::operator-(const flopc::Constant&, const
flopc::Constant&)
../../include/coin/MP_index.hpp:107:12: note:
flopc::Constant flopc::operator-(flopc::MP_index&, flopc::MP_index&)
../../include/coin/MP_index.hpp:217:25: note:
flopc::MP_index_exp flopc::operator-(flopc::MP_index&, const int&)
../../include/coin/MP_expression.hpp:177:17: note:
flopc::MP_expression flopc::operator-(const flopc::MP_expression&, const
flopc::MP_expression&)
../../include/coin/MP_expression.hpp:179:17: note:
flopc::MP_expression flopc::operator-(const flopc::MP_expression&, const
flopc::Constant&)
../../include/coin/MP_expression.hpp:181:17: note:
flopc::MP_expression flopc::operator-(const flopc::Constant&, const
flopc::MP_expression&)
/usr/include/c++/4.5/bits/stl_bvector.h:179:3: note:
ptrdiff_t std::operator-(const std::_Bit_iterator_base&, const
std::_Bit_iterator_base&)
../../include/coin/CoinPackedVector.hpp:602:1: note:
CoinPackedVector operator-(double, const CoinPackedVectorBase&)
../../include/coin/CoinPackedVector.hpp:564:1: note:
CoinPackedVector operator-(const CoinPackedVectorBase&, double)
../../include/coin/CoinPackedVector.hpp:462:25: note:
CoinPackedVector operator-(const CoinPackedVectorBase&, const
CoinPackedVectorBase&)
vap2.cpp:179:130: error: no match for ‘operator-’ in ‘T_ -
tij.flopc::MP_data::operator()(((const flopc::MP_index_exp&)(&
flopc::MP_index_exp(((flopc::MP_index&)(&
K.flopc::MP_set::<anonymous>.flopc::MP_set_base::<anonymous>))))), ((const
flopc::MP_index_exp&)(& flopc::MP_index_exp(((flopc::MP_index&)(&
I.flopc::MP_set::<anonymous>.flopc::MP_set_base::<anonymous>))))), ((const
flopc::MP_index_exp&)((const
flopc::MP_index_exp*)flopc::MP_index_exp::getEmpty())), ((const
flopc::MP_index_exp&)((const
flopc::MP_index_exp*)flopc::MP_index_exp::getEmpty())), ((const
flopc::MP_index_exp&)((const
flopc::MP_index_exp*)flopc::MP_index_exp::getEmpty())))’
../../include/coin/MP_constant.hpp:60:12: note: candidates are:
flopc::Constant flopc::operator-(const flopc::Constant&)
../../include/coin/MP_constant.hpp:130:12: note:
flopc::Constant flopc::operator-(const flopc::Constant&, const
flopc::Constant&)
../../include/coin/MP_index.hpp:107:12: note:
flopc::Constant flopc::operator-(flopc::MP_index&, flopc::MP_index&)
../../include/coin/MP_index.hpp:217:25: note:
flopc::MP_index_exp flopc::operator-(flopc::MP_index&, const int&)
../../include/coin/MP_expression.hpp:177:17: note:
flopc::MP_expression flopc::operator-(const flopc::MP_expression&, const
flopc::MP_expression&)
../../include/coin/MP_expression.hpp:179:17: note:
flopc::MP_expression flopc::operator-(const flopc::MP_expression&, const
flopc::Constant&)
../../include/coin/MP_expression.hpp:181:17: note:
flopc::MP_expression flopc::operator-(const flopc::Constant&, const
flopc::MP_expression&)
/usr/include/c++/4.5/bits/stl_bvector.h:179:3: note:
ptrdiff_t std::operator-(const std::_Bit_iterator_base&, const
std::_Bit_iterator_base&)
../../include/coin/CoinPackedVector.hpp:602:1: note:
CoinPackedVector operator-(double, const CoinPackedVectorBase&)
../../include/coin/CoinPackedVector.hpp:564:1: note:
CoinPackedVector operator-(const CoinPackedVectorBase&, double)
../../include/coin/CoinPackedVector.hpp:462:25: note:
CoinPackedVector operator-(const CoinPackedVectorBase&, const
CoinPackedVectorBase&)
make: ** [vap2] Erro 1
marcos at marcos-Infoway:~/Documentos/FlopC++-1.0.6/FlopCpp/examples$


Could you please help me?

Thank you very much!

Marcos


2011/7/24 Tim Hultberg <Tim.Hultberg at eumetsat.int>

> .
>
> Try (K,I,T_-MP_index_expression(tij(K,I)).
>
> You could also make this a 3 dimensianal "subset", I think.
>
> Tim
>
> .
>
>  *From*: Marcos Roberto Silva [mailto:marcos.roberto.silva at uol.com.br]
> *Sent*: Saturday, July 23, 2011 06:15 PM
> *To*: flopcpp at list.coin-or.org <flopcpp at list.coin-or.org>
> *Subject*: [FlopCpp] Constraint index with '-' operation
>
> Hi all.
> I'm trying to write a constraint like this:
>
> balanco2(I,T_) = sum(J, (X(I,J,T_) + Y(I,J,T_))) - Y(I,I,T_-1) - sum(K,
> (X(K,I,(T_-tij(K,I))) + Y(K,I, (T_-tij(K,I)) )) ) == mit(I,T_);
>
> but when I try to compile the source code I get the following error:
>
> marcos at marcos-Infoway:~/Documentos/FlopC++-1.0.6/FlopCpp/examples$ make
> vap2
> g++ -g -I../../include/coin vap2.cpp -L../../lib -Wl,-rpath,../../lib
> -lFlopCpp -lOsiCbc -lCbc -lOsiClp -lClp -lCgl -lOsi -lCoinUtils -o vap2
> vap2.cpp: In function ‘int main(int, char**)’:
> vap2.cpp:179:92: error: no match for ‘operator-’ in ‘T_ -
> tij.flopc::MP_data::operator()(((const flopc::MP_index_exp&)(&
> flopc::MP_index_exp(((flopc::MP_index&)(&
> K.flopc::MP_set::<anonymous>.flopc::MP_set_base::<anonymous>))))), ((const
> flopc::MP_index_exp&)(& flopc::MP_index_exp(((flopc::MP_index&)(&
> I.flopc::MP_set::<anonymous>.flopc::MP_set_base::<anonymous>))))), ((const
> flopc::MP_index_exp&)((const
> flopc::MP_index_exp*)flopc::MP_index_exp::getEmpty())), ((const
> flopc::MP_index_exp&)((const
> flopc::MP_index_exp*)flopc::MP_index_exp::getEmpty())), ((const
> flopc::MP_index_exp&)((const
> flopc::MP_index_exp*)flopc::MP_index_exp::getEmpty())))’
> ../../include/coin/MP_constant.hpp:60:12: note: candidates are:
> flopc::Constant flopc::operator-(const flopc::Constant&)
> ../../include/coin/MP_constant.hpp:130:12: note:
> flopc::Constant flopc::operator-(const flopc::Constant&, const
> flopc::Constant&)
> ../../include/coin/MP_index.hpp:107:12: note:
> flopc::Constant flopc::operator-(flopc::MP_index&, flopc::MP_index&)
> ../../include/coin/MP_index.hpp:217:25: note:
> flopc::MP_index_exp flopc::operator-(flopc::MP_index&, const int&)
> ../../include/coin/MP_expression.hpp:177:17: note:
> flopc::MP_expression flopc::operator-(const flopc::MP_expression&, const
> flopc::MP_expression&)
> ../../include/coin/MP_expression.hpp:179:17: note:
> flopc::MP_expression flopc::operator-(const flopc::MP_expression&, const
> flopc::Constant&)
> ../../include/coin/MP_expression.hpp:181:17: note:
> flopc::MP_expression flopc::operator-(const flopc::Constant&, const
> flopc::MP_expression&)
> /usr/include/c++/4.5/bits/stl_bvector.h:179:3: note:
> ptrdiff_t std::operator-(const std::_Bit_iterator_base&, const
> std::_Bit_iterator_base&)
> ../../include/coin/CoinPackedVector.hpp:602:1: note:
> CoinPackedVector operator-(double, const CoinPackedVectorBase&)
> ../../include/coin/CoinPackedVector.hpp:564:1: note:
> CoinPackedVector operator-(const CoinPackedVectorBase&, double)
> ../../include/coin/CoinPackedVector.hpp:462:25: note:
> CoinPackedVector operator-(const CoinPackedVectorBase&, const
> CoinPackedVectorBase&)
> vap2.cpp:179:116: error: no match for ‘operator-’ in ‘T_ -
> tij.flopc::MP_data::operator()(((const flopc::MP_index_exp&)(&
> flopc::MP_index_exp(((flopc::MP_index&)(&
> K.flopc::MP_set::<anonymous>.flopc::MP_set_base::<anonymous>))))), ((const
> flopc::MP_index_exp&)(& flopc::MP_index_exp(((flopc::MP_index&)(&
> I.flopc::MP_set::<anonymous>.flopc::MP_set_base::<anonymous>))))), ((const
> flopc::MP_index_exp&)((const
> flopc::MP_index_exp*)flopc::MP_index_exp::getEmpty())), ((const
> flopc::MP_index_exp&)((const
> flopc::MP_index_exp*)flopc::MP_index_exp::getEmpty())), ((const
> flopc::MP_index_exp&)((const
> flopc::MP_index_exp*)flopc::MP_index_exp::getEmpty())))’
> ../../include/coin/MP_constant.hpp:60:12: note: candidates are:
> flopc::Constant flopc::operator-(const flopc::Constant&)
> ../../include/coin/MP_constant.hpp:130:12: note:
> flopc::Constant flopc::operator-(const flopc::Constant&, const
> flopc::Constant&)
> ../../include/coin/MP_index.hpp:107:12: note:
> flopc::Constant flopc::operator-(flopc::MP_index&, flopc::MP_index&)
> ../../include/coin/MP_index.hpp:217:25: note:
> flopc::MP_index_exp flopc::operator-(flopc::MP_index&, const int&)
> ../../include/coin/MP_expression.hpp:177:17: note:
> flopc::MP_expression flopc::operator-(const flopc::MP_expression&, const
> flopc::MP_expression&)
> ../../include/coin/MP_expression.hpp:179:17: note:
> flopc::MP_expression flopc::operator-(const flopc::MP_expression&, const
> flopc::Constant&)
> ../../include/coin/MP_expression.hpp:181:17: note:
> flopc::MP_expression flopc::operator-(const flopc::Constant&, const
> flopc::MP_expression&)
> /usr/include/c++/4.5/bits/stl_bvector.h:179:3: note:
> ptrdiff_t std::operator-(const std::_Bit_iterator_base&, const
> std::_Bit_iterator_base&)
> ../../include/coin/CoinPackedVector.hpp:602:1: note:
> CoinPackedVector operator-(double, const CoinPackedVectorBase&)
> ../../include/coin/CoinPackedVector.hpp:564:1: note:
> CoinPackedVector operator-(const CoinPackedVectorBase&, double)
> ../../include/coin/CoinPackedVector.hpp:462:25: note:
> CoinPackedVector operator-(const CoinPackedVectorBase&, const
> CoinPackedVectorBase&)
> make: ** [vap2] Erro 1
> marcos at marcos-Infoway:~/Documentos/FlopC++-1.0.6/FlopCpp/examples$
>
>
> When I remove the term:
>
> ... - sum(K, (X(K,I,(T_-tij(K,I))) + Y(K,I, (T_-tij(K,I)) )) )
>
> I can compile without problems. It seems that the problem is when I try to
> do T_-tij(K,I).
>
> Do you have any idea of how can I write this constraint?
>
> Thank you very much.
>
> Marcos Roberto Silva
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://list.coin-or.org/pipermail/flopcpp/attachments/20110724/6c445606/attachment-0001.html 


More information about the FlopCpp mailing list