Originally posted by: Esteban.Alvarez
Thank you, I imported all the data the way I wanted, now I want to use the data but I have some problems.
I invented a problem about chicken sales, the idea is to maximize the sales of male and female chickens.
The table shows the consumption of vitamins and corn from male and female chickens and the availability of the corn and vitamins (those are the constraint that I will use) and the sale price of the male and female chickens.
Using this table I convert this to csv. and I got that:
With this I use the OPL for create variables (tuples and string) with the following code:
// Data
{string} Food;
tuple consumption
{
int cons_male;
int cons_female;
}
{consumption} Consumption={};
tuple availability
{
int avail;
}
{availability} Availability={};
tuple sale_price
{
int sale_price_male;
int sale_price_female;
}
{sale_price} Sale_price={};
execute
{
var f=new IloOplInputFile("sales.csv");
var str=f.readline(); // skip first line
while (!f.eof)
{
var str=f.readline();
//writeln(str);
var ar=str.split(",");
if (ar.length==4) Food.add(ar[0]);
if (ar.length==4) Consumption.add(Opl.intValue(ar[1]),Opl.intValue(ar[2]));
if (ar.length==4) Availability.add(Opl.intValue(ar[3]));
if (ar.length==3) Sale_price.add(Opl.intValue(ar[1]),Opl.intValue(ar[2]));
}
f.close();
}
tuple sex
{
string male;
string female;
}
{sex} Sex={};
execute
{
var f=new IloOplInputFile("sales.csv");
while (!f.eof)
{
var str=f.readline();
//writeln(str);
var ar=str.split(",");
if (ar.length==4) Sex.add(ar[1],ar[2]);
}
f.close();
}
{sex} Sex_name={i | i in Sex: i.male==" male"};
execute
{
writeln(Consumption);
writeln(Sale_price);
writeln(Availability);
writeln(Sex);
writeln(Sex_name);
}
And I got:
Now I want to use the data in the model, so I created decision variables and objetive function, but I got a error:
(Is not possible load the model / it is not a type of matrix)
This error said that there is a problem with the type, so I compared the information with an example from the program and I realised that there are some icons which describe the data type.

My problem is that I cant change the data type and I don't know what means those icons.
Would you help me to finish this exercise so I could learn how to modify those parameters?
I attached the model
I appreciate very much your answer
Kind regards
#DecisionOptimization