Exemplo n.º 1
0
 internal int UpdateFeatures(int pid, int step, Schedule jssp)
 {
     LinearModel dummy = new LinearModel();
     foreach (var p in Preferences[pid - 1, step])
     {
         var lookahead = jssp.Clone();
         p.Feature = lookahead.Dispatch1(p.Dispatch.Job, FeatureMode, dummy);
     }
     return Preferences[pid - 1, step].Count;
 }
Exemplo n.º 2
0
        public void GetGlobalPhi(Schedule current, LinearModel model)
        {
            Schedule lookahead;

            for (int i = 0; i < SDRData.SDRCount; i++)
            {
                SDRData.SDR sdr = (SDRData.SDR) i;
                if (!(Math.Abs(model.GlobalWeights[(int) sdr][0]) > LinearModel.WEIGHT_TOLERANCE)) continue;
                lookahead = current.Clone();
                lookahead.ApplySDR(sdr);
                PhiGlobal[(int) (Global) (sdr)] = lookahead.Makespan;
            }

            if ((Math.Abs(model.GlobalWeights[(int) Global.RNDmin][0]) < LinearModel.WEIGHT_TOLERANCE) &&
                (Math.Abs(model.GlobalWeights[(int) Global.RNDmax][0]) < LinearModel.WEIGHT_TOLERANCE) &&
                (Math.Abs(model.GlobalWeights[(int) Global.RNDstd][0]) < LinearModel.WEIGHT_TOLERANCE) &&
                (Math.Abs(model.GlobalWeights[(int) Global.RNDmean][0]) < LinearModel.WEIGHT_TOLERANCE)) return;

            for (int i = 0; i < RND.Length; i++)
            {
                lookahead = current.Clone();
                lookahead.ApplySDR(SDRData.SDR.RND);
                RND[i] = lookahead.Makespan;
            }

            PhiGlobal[(int) Global.RNDmin] = RND.Min();
            PhiGlobal[(int) Global.RNDmax] = RND.Max();
            PhiGlobal[(int) Global.RNDmean] = RND.Average();
            PhiGlobal[(int) Global.RNDstd] = StandardDev(RND, PhiGlobal[(int) Global.RNDmean]);
        }
Exemplo n.º 3
0
 private List<Preference> FindFeaturesForAllJobs(Schedule jssp, GurobiJspModel gurobiModel)
 {
     Preference[] prefs = new Preference[jssp.ReadyJobs.Count];
     for (int r = 0; r < jssp.ReadyJobs.Count; r++)
     {
         Schedule lookahead = jssp.Clone();
         Features phi = lookahead.Dispatch1(jssp.ReadyJobs[r], FeatureMode, null); // commit the lookahead
         prefs[r] = new Preference(lookahead.Sequence[lookahead.Sequence.Count - 1], phi);
         // need to optimize to label featuers correctly -- this is computationally intensive
         gurobiModel.Lookahead(prefs[r].Dispatch, out prefs[r].ResultingOptMakespan);
         prefs[r].SimplexIterations = gurobiModel.SimplexIterations;
     }
     return prefs.ToList();
 }