Hi, I would like to solve an LP model for different sets of data and then write results to a CSV file. For illustration, assume the following code for one particular instance
using JuMP using GLPK c = [1,1] A = [1,1] b = 1 myModel = Model(GLPK.Optimizer) @variable(myModel, x[1:2] >= 0) @objective(myModel, Max, sum(x[i]*c[i] for i=1:2)) @constraint(myModel, sum(x[i]*A[i] for i =1:2) <= b) optimize!(myModel)
I would like to solve the model for different sets of data for c, A and b given in a CSV or spreadsheet, and assuming that it is not immediately obvious what is right-hand side. I have read the following documentation but it is not clear to me: http://www.juliaopt.org/JuMP.jl/v0.19.2/constraints/#Modifying-a-variable-coefficient-1
Question: Please can someone give a simple example of solving this model for different sets of data and writing results to a CSV file? I would also like to understand:
Q1. Assume values of c, A and b are in a CSV file or spreadsheet, a model needs to be solved for all different values. How can this be done? Does a table needs to be created for each solve to extract relevant values of c, A and b?
Q2. Assume the CSV file or the spreadsheet is too big to fit in to the memory. Is there a way of loading up the appropriate data as needed?