Package ilog.concert

Examples of ilog.concert.IloLinearNumExpr.addTerm()


    ship = new IloNumVar[nW][nC];
    IloLinearNumExpr expr = cplex.linearNumExpr();
    // declare the variables and simultaneously assemble the objective function
    for (int i = 0; i < nW; i++) {
      use[i] = cplex.boolVar("Use" + i);
      expr.addTerm(fixed[i], use[i]);
      for (int j = 0; j < nC; j++) {
        ship[i][j] = cplex.numVar(0.0, Math.min(capacity[i], demand[j]),
                                  "Ship_" + i + "_" + j);
        expr.addTerm(flow[i][j], ship[i][j]);
      }
View Full Code Here


      use[i] = cplex.boolVar("Use" + i);
      expr.addTerm(fixed[i], use[i]);
      for (int j = 0; j < nC; j++) {
        ship[i][j] = cplex.numVar(0.0, Math.min(capacity[i], demand[j]),
                                  "Ship_" + i + "_" + j);
        expr.addTerm(flow[i][j], ship[i][j]);
      }
    }
    cplex.addMinimize(expr, "TotalCost")// minimize total cost
    // add demand constraints
    for (int j = 0; j < nC; j++) {
View Full Code Here

    cplex.addMinimize(expr, "TotalCost")// minimize total cost
    // add demand constraints
    for (int j = 0; j < nC; j++) {
      expr.clear();
      for (int i = 0; i < nW; i++) {
        expr.addTerm(1.0, ship[i][j]);
      }
      cplex.addGe(expr, demand[j], "Demand_" + j);
    }
    // add supply constraints
    for (int i = 0; i < nW; i++) {
View Full Code Here

    ship = new IloNumVar[nW][nC];
    IloLinearNumExpr expr = sub.linearNumExpr();
    for (int i = 0; i < nW; i++) {
      for (int j = 0; j < nC; j++) {
        ship[i][j] = sub.numVar(0.0, Double.MAX_VALUE, "Flow_" + i + "_" + j);
        expr.addTerm(unitCost[i][j], ship[i][j]);
      }
    }
    sub.addMinimize(expr, "FlowCost")// minimize total flow cost
    // constrain demand to be satisfied -- record the constraints for use later
    cDemand = new IloRange[nC];
View Full Code Here

    // constrain demand to be satisfied -- record the constraints for use later
    cDemand = new IloRange[nC];
    for (int j = 0; j < nC; j++) {
      expr.clear();
      for (int i = 0; i < nW; i++) {
        expr.addTerm(1.0, ship[i][j]);
      }
      cDemand[j] = sub.addGe(expr, demand[j], "Demand_" + j);
      rhs.put(cDemand[j], master.linearNumExpr(demand[j]));
    }
    // add supply limits (initially all zero, which makes the subproblem
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.