For example, we want to solve a set of general kind of linear programming approach.
So suppose we have an objective function, which is a summation of some X, let's say some over.
I now see I multiply by exi subject to summation of a am I multiplied by X, I created an equal to B
M and we have M constraints and I am decision variables.
OK, so b m i a am I and C I r known parameters to the model.
So in order to solve that, I want to give you an example, a simple one.
Actually every two decision variables like X1 and X2 and also the coefficients of X are specified here,
C seven and 12.
These are the C one and C to see here and also A is a matrix specified here and here we are writing
down each row of these multiplication.
So three x one plus four x two greater than four.
This is one row of it and the other will be two x one five x two bigger than two.
OK, so since we want to write it down as a general model and if we increase the number of decision
variables or the number of constraints that should be also working.
So we decided to do it in the abstract kind of modelling.
OK, so in order to do that, um, after we define the model as an abstract model, we need to specify
the input data.
So in order to do that, we have to create another file with that extension and then specify the sets
and also the parameters of the model and so on.
OK, so here you can see that C since it's defined over one and two, you can see here one and two,
the value is seven and twelve.
And also um the other parameter like B is defined overset M and one and two.
You see here that one and two is here and four and two is here.
OK, and also finally A is described here.
OK, so let's have a look at the, um, code together.
So it's here, let me show you.
OK, so first of all, I, uh, imported the required, um, packages.
OK, since we don't need any kind of plotting, I remove the and plot.
Um.
Importing and also I don't think I need the non-pay, so let's leave it right there.
That's fine.
If we need it, we can use it.
OK, so we have two imports and then I have defined the abstract model and set in.
And set em set and is telling us how many decision variables do we have, how many acts do we have?
OK, and set em is telling us how many constraints do we have C, A, B are the coefficients of the
model.
OK, C is defined overset nt mm.
A is defined or M an rn and B is defined over M and decision variable is defined.
Overset np ok.
And we are assuming that these are non-negative reales positive ones.
OK, and um we have some constraints that needs to be created in order to do that.
Uh we need to define model can't or.
I just named it con you could name it something else.
That's fine constraint.
This constraint is defined Orvil model M it means for every constraints we have such some rules.
OK, so how should we define that.
This is the way we define define control um model and m and return summation of this expression model
a M and I multiplied by I for every I in model nd bigger than equal to model b m.
OK, so we are exactly repeating what we saw here.
OK, so let's have a look at this, uh code again.
You see, this is the concern that we have written here.
OK, so let's continue.
The objective function is the summation of see I multiply by X I for every I in sets model ln and the
objective function and follows these specific rules that we have already defined.
So that will follow the rule and the sense is the minimization.
So if we look at the model structure, we see that it's a linear programming one, then we have to um,
uh, define the solver we are going to use.
OK, and so let's say opt is equal to solver factor like JLP user solver that can be used for linear
programming.
And um, in order to solve an abstract model, we have to create an instance.
Instance will be created using this command.
It is equal to model that create instance, um, using the data file that we have in the same routes
and then we will ask Polynomial to solve the model for us.
Results will be equal to opt uh that solve instance.
So the model will be created and the data will be fed into the model and this line will solve the model
for us.
Let me, um, solve the model and, uh, see what is going on.
OK, so after the solve is finished, the results are already in the results for every I in the instance
don't and we will print the value of X.
OK, so how should we define the value of X?
We have to print the value of uh an instance that X I but um, we have to create a loop to set to tell
uh Palomo to print every X that exists in the model.
And finally um o F is equal to value of instance.
Don't o f OK, so in order to have access to the uh sol values we have to use the command value instance.
That's something that we want to see the value.
OK, so let's run this one as well so you can see that the X1 is equal to one point thirty three.
X2 is equal to zero, A.F. is equal to one point thirty three.
OK, so and this is a very general kind of model for, um, solving the optimization problem.
So you can see here, if we can, if we want to increase the, um, number of decision variables that
can be easily done.
Uh, if we increase the number of decision, uh, decision variables, then we have to change the number
of NP not only is one and two, then we can have three, four, five and so on.
And that model is a general format for, uh, solving any linear programming.
Thank you very much.