I have this project where I have to maximize the amount of cargo traded between ships and a dock. I am having trouble in some areas, I commented trough the current code I have made what challenges I have found. I have few experience in programming so I am having a hard time with this, any tips are appreciated.
The dock has some restrictions that I must follow, I have also commented regarding those on the code.
{int} Posto = ...;
{String} Navio = ...;
string AccMat[Posto] = ...; // Materials that the dock takes
int CaudalTipificado[Navio] = ...; //standardized flow of each material (theyre all liquids)
int Tamanho[Navio] = ... ; //size of the ship
string Material[Navio] = ... ; //cargo type
int Quantidade[Navio] = ... ; //amount in tons
string Name[Navio] = ... ; //name
int VolEsp[Navio] = ... ; //Specific Volume of each cargo type so I can calculate the volume the ship brings and with it and the flow rate, calculate how much time it is docked
dvar boolean x[Navio]; //trying to have 1 for ships that respect the restrictions and are chosen, 0 for those who don't
dexpr float ObjFunction = forall n in Navio: sum(Quantidade[n]); //add the total weight of the selected ships that were selected, in order to have the selection of ships that together take the most cargo
maximize ObjFunction;
Subject to {
forall(n in Navio: 135 <= tamanho[n] <= 295); //Ship larger than 135m and smaller than 295
forall (n in Navio)
sum (Quantidade[n]*VolEsp[n]/CaudalTipificado[n]+10n) <= 700*0.65; //The dock usage must be under 65% of the time of the month, for maintenance and such, the +10n is a failed attempt at adding 10h of time for each boat, to account for the time it takes in docking and other needed activities not related to pumping
forall (n in Navio)
if Material[n] in AccMat[Posto];
x[ ] //Failed attempt to check if the material the boat brings is dealt with by this dock, if not remove it from the options
else
}
Regarding data, I have created randomized ships with random characteristics from those mentioned in the code.