0
$\begingroup$

I am trying to solve an assignment problem-like from a bi-objective persepctive where I have a marketplace of vendors proposing different machines with different types and specs. The goal is to select a small number of vendors (F1) while meeting the specs of some client machines and maximizing a utility function (F2).

The first decision variable Y[j,i,v] = 1 if machine j from vendor v is candidate for machine client i, 0 otherwise.

The second one is related to the type of client machine defined as Z[i,t] = 1 if machine i is of type t, 0 otherwise.

Since the input regarding this decision variable is known I set it accordingly to the type. For instance, if machine 1 is of type 1 then Z[1,1] = 1 and so on and each machine has only one type so other values for machine 1 are set to be 0 (Z[1,2] = Z[1,3] =0, etc.).

The last decision variable is related to the selection of vendors A[v]=1 if vendor v is selected, 0 otherwise.

The input of the model is the set of machines with desired specs and types the clients want to buy, the vendors with their machines, specs and types. This is stored in different data structures.

Part of the input related to Y[j,i,v] contains the type of machines. Since the type of machines is known, I guess I do not need to include it in the definition of the decsion variable Y to be in the form of Y[j,i,v,t]. I would like to write a constraint saying that if machine client i is of type t then the machine candidate should be of the same type.

With the case of Y[j,i,v,t] it looks like : Z[i,t] <= Y[j,i,v,t].

But with the case of Y[j,i,v] I am not sure how to connect it with Z[i,t] using a constraint knowing that t is part of Z and t is a known value in Y.

Anyone can shed some light on this matter? I am using Python and Gurobi as a solver. I attached the link to my linear program format file and the output provided by gurobi (vendors and gurobi_output).

$\endgroup$
  • $\begingroup$ I am not sure whether I understand the question completely. Your notions of macines, vendors, types and clients make not really sense without further context. However, formulating a logical implication as linear constraint is straight forward (see my answer below). $\endgroup$ – ttnick Oct 30 '18 at 22:38
0
$\begingroup$

If you have two binary variables X, Y and you want to express the constraint X implies Y via a linear inequality you can use the logical equivalent statement (not X) or Y, which in linear programming translates to: $$(1-X) + Y \geq 1$$ In Gurobi-Code this would be: model.addConstr((1-X) + Y >= 1, name="implication").

$\endgroup$
  • $\begingroup$ Thanks @PHPNick I edited the question with the context and added a lp format code returned by gurobi. $\endgroup$ – user2567806 Oct 31 '18 at 2:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.