Skip to content

warmstart p.w.l. variable #21

@stumarcus314

Description

@stumarcus314

Is it possible to warmstart a p.w.l. variable from a previous, related p.w.l. variable? When I use the code excerpt below to try this and set the solver to CBC, I get the error below. In the code below, the number of segments used in the p.w.l. variable log_x increases with each iteration.

WARNING: Ignoring partial starting solution. Cbc requires a feasible value to be specified for all variables.

Construct the piecewise linear approximation of log(x), log(y), and log(z).

num_seg = Array{UInt8}(3)
dx = Array{Array{Float64}}(3)
@variable(m,log_x[1:3]) # piecewise linear approximation of log(x)
@variable(m,log(lower_volume)<=log_volume<=log(upper_volume))
for iter=3:5

  ns = 2^iter
  num_seg[1] = ns # Number of segments used to approximate log x.
  num_seg[2] = ns # Number of segments used to approximate log y.
  num_seg[3] = ns # Number of segments used to approximate log z.

  for d=1:3
    dx[d] = linspace(getlowerbound(x[d]),getupperbound(x[d]),num_seg[d]+1)
    log_x[d] = piecewiselinear(m,x[d],dx[d],log,method=method)
  end
  #@constraint(m,log_volume == sum(log_x))
  #@objective(m,Min,log_volume)
  @objective(m,Min,sum(log_x))
  @time status = solve(m)

  sol_volume = prod(getvalue(x))
  println("solution volume: ",lower_volume," <= ",sol_volume," <= ",upper_volume)
  println("minimum volume: ",min_volume,". volume gap: ",sol_volume-min_volume,".")
  println("solution [x,y,z]: ",lower_x," <= ",getvalue(x)," <= ",upper_x)
  println("optimal [x,y,z]: ",opt_x)
end

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions