//CTOR for solution table writing public Modeler(Int32 Scenario, AllModelData ModelData, ModelingParameters TableSelection, Cplex cplex) { tableSelection = TableSelection; scenario = Scenario; theData = ModelData; theModel = cplex; }
//CTOR to build initial Non-Linear model. public Modeler(int ScenarioID, ModelingParameters modelTableSelection, Int32 TrailerCapacity) { inputTable = modelTableSelection.ScenarioInputTable; scenario = ScenarioID; tableSelection = modelTableSelection; GetRecordCount(); //populates inputrecs EmptyMoves = new INumVar[inputrecs]; LoadedMoves = new INumVar[inputrecs]; TrailerTurns = new double[inputrecs]; LaneCost = new double[inputrecs]; LaneRevenue = new double[inputrecs]; LaneMargin = new double[inputrecs]; theModel = new Cplex(); theModel.Name = "Box360"; trailerCapacity = TrailerCapacity; BuildInputData(); AddMinVol_OrConstraint(modelTableSelection.Minimum_Lane_Volume); AddObjective(); AddCapacityConstraint(); AddBalanceConstraint(); }
//CTOR to build final Linear Model public Modeler(AllModelData LinearModel, ModelingParameters modelTableSelection, Cplex cplex, Int32 TrailerCapacity) { trailerCapacity = TrailerCapacity; theModel = cplex; tableSelection = modelTableSelection; inputrecs = GetLPInputRecordCount(); scenario = LinearModel.ModelData.ElementAt(0).Value.ScenarioID; EmptyMoves = new INumVar[inputrecs]; LoadedMoves = new INumVar[inputrecs]; TrailerTurns = new double[inputrecs]; LaneCost = new double[inputrecs]; LaneRevenue = new double[inputrecs]; LaneMargin = new double[inputrecs]; //NEED TO WRITE PREVIOUS SOLUTION TO INTERIM TABLE. ClearTable(tableSelection.InterimSolutionInputTable); PopulateSolution(modelTableSelection.InterimSolutionInputTable); BuildLPInputData(tableSelection.Minimum_Lane_Volume); //NEED TO REBUILD MODEL BASED UPON NON-LINEAR SOLUTION AddObjective(); AddBalanceConstraint(); AddCapacityConstraint(); }